Part Number Hot Search : 
CZRL4755 BAR6004S BY717 02004 OPI1268 CX452 IRFF9132 ADM1385
Product Description
Full Text Search
 

To Download TMPM333FDFG Datasheet File

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


  Datasheet File OCR Text:
  32 bit risc microcontroller tx03 series TMPM333FDFG/fyfg/fwfg
? 2010 toshiba corporation all rights reserved
TMPM333FDFG/fyfg/fwfg ************************************************************************************************************************* arm, arm powered, amba, adk, arm9tdmi, tdmi, primecell, realview, thumb, cortex, coresight, arm9, arm926ej-s, embedded trace macrocell, etm, ahb, apb, and keil are registered trademarks or trademarks of arm limited in the eu and other countries. ************************************************************************************************************************* r
introduction: notes on the description of sfr (special function register) under this specifica- tion an sfr (special function register) is a control register for periperal circuits (ip). the sfr addressses of ips are described in the chapter on memory map, and the details of sfr are given in the chapter of each ip. definition of sfr used in this specification is in accordance with the following rules. a. sfr table of each ip as an example ? ? ? ?
1.2.2 samcr(control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - mode after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol mode tdata after reset 0 0 0 1 0 0 0 0 bit bit symbol type function 31-10 ? r "0" can be read. 9-7 mode[2:0] r/w operation mode settings 000 : sample mode 0 001 : sample mode 1 010 : sample mode 2 011 : sample mode 3 the settings other than those above: reserved 6-0 tdata[6:0] w transmitted data note: the type is divided into three as shown below. r / w read write r read w write c. data descriptopn meanings of symbols used in the sfr description are as shown below. x:channel numbers/ports n,m:bit numbers d. register descriptoption registers are described as shown below. register name exmaple: samcr="000" or samcr="000" indicates bit 2 to bit 0 in bit symbol mode (3bit width). register name [bit] example: samcr[9:7]="000" it indicates bit 9 to bit 7 of the register samcr (32 bit width). TMPM333FDFG/fyfg/fwfg
TMPM333FDFG/fyfg/fwfg
revision history date revision comment 2010/6/1 1 first release 2010/10/6 2 contents revised

table of contents introduction: notes on the description of sfr (special function register) under this specification TMPM333FDFG/fyfg/fwfg 1.1 features......................................................................................................................................1 1.2 block diagram........................................................................................................................... 3 1.3 pin layout (top view)............................................................................................................... 4 1.4 pin names and functions........................................................................................................... 5 1.4.1 sorted by pin........................................................................................................................................................................5 1.4.2 sorted by port.................................................................................................................................................................... 11 1.5 pin numbers and power supply pins...................................................................................... 16 2. processor core 2.1 information on the processor core........................................................................................... 17 2.2 configurable options............................................................................................................... 17 2.3 exceptions/ interruptions ......................................................................................................... 17 2.3.1 number of interrupt inputs................................................................................................................................................ 17 2.3.2 number of priority level interrupt bits............................................................................................................................ 18 2.3.3 systick.............................................................................................................................................................................. 18 2.3.4 sysresetreq................................................................................................................................................................ 18 2.3.5 lockup........................................................................................................................................................................... 18 2.3.6 auxiliary fault status register........................................................................................................................................... 18 2.4 events...................................................................................................................................... 19 2.5 power management................................................................................................................. 19 2.6 exclusive access...................................................................................................................... 19 3. debug interface 3.1 specification overview........................................................................................................... 21 3.2 swj-dp................................................................................................................................... 21 3.3 etm......................................................................................................................................... 21 3.4 pin functions........................................................................................................................... 22 3.5 peripheral functions in halt mode.......................................................................................... 23 3.6 reset vector break.................................................................................................................. 23 3.7 connection with a debug tool................................................................................................ 24 3.7.1 about connection with debug tool..................................................................................................................................... 24 3.7.2 important points of using debug interface pins used as general-purpose ports................................................................. 24 4. memory map i
4.1 memory map............................................................................................................................ 25 4.1.1 memory map of the TMPM333FDFG ............................................................................................................................... 26 4.1.2 memory map of tmpm333fyfg.................................................................................................................................... 27 4.1.3 memory map of tmpm333fwfg................................................................................................................................... 28 4.2 sfr area detail.........................................................................................................................29 5. reset 5.1 cold reset................................................................................................................................. 31 5.2 warm reset............................................................................................................................... 32 5.2.1 reset period....................................................................................................................................................................... 32 5.2.2 after reset.......................................................................................................................................................................... 32 6. clock/mode control 6.1 features....................................................................................................................................33 6.2 registers.................................................................................................................................. 34 6.2.1 register list.......................................................................................................................................................................34 6.2.2 cgsyscr (system control register)................................................................................................................................ 35 6.2.3 cgosccr (oscillation control register).......................................................................................................................... 36 6.2.4 cgstbycr (standby control register)............................................................................................................................ 37 6.2.5 cgpllsel (pll selection register)...............................................................................................................................38 6.2.6 cgcksel (system clock selection register).................................................................................................................... 39 6.3 clock control........................................................................................................................... 40 6.3.1 clock system block diagram............................................................................................................................................ 40 6.3.2 initial values after reset .................................................................................................................................................... 40 6.3.3 clock system diagram.......................................................................................................................................................41 6.3.4 clock multiplication circuit (pll)................................................................................................................................... 42 6.3.5 warm-up function.............................................................................................................................................................. 42 6.3.6 system clock..................................................................................................................................................................... 44 6.3.6.1 high speed clock 6.3.6.2 low speed clock 6.3.7 prescaler clock control..................................................................................................................................................... 44 6.3.8 system clock pin output function................................................................................................................................... 45 6.4 modes and mode transitions................................................................................................. 46 6.4.1 mode transitions............................................................................................................................................................... 46 6.5 operation mode....................................................................................................................... 47 6.5.1 normal mode................................................................................................................................................................ 47 6.5.2 slow mode...................................................................................................................................................................... 47 6.6 low power consumption modes............................................................................................ 48 6.6.1 idle mode........................................................................................................................................................................ 48 6.6.2 sleep mode......................................................................................................................................................................48 6.6.3 stop mode ........................................................................................................................................................................49 6.6.4 low power consumption mode setting............................................................................................................................ 49 6.6.5 operational status in each mode...................................................................................................................................... 50 6.6.6 releasing the low power consumption mode................................................................................................................. 51 6.6.7 warm-up............................................................................................................................................................................52 6.6.8 clock operations in mode transition............................................................................................................................... 53 6.6.8.1 transition of operation modes: normal stop normal 6.6.8.2 transition of operation modes: normal sleep normal 6.6.8.3 transition of operation modes: slow stop slow 6.6.8.4 transition of operation modes: slow sleep slow 7. exceptions 7.1 overview.................................................................................................................................. 55 7.1.1 exception types ................................................................................................................................................................ 55 7.1.2 handling flowchart........................................................................................................................................................... 56 ii
7.1.2.1 exception request and detection 7.1.2.2 exception handling and branch to the interrupt service routine (pre-emption) 7.1.2.3 executing an isr 7.1.2.4 exception exit 7.2 reset exceptions......................................................................................................................61 7.3 non-maskable interrupts (nmi).............................................................................................. 62 7.4 systick.................................................................................................................................... 62 7.5 interrupts..................................................................................................................................63 7.5.1 interrupt sources................................................................................................................................................................63 7.5.1.1 interrupt route 7.5.1.2 generation 7.5.1.3 transmission 7.5.1.4 precautions when using external interrupt pins 7.5.1.5 list of interrupt sources 7.5.1.6 active level 7.5.2 interrupt handling.............................................................................................................................................................. 67 7.5.2.1 flowchart 7.5.2.2 preparation 7.5.2.3 detection by clock generator 7.5.2.4 detection by cpu 7.5.2.5 cpu processing 7.5.2.6 interrupt service routine (isr) 7.6 exception/interrupt-related registers..................................................................................... 72 7.6.1 register list.......................................................................................................................................................................72 7.6.2 nvic registers ..................................................................................................................................................................73 7.6.2.1 systick control and status register 7.6.2.2 systick reload value register 7.6.2.3 systick current value register 7.6.2.4 systick calibration value register 7.6.2.5 interrupt set-enable register 1 7.6.2.6 interrupt set-enable register 2 7.6.2.7 interrupt clear-enable register 1 7.6.2.8 interrupt clear-enable register 2 7.6.2.9 interrupt set-pending register 1 7.6.2.10 interrupt set-pending register 2 7.6.2.11 interrupt clear-pending register 1 7.6.2.12 interrupt clear-pending register 2 7.6.2.13 interrupt priority register 7.6.2.14 vector table offset register 7.6.2.15 application interrupt and reset control register 7.6.2.16 system handler priority register 7.6.2.17 system handler control and state register 7.6.3 clock generator registers................................................................................................................................................... 91 7.6.3.1 cgimcga(cg interrupt mode control register a) 7.6.3.2 cgimcgb(cg interrupt mode control register b) 7.6.3.3 cgimcgc(cg interrupt mode control register c) 7.6.3.4 cgicrcg(cg interrupt request clear register) 7.6.3.5 cgnmiflg(nmi flag register) 7.6.3.6 cgrstflg (reset flag register) 8. input/output ports 8.1 port functions........................................................................................................................ 101 8.1.1 function lists .................................................................................................................................................................. 101 8.1.2 port registers outline...................................................................................................................................................... 104 8.1.3 port states in stop mode............................................................................................................................................... 105 8.1.4 precautions for mode transition between stop and sleep.........................................................................................105 8.2 port functions......................................................................................................................... 106 8.2.1 port a (pa0 to pa7)........................................................................................................................................................ 106 8.2.1.1 port a circuit type 8.2.1.2 port a register 8.2.1.3 padata (port a data register) 8.2.1.4 pacr (port a output control register) 8.2.1.5 pafr1 (port a function register 1) 8.2.1.6 papup (port a pull-up control register) 8.2.1.7 papdn (port a pull-down control register) 8.2.1.8 paie (port a input control register) 8.2.2 port b (pb0 to pb7) .........................................................................................................................................................111 8.2.2.1 port b circuit type iii
8.2.2.2 port b register 8.2.2.3 pbdata (port b data register) 8.2.2.4 pbcr (port b output control register) 8.2.2.5 pbfr1 (port b function register 1) 8.2.2.6 pbpup (port b pull-up control register) 8.2.2.7 pbie (port b input control register) 8.2.3 port c (pc0 to pc3) .........................................................................................................................................................115 8.2.3.1 port c circuit type 8.2.3.2 port c register 8.2.3.3 pcdata (port c data register) 8.2.3.4 pcpup (port c pull-up control register) 8.2.3.5 pcie (port c input control register) 8.2.4 port d (pd0 to pd7)........................................................................................................................................................ 118 8.2.4.1 port d circuit type 8.2.4.2 port d register 8.2.4.3 pddata (port d data register) 8.2.4.4 pdfr1 (port d function register 1) 8.2.4.5 pdpup (port d pull-up control register) 8.2.4.6 pdie (port d input control register) 8.2.5 port e (pe0 to pe6)......................................................................................................................................................... 121 8.2.5.1 port e circuit type 8.2.5.2 port e register 8.2.5.3 pedata (port e data register) 8.2.5.4 pecr (port e output control register) 8.2.5.5 pefr1(port e function register 1) 8.2.5.6 pefr2(port e function register 2) 8.2.5.7 peod (port e open drain control register) 8.2.5.8 pepup (port e pull-up control register) 8.2.5.9 peie (port e input control register) 8.2.6 port f (pf0 to pf7).......................................................................................................................................................... 126 8.2.6.1 port f circuit type 8.2.6.2 port f register 8.2.6.3 pfdata (port f data register) 8.2.6.4 pfcr (port f output control register) 8.2.6.5 pffr1(port f function register 1) 8.2.6.6 pffr2(port f function register 2) 8.2.6.7 pfod (port f open drain control register) 8.2.6.8 pfpup (port f pull-up control register) 8.2.6.9 pfie (port f input control register) 8.2.7 port g (pg0 to pg7)........................................................................................................................................................ 131 8.2.7.1 port g circuit type 8.2.7.2 port g register 8.2.7.3 pgdata (port g data register) 8.2.7.4 pgcr (port g output control register) 8.2.7.5 pgfr1(port g function register 1) 8.2.7.6 pgod (port g open drain control register) 8.2.7.7 pgpup (port g pull-up control register) 8.2.7.8 pgie (port g input control register) 8.2.8 port h (ph0 to ph7)........................................................................................................................................................ 136 8.2.8.1 port h circuit type 8.2.8.2 port h register 8.2.8.3 phdata (port h data register) 8.2.8.4 phcr (port h output control register) 8.2.8.5 phfr1(port h function register 1) 8.2.8.6 phpup (port h pull-up control register) 8.2.8.7 phie (port h input control register) 8.2.9 port i (pi0 to pi7)............................................................................................................................................................. 140 8.2.9.1 port i circuit type 8.2.9.2 port i register 8.2.9.3 pidata(port i data register) 8.2.9.4 picr (port i output control register) 8.2.9.5 pifr1(port i function register 1) 8.2.9.6 pipup (port i pull-up control register) 8.2.9.7 piie (port i input control register) 8.2.10 port j (pj0 to pj7).......................................................................................................................................................... 144 8.2.10.1 port j circuit type 8.2.10.2 port j register 8.2.10.3 pjdata (port j data register) 8.2.10.4 pjcr (port j output control register) 8.2.10.5 pjfr1(port j function register 1) 8.2.10.6 pjpup (port j pull-up control register) 8.2.10.7 pjie (port j input control register) 8.2.11 port k (pk0 to pk2)...................................................................................................................................................... 148 8.2.11.1 port k circuit type 8.2.11.2 port k register 8.2.11.3 pkdata(port k data register) iv
8.2.11.4 pkcr (port k output control register) 8.2.11.5 pkfr1(port k function register 1) 8.2.11.6 pkfr2(port k function register 2) 8.2.11.7 pkpup (port k pull-up control register) 8.2.11.8 pkie (port k input control register) 8.3 block diagrams of ports........................................................................................................153 8.3.1 port types........................................................................................................................................................................ 153 8.3.2 type t1............................................................................................................................................................................154 8.3.3 type t2............................................................................................................................................................................155 8.3.4 type t3............................................................................................................................................................................156 8.3.5 type t4............................................................................................................................................................................157 8.3.6 type5 t5..........................................................................................................................................................................158 8.3.7 type t6............................................................................................................................................................................159 8.3.8 type t7............................................................................................................................................................................160 8.3.9 type t8............................................................................................................................................................................161 8.3.10 type t9..........................................................................................................................................................................162 8.3.11 type t10........................................................................................................................................................................163 8.3.12 type t11........................................................................................................................................................................164 8.3.13 type t12........................................................................................................................................................................165 8.3.14 type t13........................................................................................................................................................................166 8.3.15 type t14........................................................................................................................................................................167 8.3.16 type t15........................................................................................................................................................................168 8.3.17 type t16........................................................................................................................................................................169 8.3.18 type t17........................................................................................................................................................................170 8.3.19 type t18........................................................................................................................................................................171 8.4 appendix (port setting list).................................................................................................. 172 8.4.1 port a setting................................................................................................................................................................... 172 8.4.2 port b setting...................................................................................................................................................................173 8.4.3 port c setting...................................................................................................................................................................174 8.4.4 port d setting................................................................................................................................................................... 174 8.4.5 port e setting................................................................................................................................................................... 175 8.4.6 port f setting................................................................................................................................................................... 176 8.4.7 port g setting................................................................................................................................................................... 177 8.4.8 port h setting................................................................................................................................................................... 178 8.4.9 port i setting.................................................................................................................................................................... 179 8.4.10 port j setting.................................................................................................................................................................. 180 8.4.11 port k setting................................................................................................................................................................. 181 9. 16-bit timer/event counters(tmrb) 9.1 outline................................................................................................................................... 183 9.2 differences in the specifications........................................................................................... 184 9.3 configuration......................................................................................................................... 185 9.4 registers................................................................................................................................ 186 9.4.1 register list according to channel.................................................................................................................................... 186 9.4.2 tbxen (enable register)................................................................................................................................................. 187 9.4.3 tbxrun(run register) ..................................................................................................................................................188 9.4.4 tbxcr(control register)................................................................................................................................................. 189 9.4.5 tbxmod(mode register) ................................................................................................................................................ 190 9.4.6 tbxffcr(flip-flop control register).............................................................................................................................. 191 9.4.7 tbxst(status register).................................................................................................................................................... 192 9.4.8 tbxim(interrupt mask register)...................................................................................................................................... 193 9.4.9 tbxuc(up counter capture register).............................................................................................................................. 193 9.4.10 tbxrg0(timer register 0)............................................................................................................................................ 194 9.4.11 tbxrg1(timer register 1)............................................................................................................................................ 194 9.4.12 tbxcp0(capture register 0).......................................................................................................................................... 195 9.4.13 tbxcp1(capture register 1).......................................................................................................................................... 195 9.5 description of operations for each circuit........................................................................... 196 9.5.1 prescaler...........................................................................................................................................................................196 9.5.2 up-counter (uc).............................................................................................................................................................. 200 9.5.3 timer registers (tbxrg0, tbxrg1).............................................................................................................................. 200 9.5.4 capture............................................................................................................................................................................. 201 9.5.5 capture registers (tbxcp0, tbxcp1)............................................................................................................................. 201 v
9.5.6 up-counter capture register (tbxuc)............................................................................................................................. 201 9.5.7 comparators (cp0, cp1)................................................................................................................................................. 201 9.5.8 timer flip-flop (tbxff0)............................................................................................................................................... 201 9.5.9 capture interrupt (intcapx0, intcapx1)................................................................................................................... 201 9.6 description of operations for each mode............................................................................. 202 9.6.1 16-bit interval timer mode............................................................................................................................................. 202 9.6.2 16-bit event counter mode............................................................................................................................................. 202 9.6.3 16-bit ppg (programmable pulse generation) output mode......................................................................................... 203 9.6.4 timer synchronous mode................................................................................................................................................. 205 9.7 applications using the capture function .............................................................................. 206 9.7.1 one-shot pulse output triggered by an external pulse...................................................................................................... 206 9.7.2 frequency measurement.................................................................................................................................................. 208 9.7.3 pulse width measurement................................................................................................................................................ 209 9.7.4 time difference measurement........................................................................................................................................ 210 10. serial channel (sio/uart) 10.1 overview............................................................................................................................. 211 10.2 difference in the specifications of sio modules ................................................................ 211 10.3 configuration....................................................................................................................... 212 10.4 registers description........................................................................................................... 213 10.4.1 registers list in each channel...................................................................................................................................... 213 10.4.2 scxen (enable register).............................................................................................................................................. 214 10.4.3 scxbuf (buffer register) ............................................................................................................................................ 215 10.4.4 scxcr (control register)............................................................................................................................................. 216 10.4.5 scxmod0 (mode control register 0) ..........................................................................................................................217 10.4.6 scxmod1 (mode control register 1) ..........................................................................................................................218 10.4.7 scxmod2 (mode control register 2) ..........................................................................................................................219 10.4.8 scxbrcr (baud rate generator control register), scxbradd (baud rate generator control register 2).......... 221 10.4.9 scxfcnf ( fifo configuration register) ................................................................................................................... 223 10.4.10 scxrfc (rx fifo configuration register) .............................................................................................................. 224 10.4.11 scxtfc (tx fifo configuration register) (note2)................................................................................................. 225 10.4.12 scxrst (rx fifo status register) ........................................................................................................................... 226 10.4.13 scxtst (tx fifo status register) ............................................................................................................................227 10.5 operation in each mode...................................................................................................... 228 10.6 data format......................................................................................................................... 229 10.6.1 data format list............................................................................................................................................................ 229 10.6.2 parity control................................................................................................................................................................. 230 10.6.2.1 transmission 10.6.2.2 receiving data 10.6.3 stop bit length........................................................................................................................................................... 230 10.7 clock control....................................................................................................................... 231 10.7.1 prescaler......................................................................................................................................................................... 231 10.7.2 serial clock generation circuit..................................................................................................................................... 235 10.7.2.1 baud rate generator 10.7.2.2 clock selection circuit 10.8 transmit/receive buffer and fifo..................................................................................... 239 10.8.1 configuration................................................................................................................................................................. 239 10.8.2 transmit/receive buffer................................................................................................................................................ 239 10.8.3 fifo............................................................................................................................................................................... 239 10.9 status flag........................................................................................................................... 240 10.10 error flag........................................................................................................................... 240 10.10.1 oerr flag................................................................................................................................................................... 240 10.10.2 perr flag................................................................................................................................................................... 241 10.10.3 ferr flag................................................................................................................................................................... 241 10.11 receive.............................................................................................................................. 242 10.11.1 receive counter........................................................................................................................................................... 242 10.11.2 receive control unit................................................................................................................................................... 242 10.11.2.1 i/o interface mode 10.11.2.2 uart mode 10.11.3 receive operation........................................................................................................................................................ 242 vi
10.11.3.1 receive buffer 10.11.3.2 receive fifo operation 10.11.3.3 i/o interface mode with sclk output 10.11.3.4 read received data 10.11.3.5 wake-up function 10.11.3.6 overrun error 10.12 transmission...................................................................................................................... 246 10.12.1 transmission counter..................................................................................................................................................246 10.12.2 transmission control...................................................................................................................................................246 10.12.2.1 i/o interface mode 10.12.2.2 uart mode 10.12.3 transmit operation......................................................................................................................................................246 10.12.3.1 operation of transmission buffer 10.12.3.2 transmit fifo operation 10.12.3.3 i/o interface mode/transmission by sclk output 10.12.3.4 under-run error 10.13 handshake function........................................................................................................... 250 10.14 interrupt/error generation timing.................................................................................... 251 10.14.1 rx interrupts............................................................................................................................................................... 251 10.14.1.1 single buffer / double buffer 10.14.1.2 fifo 10.14.2 tx interrupts................................................................................................................................................................ 252 10.14.2.1 single buffer / double buffer 10.14.2.2 fifo 10.14.3 error generation.......................................................................................................................................................... 253 10.14.3.1 uart mode 10.14.3.2 io interface mode 10.15 software reset................................................................................................................... 253 10.16 operation in each mode.................................................................................................... 254 10.16.1 mode 0 (i/o interface mode)....................................................................................................................................... 254 10.16.1.1 transmitting data 10.16.1.2 receive 10.16.1.3 transmit and receive (full-duplex) 10.16.2 mode 1 (7-bit uart mode)........................................................................................................................................265 10.16.3 mode 2 (8-bit uart mode)........................................................................................................................................265 10.16.4 mode 3 (9-bit uart mode)........................................................................................................................................266 10.16.4.1 wakeup function 10.16.4.2 protocol 11. serial bus interface (i2c/sio) 11.1 configuration....................................................................................................................... 270 11.2 register................................................................................................................................ 271 11.2.1 registers for each channel............................................................................................................................................. 271 11.3 i2c bus mode data format.................................................................................................272 11.4 control registers in the i2c bus mode............................................................................... 273 11.4.1 sbixcr0(control register 0) ......................................................................................................................................... 273 11.4.2 sbixcr1(control register 1)......................................................................................................................................... 274 11.4.3 sbixcr2(control register 2)......................................................................................................................................... 276 11.4.4 sbixsr (status register)............................................................................................................................................... 277 11.4.5 sbixbr0(serial bus interface baud rate register 0)....................................................................................................... 278 11.4.6 sbixdbr (serial bus interface data buffer register)..................................................................................................... 278 11.4.7 sbixi2car (i2cbus address register) .......................................................................................................................... 279 11.5 control in the i2c bus mode............................................................................................... 280 11.5.1 serial clock.................................................................................................................................................................... 280 11.5.1.1 clock source 11.5.1.2 clock synchronization 11.5.2 setting the acknowledgement mode.............................................................................................................................281 11.5.3 setting the number of bits per transfer........................................................................................................................281 11.5.4 slave addressing and address recognition mode........................................................................................................ 281 11.5.5 operating mode.............................................................................................................................................................. 281 11.5.6 configuring the sbi as a transmitter or a receiver......................................................................................................282 11.5.7 configuring the sbi as a master or a slave................................................................................................................... 282 11.5.8 generating start and stop conditions........................................................................................................................... 282 11.5.9 interrupt service request and release.......................................................................................................................... 283 vii
11.5.10 arbitration lost detection monitor............................................................................................................................. 283 11.5.11 slave address match detection monitor..................................................................................................................... 285 11.5.12 general-call detection monitor ................................................................................................................................... 285 11.5.13 last received bit monitor...........................................................................................................................................285 11.5.14 data buffer register (sbixdbr)................................................................................................................................285 11.5.15 baud rate register (sbixbr0)................................................................................................................................... 285 11.5.16 software reset.............................................................................................................................................................285 11.6 data transfer procedure in the i2c bus modei2c............................................................. 286 11.6.1 device initialization.......................................................................................................................................................286 11.6.2 generating the start condition and a slave address..................................................................................................... 286 11.6.2.1 master mode 11.6.2.2 slave mode 11.6.3 transferring a data word.............................................................................................................................................. 288 11.6.3.1 master mode ( = "1") 11.6.3.2 slave mode ( = "0") 11.6.4 generating the stop condition...................................................................................................................................... 293 11.6.5 restart procedure........................................................................................................................................................... 293 11.7 control register of sio mode.............................................................................................. 295 11.7.1 sbixcr0(control register 0).......................................................................................................................................... 295 11.7.2 sbixcr1(control register 1)......................................................................................................................................... 296 11.7.3 sbixdbr (data buffer register).................................................................................................................................... 297 11.7.4 sbixcr2(control register 2)......................................................................................................................................... 298 11.7.5 sbixsr (status register)............................................................................................................................................... 299 11.7.6 sbixbr0 (baud rate register 0)..................................................................................................................................... 300 11.8 control in sio mode............................................................................................................301 11.8.1 serial clock.................................................................................................................................................................... 301 11.8.1.1 clock source 11.8.1.2 shift edge 11.8.2 transfer modes.............................................................................................................................................................. 303 11.8.2.1 8-bit transmit mode 11.8.2.2 8-bit receive mode 11.8.2.3 8-bit transmit/receive mode 11.8.2.4 data retention time of the last bit at the end of transmission 12. analog/digital converter (adc) 12.1 outline................................................................................................................................. 309 12.2 configuration....................................................................................................................... 310 12.3 registers.............................................................................................................................. 311 12.3.1 register list.................................................................................................................................................................... 311 12.3.2 adcbas (conversion accuracy setting register)...................................................................................................... 312 12.3.3 adclk (conversion clock setting register).............................................................................................................. 313 12.3.4 admod0 (mode control register 0) ..........................................................................................................................314 12.3.5 admod1 (mode control register 1) ...........................................................................................................................315 12.3.6 admod2 (mode control register 2) ..........................................................................................................................317 12.3.7 admod4 (mode control register 4) ..........................................................................................................................319 12.3.8 admod3 (mode control register 3) ...........................................................................................................................320 12.3.9 admod5 (mode control register 5) ...........................................................................................................................321 12.3.10 adreg08 (conversion result register 08)............................................................................................................... 322 12.3.11 adreg19 (ad conversion result register 19)........................................................................................................ 323 12.3.12 adreg2a (ad conversion result register 2a) ...................................................................................................... 324 12.3.13 adreg3b (ad conversion result register 3b)....................................................................................................... 325 12.3.14 adreg4c (ad conversion result register 4c)....................................................................................................... 326 12.3.15 adreg5d (ad conversion result register 5d) ...................................................................................................... 327 12.3.16 adreg6e (ad conversion result register 6e)....................................................................................................... 328 12.3.17 adreg7f (ad conversion result register 7f) ........................................................................................................329 12.3.18 adregsp (ad conversion result register sp)....................................................................................................... 330 12.3.19 adcmp0 (ad conversion result comparison register 0) ....................................................................................... 331 12.3.20 adcmp1 (ad conversion result comparison register 1) ....................................................................................... 331 12.4 description of operations.................................................................................................... 332 12.4.1 analog reference voltage............................................................................................................................................. 332 12.4.2 ad conversion mode....................................................................................................................................................332 12.4.2.1 normal ad conversion 12.4.2.2 top-priority ad conversion viii
12.4.3 ad monitor function.................................................................................................................................................... 333 12.4.4 selecting the input channel........................................................................................................................................... 334 12.4.5 ad conversion details.................................................................................................................................................. 334 12.4.5.1 starting ad conversion 12.4.5.2 ad conversion 12.4.5.3 top-priority ad conversion during normal ad conversion 12.4.5.4 stopping repeat conversion mode 12.4.5.5 reactivating normal ad conversion 12.4.5.6 conversion completion 12.4.5.7 interrupt generation timings and ad conversion result storage register 13. watchdog timer(wdt) 13.1 configuration....................................................................................................................... 341 13.2 register................................................................................................................................ 342 13.2.1 wdmod(watchdog timer mode register) ................................................................................................................ 342 13.2.2 wdcr (watchdog timer control register)................................................................................................................. 343 13.3 operations............................................................................................................................ 344 13.3.1 basic operation.............................................................................................................................................................. 344 13.3.2 operation mode and status ............................................................................................................................................ 344 13.4 operation when malfunction (runaway) is detected............................................................ 345 13.4.1 intwdt interrupt generation....................................................................................................................................... 345 13.4.2 internal reset generation................................................................................................................................................. 346 13.5 control register.................................................................................................................... 347 13.5.1 watchdog timer mode register (wdmod)................................................................................................................ 347 13.5.2 watchdog timer control register(wdcr).................................................................................................................. 347 13.5.3 setting example.............................................................................................................................................................. 348 13.5.3.1 disabling control 13.5.3.2 enabling control 13.5.3.3 watchdog timer clearing control 13.5.3.4 detection time of watchdog timer 14. real time clock (rtc) 14.1 function............................................................................................................................... 349 14.2 block diagram..................................................................................................................... 349 14.3 detailed description register.............................................................................................. 350 14.3.1 register list................................................................................................................................................................... 350 14.3.2 control register............................................................................................................................................................. 350 14.3.3 detailed description of control register...................................................................................................................... 352 14.3.3.1 rtcsecr (second column register (for page0 only)) 14.3.3.2 rtcminr (minute column register (page0/1)) 14.3.3.3 rtchourr (hour column register(page0/1)) 14.3.3.4 rtcdayr (day of the week column register(page0/1)) 14.3.3.5 rtcdater (day column register (for page0/1 only)) 14.3.3.6 rtcmonthr (month column register (for page0 only)) 14.3.3.7 rtcmonthr (selection of 24-hour clock or 12-hour clock24(for page1 only)) 14.3.3.8 rtcyearr (year column register (for page0 only)) 14.3.3.9 rtcyearr (leap year register (for page1 only)) 14.3.3.10 rtcpager(page register(page0/1)) 14.3.3.11 rtcrestr (reset register (for page0/1)) 14.4 operational description....................................................................................................... 359 14.4.1 reading clock data......................................................................................................................................................... 359 14.4.2 writing clock data.......................................................................................................................................................... 359 14.4.3 entering the low power consumption mode............................................................................................................... 361 14.5 alarm function..................................................................................................................... 362 14.5.1 "low" pulse (when the alarm register corresponds with the clock)............................................................................. 362 14.5.2 1hz cycle "low" pulse1 hz........................................................................................................................................... 363 14.5.3 16hz cycle "low" pulse16 hz....................................................................................................................................... 363 ix
15. flash memory operation 15.1 flash memory......................................................................................................................365 15.1.1 features..........................................................................................................................................................................365 15.1.2 block diagram of the flash memory section............................................................................................................... 367 15.2 operation mode................................................................................................................... 368 15.2.1 reset operation.............................................................................................................................................................. 369 15.2.2 user boot mode (single chip mode) ............................................................................................................................. 370 15.2.2.1 (1-a) method 1: storing a programming routine in the flash memory 15.2.2.2 (1-b) method 2: transferring a programming routine from an external host 15.2.3 single boot mode.......................................................................................................................................................... 378 15.2.3.1 (2-a) using the program in the on-chip boot rom 15.2.4 configuration for single boot mode.............................................................................................................................381 15.2.5 memory map................................................................................................................................................................. 382 15.2.6 interface specification.................................................................................................................................................... 383 15.2.7 data transfer format.....................................................................................................................................................384 15.2.8 restrictions on internal memories................................................................................................................................. 384 15.2.9 transfer format for single boot mode commands....................................................................................................... 384 15.2.9.1 ram transfer 15.2.9.2 show flash memory sum 15.2.9.3 transfer format for the show product information 15.2.9.4 chip erase and protect bit erase 15.2.10 operation of boot program.......................................................................................................................................... 391 15.2.10.1 ram transfer command 15.2.10.2 show flash memory sum command 15.2.10.3 show product information command 15.2.10.4 chip and protection bit erase command 15.2.10.5 acknowledge responses 15.2.10.6 determination of a serial operation mode 15.2.10.7 password 15.2.10.8 calculation of the show flash memory sum command 15.2.10.9 checksum calculation 15.2.11 general boot program flowchart................................................................................................................................ 405 15.3 on-board programming of flash memory (rewrite/erase)................................................ 406 15.3.1 flash memory................................................................................................................................................................406 15.3.1.1 block configuration 15.3.1.2 basic operation 15.3.1.3 reset(hardware reset) 15.3.1.4 commands 15.3.1.5 flash control/ status register 15.3.1.6 list of command sequences 15.3.1.7 address bit configuration for bus write cycles 15.3.1.8 flowchart 16. rom protection 16.1 outline................................................................................................................................. 421 16.2 future................................................................................................................................... 421 16.2.1 write/ erase-protection function.................................................................................................................................... 421 16.2.2 security function............................................................................................................................................................421 16.3 register................................................................................................................................ 422 16.3.1 fcflcs (flash control register)................................................................................................................................... 423 16.3.2 fcsecbit(security bit register)................................................................................................................................... 424 16.4 writing and erasing .............................................................................................................. 425 16.4.1 protection bits................................................................................................................................................................ 425 16.4.2 security bit..................................................................................................................................................................... 425 17. electrical characteristics 17.1 absolute maximum ratings................................................................................................ 427 x
17.2 dc electrical characteristics (1/3)...................................................................................... 428 17.3 dc electrical characteristics (2/3)...................................................................................... 429 17.4 dc electrical characteristics (3/3)...................................................................................... 430 17.4.1 TMPM333FDFG/tmpm333fyfg.............................................................................................................................. 430 17.4.2 tmpm333fwfg........................................................................................................................................................... 430 17.5 10-bit adc electrical characteristics ................................................................................. 431 17.6 ac electrical characteristics............................................................................................... 432 17.6.1 ac measurement condition........................................................................................................................................... 432 17.6.2 serial channel (sio/uart).......................................................................................................................................... 432 17.6.2.1 i/o interface mode 17.6.3 serial bus interface(i2c/sio)....................................................................................................................................... 434 17.6.3.1 i2c mode 17.6.3.2 clock-synchronous 8-bit sio mode 17.6.4 event counter................................................................................................................................................................ 436 17.6.5 capture........................................................................................................................................................................... 436 17.6.6 external interrupt........................................................................................................................................................... 436 17.6.7 nmi................................................................................................................................................................................ 437 17.6.8 scout pin ac characteristic...................................................................................................................................... 437 17.6.9 debug communication.................................................................................................................................................. 438 17.6.9.1 swd interface 17.6.9.2 jtag interface 17.6.10 etm trace................................................................................................................................................................... 439 17.7 flash characteristics............................................................................................................ 439 17.7.1 rewriting....................................................................................................................................................................... 439 17.8 recommended oscillation circuit....................................................................................... 440 17.8.1 ceramic oscillator.......................................................................................................................................................... 440 17.8.2 crystal oscillator............................................................................................................................................................ 440 17.9 handling precaution............................................................................................................ 441 17.9.1 solderability................................................................................................................................................................... 441 17.9.2 power-on sequence........................................................................................................................................................ 441 18. port section equivalent circuit schematic 18.1 pa0, pb1 to 2, pe1 to 3, pe5 to 6, pf1 to 7, pg0 to 6, ph0 to 7, pi6 to 7, pj0 to 3, pj6 to 7 ................................................................................................................................................ 443 18.2 pa1...................................................................................................................................... 443 18.3 pa2 to 7, pb0, pb3 to 7, pe0, pe4, pf0, pg7, pi0 to 5, pj4 to 5, pk1 to 2..................... 444 18.4 pc0 to 3, pd4 to 7............................................................................................................... 444 18.5 pd0 to 3............................................................................................................................... 444 18.6 pk0...................................................................................................................................... 445 18.7 nmi, mode........................................................................................................................ 445 18.8 reset................................................................................................................................. 445 18.9 x1, x2.................................................................................................................................. 446 18.10 xt1, xt2 ........................................................................................................................... 446 18.11 vrefh, avss.................................................................................................................. 446 19. package dimensions xi
xii
TMPM333FDFG/fyfg/fwfg the TMPM333FDFG/fyfg/fwfg is a 32-bit risc microprocessor series with an arm cortex-m3 micro- processor core. product name rom (flash) ram package TMPM333FDFG 512 kbyte 32 kbyte lqfp100-p-1414-0.50h tmpm333fyfg 256 kbyte 16 kbyte tmpm333fwfg 128 kbyte 8 kbyte features of the TMPM333FDFG/fyfg/fwfg are as follows: 1.1 features 1. arm cortex-m3 microprocessor core a. improved code efficiency has been realized through the use of thumb -2 instruction. ? ? ? ? ? ? ? ? ? product name on chip flash rom on chip ram TMPM333FDFG 512 kbyte 32 kbyte tmpm333fyfg 256 kbyte 16 kbyte tmpm333fwfg 128 kbyte 8 kbyte 3. 16-bit timer (tmrb): 10 channels ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TMPM333FDFG/fyfg/fwfg 1.1 features page 2
1.2 block diagram figure 1-1 TMPM333FDFG/fyfg/fwfgblock diagram TMPM333FDFG/fyfg/fwfg page 3 cortex-m3 cpu debug nvic i/f flash i/f ram i/f bootrom bus bridge ahb-bus-matrix d-code i-code system i/o-bus cg sio/uart (3ch) i2c/sio (3ch) port a~k tmrb (10ch) wdt rtc adc (12ch)
1.3 pin layout (top view) figure 1-2 shows the pin layout of TMPM333FDFG/fyfg/fwfg. figure 1-2 pin layout (lqfp100) TMPM333FDFG/fyfg/fwfg 1.3 pin layout (top view) page 4 1 5 10 15 20 25 80 85 90 95 100 50 45 40 35 30 75 70 65 60 55 TMPM333FDFG tmpm333fyfg tmpm333fwfg top view ain10/pd6 ain11/pd7 avss vrefh avdd3 int4/pg3 tb9out/pk2 tb7out/pj5 tb2in0/ph4 tb2in1/ph5 tb8out/pg7 test2 dvss dvdd3 sda2/so2/pg4 scl2/si2/pg5 sck2/pg6 test1 int5/pf7 txd0/pe0 rxd0/pe1 cts0/sclk0/pe2 txd1/pe4 rxd1/pe5 cts1/sclk1/pe6 pk0 pj1/int1 pi3/tb3out pb7 pf6/sck1 pf5/si1/scl1 pf4/so1/sda1 pb6 pi2/tb2out pb5 pi1/tb1out pj6/int6 pi0/tb0out pb4 ph3/tb1in1 pf2/sclk2/cts2 pf1/rxd2 pf0/txd2 ph2/tb1in0 ph1/tb0in1 ph0/tb0in0/boot pb3 pg2/sck0 pg1/si0/scl0 pg0/so0/sda0 rvss x1 dvss x2 dvdd3 pj0/int0 pa7 pa6/tracedata3 pa5/tracedata2 pa4/tracedata1 pa3/tracedata0 pa2/traceclk dvss dvdd3 pf3 pb2/trst pb1/tdi pj7/int7 test3 pa1/tck/swclk pa0/tms/swdio pb0/tdo/swv pi5/tb5out pi4/tb4out pk1/scout/alarm rvdd3 xt1 xt2 tb4in0/pi6 nmi mode reset tb4in1/pi7 tb3in0/ph6 tb3in1/ph7 int2/pj2 int3/pj3 tb6out/pj4 pe3 test4 ain0/pc0 ain1/pc1 ain2/pc2 ain3/pc3 tb5in0/ain4/pd0 tb5in1/ain5/pd1 tb6in0/ain6/pd2 tb6in1/ain7/pd3 ain8/pd4 ain9/pd5
1.4 pin names and functions table 1-1 and table 1-2 sort the input and output pins of the TMPM333FDFG/fyfg/fwfg by pin or port. each table includes alternate pin names and functions for multi-function pins. 1.4.1 sorted by pin table 1-1 pin names and functions sorted by pin (1/6) type pin no. pin name input/ output function function 1 pd6 ain10 i i input port analog input function 2 pd7 ain11 i i input port analog input ps 3 avss i ad converter: gnd pin (0v) (note) avss must be connected to gnd even if the a/d converter is not used. ps 4 vrefh i supplying the ad converter with a reference power supply. (note) vrefh must be connected to power supply even if a/d converter is not used. ps 5 avdd3 i supplying the ad converter with a power supply. (note) avdd must be connected to power supply even if a/d converter is not used. function 6 pg3 int4 i/o i i/o port external interrupt pin function 7 pk2 tb9out i/o o i/o port timer b output function 8 pj5 tb7out i/o o i/o port timer b output function 9 ph4 tb2in0 i/o i i/o port inputting the timer b capture trigger function 10 ph5 tb2in1 i/o i i/o port inputting the timer b capture trigger function 11 pg7 tb8out i/o o i/o port timer b output test 12 test2 ? test pin: (note) test pin must be left open. ps 13 dvss ? gnd pin ps 14 dvdd3 ? power supply pin function 15 pg4 sda2/so2 i/o i/o i/o port if the serial bus interface operates -in the i2c mode: data pin -in the sio mode: data pin function 16 pg5 scl2/si2 i/o i/o i/o port if the serial bus interface operates -in the i2c mode: clock pin -in the sio mode: data pin function 17 pg6 sck2 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. test 18 test1 ? test pin: (note) test pin must be left open. TMPM333FDFG/fyfg/fwfg page 5
table 1-1 pin names and functions sorted by pin (2/6) type pin no. pin name input/ output function function 19 pf7 int5 i/o i i/o port external interrupt pin function 20 pe0 txd0 i/o o i/o port sending serial data function 21 pe1 rxd0 i/o i i/o port receiving serial data function 22 pe2 sclk0 cts0 i/o i/o i i/o port serial clock input/ output handshake input pin function 23 pe4 txd1 i/o o i/o port sending serial data function 24 pe5 rxd1 i/o i i/o port receiving serial data function 25 pe6 sclk1 cts1 i/o i/o i i/o port serial clock input/ output handshake input pin function 26 pg0 sda0/so0 i/o i/o i/o port -in the i2c mode: data pin -in the sio mode: data pin function 27 pg1 scl0/si0 i/o i/o i/o port -in the i2c mode: clock pin -in the sio mode: data pin function 28 pg2 sck0 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. function 29 pb3 i/o i/o port function/ control 30 ph0 tb0in0 boot i/o i i i/o port inputting the timer b capture trigger setting a single boot mode: (note) this pin goes into single boot mode by sampling "low" at the rise of a reset signal. function 31 ph1 tb0in1 i/o i i/o port inputting the timer b capture trigger function 32 ph2 tb1in0 i/o i i/o port inputting the timer b capture trigger function 33 pf0 txd2 i/o o i/o port sending serial data function 34 pf1 rxd2 i/o i i/o port receiving serial data function 35 pf2 sclk2 cts2 i/o i/o i i/o port serial clock input/ output handshake input pin TMPM333FDFG/fyfg/fwfg 1.4 pin names and functions page 6
table 1-1 pin names and functions sorted by pin (3/6) type pin no. pin name input/ output function function 36 ph3 tb1in1 i/o i i/o port inputting the timer b capture trigger function 37 pb4 i/o i/o port function 38 pi0 tb0out i/o o i/o port timer b output function 39 pj6 int6 i/o i i/o port external interrupt pin function 40 pi1 tb1out i/o o i/o port timer b output function 41 pb5 i/o i/o port function 42 pi2 tb2out i/o o i/o port timer b output function 43 pb6 i/o i/o port function 44 pf4 sda1/so1 i/o i/o i/o port -in the i2c mode: data pin -in the sio mode: data pin function 45 pf5 scl1/si1 i/o i/o i/o port -in the i2c mode: clock pin -in the sio mode: data pin function 46 pf6 sck1 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. function 47 pb7 i/o i/o port function 48 pi3 tb3out i/o o i/o port timer b output function 49 pj1 int1 i/o i i/o port external interrupt pin function 50 pk0 i/o i/o port (note) nch open drain port. function 51 pk1 scout alarm i/o o o i/o port system clock output alarm output function 52 pi4 tb4out i/o o i/o port timer b output function 53 pi5 tb5out i/o o i/o port timer b output function/ debug 54 pb0 tdo/swv i/o o i/o port debug pin function/ debug 55 pa0 tms/swdio i/o i/o i/o port debug pin TMPM333FDFG/fyfg/fwfg page 7
table 1-1 pin names and functions sorted by pin (4/6) type pin no. pin name input/ output function function/ debug 56 pa1 tck/swclk i/o i i/o port debug pin test 57 test3 ? test pin: (note) test pin must be left open. function 58 pj7 int7 i/o i i/o port external interrupt pin function/ debug 59 pb1 tdi i/o i i/o port debug pin function/ debug 60 pb2 trst i/o i i/o port debug pin function 61 pf3 i/o i/o port ps 62 dvdd3 ? power supply pin ps 63 dvss ? gnd pin function/ debug 64 pa2 traceclk i/o o i/o port debug pin function/ debug 65 pa3 tracedata0 i/o o i/o port debug pin function/ debug 66 pa4 tracedata1 i/o o i/o port debug pin function/ debug 67 pa5 tracedata2 i/o o i/o port debug pin function/ debug 68 pa6 tracedata3 i/o o i/o port debug pin function 69 pa7 i/o i/o port function 70 pj0 int0 i/o i i/o port external interrupt pin ps 71 dvdd3 ? power supply pin clock 72 x2 o connected to a high-speed oscillator. ps 73 dvss ? gnd pin clock 74 x1 i connected to a high-speed oscillator. ps 75 rvss ? gnd pin ps 76 rvdd3 ? power supply pin clock 77 xt1 i connected to a low-speed oscillator. clock 78 xt2 o connected to a low-speed oscillator. function 79 pi6 tb4in0 i/o i i/o port inputting the timer b capture trigger TMPM333FDFG/fyfg/fwfg 1.4 pin names and functions page 8
table 1-1 pin names and functions sorted by pin (5/6) type pin no. pin name input/ output function function 80 nmi i non-maskable interrupt (note) with a noise filter (about 30ns (typical value)) control 81 mode i mode pin: (note) mode pin must be connected to gnd. function 82 reset i reset input pin (note) with a pull-up and a noise filter (about 30ns (typical value)) function 83 pi7 tb4in1 i/o i i/o port inputting the timer b capture trigger function 84 ph6 tb3in0 i/o i i/o port inputting the timer b capture trigger function 85 ph7 tb3in1 i/o i i/o port inputting the timer b capture trigger function 86 pj2 int2 i/o i i/o port external interrupt pin function 87 pj3 int3 i/o i i/o port external interrupt pin function 88 pj4 tb6out i/o o i/o port timer b output function 89 pe3 i/o i/o port test 90 test4 ? test pin: (note) test pin must be left open. function 91 pc0 ain0 i i input port analog input function 92 pc1 ain1 i i input port analog input function 93 pc2 ain2 i i input port analog input function 94 pc3 ain3 i i input port analog input function 95 pd0 ain4 tb5in0 i i i input port analog input inputting the timer b capture trigger function 96 pd1 ain5 tb5in1 i i i input port analog input inputting the timer b capture trigger TMPM333FDFG/fyfg/fwfg page 9
table 1-1 pin names and functions sorted by pin (6/6) type pin no. pin name input/ output function function 97 pd2 ain6 tb6in0 i i i input port analog input inputting the timer b capture trigger function 98 pd3 ain7 tb6in1 i i i input port analog input inputting the timer b capture trigger function 99 pd4 ain8 i i input port analog input function 100 pd5 ain9 i i input port analog input TMPM333FDFG/fyfg/fwfg 1.4 pin names and functions page 10
1.4.2 sorted by port table 1-2 pin names and functions sorted by port (1/5) port type pin no. pin name input/ output function port a function/ debug 55 pa0 tms/swdio i/o i/o i/o port debug pin port a function/ debug 56 pa1 tck/swclk i/o i i/o port debug pin port a function/ debug 64 pa2 traceclk i/o o i/o port debug pin port a function/ debug 65 pa3 tracedata0 i/o o i/o port debug pin port a function/ debug 66 pa4 tracedata1 i/o o i/o port debug pin port a function/ debug 67 pa5 tracedata2 i/o o i/o port debug pin port a function/ debug 68 pa6 tracedata3 i/o o i/o port debug pin port a function 69 pa7 i/o i/o port port b function/ debug 54 pb0 tdo/swv i/o o i/o port debug pin port b function/ debug 59 pb1 tdi i/o i i/o port debug pin port b function/ debug 60 pb2 trst i/o i i/o port debug pin port b function 29 pb3 i/o i/o port port b function 37 pb4 i/o i/o port port b function 41 pb5 i/o i/o port port b function 43 pb6 i/o i/o port port b function 47 pb7 i/o i/o port port c function 91 pc0 ain0 i i input port analog input port c function 92 pc1 ain1 i i input port analog input port c function 93 pc2 ain2 i i input port analog input port c function 94 pc3 ain3 i i input port analog input port d function 95 pd0 ain4 tb5in0 i i i input port analog input inputting the timer b capture trigger TMPM333FDFG/fyfg/fwfg page 11
table 1-2 pin names and functions sorted by port (2/5) port type pin no. pin name input/ output function port d function 96 pd1 ain5 tb5in1 i i i input port analog input inputting the timer b capture trigger port d function 97 pd2 ain6 tb6in0 i i i input port analog input inputting the timer b capture trigger port d function 98 pd3 ain7 tb6in1 i i i input port analog input inputting the timer b capture trigger port d function 99 pd4 ain8 i i input port analog input port d function 100 pd5 ain9 i i input port analog input port d function 1 pd6 ain10 i i input port analog input port d function 2 pd7 ain11 i i input port analog input port e function 20 pe0 txd0 i/o o i/o port sending serial data port e function 21 pe1 rxd0 i/o i i/o port receiving serial data port e function 22 pe2 sclk0 cts0 i/o i/o i i/o port serial clock input/ output handshake input pin port e function 89 pe3 i/o i/o port port e function 23 pe4 txd1 i/o o i/o port sending serial data port e function 24 pe5 rxd1 i/o i i/o port receiving serial data port e function 25 pe6 sclk1 cts1 i/o i/o i i/o port serial clock input/ output handshake input pin port f function 33 pf0 txd2 i/o o i/o port sending serial data port f function 34 pf1 rxd2 i/o i i/o port receiving serial data port f function 35 pf2 sclk2 cts2 i/o i/o i i/o port serial clock input/ output handshake input pin port f function 61 pf3 i/o i/o port TMPM333FDFG/fyfg/fwfg 1.4 pin names and functions page 12
table 1-2 pin names and functions sorted by port (3/5) port type pin no. pin name input/ output function port f function 44 pf4 sda1/so1 i/o i/o i/o port -in the i2c mode: data pin -in the sio mode: data pin port f function 45 pf5 scl1/si1 i/o i/o i/o port -in the i2c mode: clock pin -in the sio mode: data pin port f function 46 pf6 sck1 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. port f function 19 pf7 int5 i/o i i/o port external interrupt pin port g function 26 pg0 sda0/so0 i/o i/o i/o port -in the i2c mode: data pin -in the sio mode: data pin port g function 27 pg1 scl0/si0 i/o i/o i/o port -in the i2c mode: clock pin -in the sio mode: data pin port g function 28 pg2 sck0 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. port g function 6 pg3 int4 i/o i i/o port external interrupt pin port g function 15 pg4 sda2/so2 i/o i/o i/o port if the serial bus interface operates -in the i2c mode: data pin -in the sio mode: data pin port g function 16 pg5 scl2/si2 i/o i/o i/o port if the serial bus interface operates -in the i2c mode: clock pin -in the sio mode: data pin port g function 17 pg6 sck2 i/o i/o i/o port inputting and outputting a clock if the serial bus interface operates in the sio mode. port g function 11 pg7 tb8out i/o o i/o port timer b output port h function/ control 30 ph0 tb0in0 boot i/o i i i/o port inputting the timer b capture trigger setting a single boot mode: this pin goes into single boot mode by sampling "low" at the rise of a reset signal. port h function 31 ph1 tb0in1 i/o i i/o port inputting the timer b capture trigger port h function 32 ph2 tb1in0 i/o i i/o port inputting the timer b capture trigger port h function 36 ph3 tb1in1 i/o i i/o port inputting the timer b capture trigger TMPM333FDFG/fyfg/fwfg page 13
table 1-2 pin names and functions sorted by port (4/5) port type pin no. pin name input/ output function port h function 9 ph4 tb2in0 i/o i i/o port inputting the timer b capture trigger port h function 10 ph5 tb2in1 i/o i i/o port inputting the timer b capture trigger port h function 84 ph6 tb3in0 i/o i i/o port inputting the timer b capture trigger port h function 85 ph7 tb3in1 i/o i i/o port inputting the timer b capture trigger port i function 38 pi0 tb0out i/o o i/o port timer b output port i function 40 pi1 tb1out i/o o i/o port timer b output port i function 42 pi2 tb2out i/o o i/o port timer b output port i function 48 pi3 tb3out i/o o i/o port timer b output port i function 52 pi4 tb4out i/o o i/o port timer b output port i function 53 pi5 tb5out i/o o i/o port timer b output port i function 79 pi6 tb4in0 i/o i i/o port inputting the timer b capture trigger port i function 83 pi7 tb4in1 i/o i i/o port inputting the timer b capture trigger port j function 70 pj0 int0 i/o i i/o port external interrupt pin port j function 49 pj1 int1 i/o i i/o port external interrupt pin port j function 86 pj2 int2 i/o i i/o port external interrupt pin port j function 87 pj3 int3 i/o i i/o port external interrupt pin port j function 88 pj4 tb6out i/o o i/o port timer b output port j function 8 pj5 tb7out i/o o i/o port timer b output port j function 39 pj6 int6 i/o i i/o port external interrupt pin port j function 58 pj7 int7 i/o i i/o port external interrupt pin port k function 50 pk0 i/o i/o port (note) nch open drain port. TMPM333FDFG/fyfg/fwfg 1.4 pin names and functions page 14
table 1-2 pin names and functions sorted by port (5/5) port type pin no. pin name input/ output function port k function 51 pk1 scout alarm i/o o o i/o port system clock output alarm output port k function 7 pk2 tb9out i/o o i/o port timer b output - function 82 reset i reset input pin (note) with a pull-up and a noise filter (about 30ns (typical value)) - function 80 nmi i non-maskable interrupt (note) with a noise filter (about 30ns (typical value)) - control 81 mode i mode pin: (note) mode pin must be connected to gnd. - clock 72 x2 o connected to a high-speed oscillator. - clock 74 x1 i connected to a high-speed oscillator. - clock 77 xt1 i connected to a low-speed oscillator. - clock 78 xt2 o connected to a low-speed oscillator. - test 12 test2 ? test pin: (note) test pin must be left open. - test 18 test1 ? test pin: (note) test pin must be left open. - test 57 test3 ? test pin: (note) test pin must be left open. - test 90 test4 ? test pin: (note) test pin must be left open. - ps 3 avss i ad converter: gnd pin (0v) (note) avss must be connected to gnd even if the a/d converter is not used. - ps 4 vrefh i supplying the ad converter with a reference power supply. (note) vrefh must be connected to power supply even if a/d converter is not used. - ps 5 avdd3 i supplying the ad converter with a power supply. (note) avdd must be connected to power supply even if a/d converter is not used. - ps 13 dvss ? gnd pin - ps 14 dvdd3 ? power supply pin - ps 62 dvdd3 ? power supply pin - ps 63 dvss ? gnd pin - ps 71 dvdd3 ? power supply pin - ps 73 dvss ? gnd pin - ps 75 rvss ? gnd pin - ps 76 rvdd3 ? power supply pin TMPM333FDFG/fyfg/fwfg page 15
1.5 pin numbers and power supply pins table 1-3 pin numbers and power supplies power supply voltage range pin no. pin name dvdd3 2.7 to 3.6v 14, 62,71 pa,pb,pe,pf,pg,ph,pi,pj,pk,x1,x2,xt1, xt2, reset, nmi,mode avdd3 5 pc,pd rvdd3 76 ? TMPM333FDFG/fyfg/fwfg 1.5 pin numbers and power supply pins page 16
2. processor core the tx03 series has a high-performance 32-bit processor core (the arm cortex-m3 processor core). for infor- mation on the operations of this processor core, please refer to the "cortex-m3 technical reference manual" issued by arm limited.this chapter describes the functions unique to the tx03 series that are not explained in that document. 2.1 information on the processor core the following table shows the revision of the processor core in the TMPM333FDFG/fyfg/fwfg. refer to the detailed information about the cpu core and architecture, refer to the arm manual "cortex-m series processors" in the following url: http://infocenter.arm.com/help/index.jsp product name core revision TMPM333FDFG tmpm333fyfg r1p1-00rel0 tmpm333fwfg r1p1-01rel0 2.2 configurable options the cortex-m3 core has optional blocks. the optional blocks of the revision r1p1 are etm and mpu. the following tables shows the configurable options in the TMPM333FDFG/fyfg/fwfg. configurable options implementation mpu not implementable etm implementable 2.3 exceptions/ interruptions exceptions and interruptions are described in the following section. 2.3.1 number of interrupt inputs the number of interrupt inputs can optionally be defined from 1 to 240 in the cortex-m3 core. TMPM333FDFG/fyfg/fwfg has 46 interrupt inputs. the number of interrupt inputs is reflected in bit of nvic register. in this product, if read bit, "0y00001" is read out. TMPM333FDFG/fyfg/fwfg page 17
2.3.2 number of priority level interrupt bits the cortex-m3 core can optionally configure the number of priority level interrupt bits from 3 bits to 8 bits. TMPM333FDFG/fyfg/fwfg has three priority level interrupt bits. the number of priority level interrupt bits is used for assigning a priority level in the interrupt priority registers and system handler priority registers. 2.3.3 systick the cortex-m3 core has a systick timer which can generate systick exception. in the TMPM333FDFG/fyfg/fwfg, the clock that is input from x1 pin dividing by 32 is used as a count clock for the systic timer. systick calibration register can set a calibration value to measure 10ms. in this product, when 8mhz is input to x1 pin, calibration value is set to 0x9c4 which can measure 10ms. additionally, if this value is read as "0" both of bit and bit, it indicates that external reference clock are available and the calibration value is accurate as 10ms. 2.3.4 sysresetreq the cortex-m3 core outputs sysresetreq signal when bit of application interrupt and reset control register are set. TMPM333FDFG/fyfg/fwfg provides the same operation when sysresetreq signal are output. note:do not reset with in slow mode. 2.3.5 lockup when irreparable exception generates, the cortex-m3 core outputs lockup signal to show a serious error included in software. TMPM333FDFG/fyfg/fwfg does not use this signal. to return from lockup status, it is necessary to use non-maskable interruput (nmi) or reset. 2.3.6 auxiliary fault status register the cortex-m3 core provides auxiliary fault status registers to supply additional system fault information to software. however, TMPM333FDFG/fyfg/fwfg is not defined this function. if auxiliary fault status register is read, always "0x0000_0000" is read out. TMPM333FDFG/fyfg/fwfg 2. processor core 2.3 exceptions/ interruptions page 18
2.4 events the cortex-m3 core has event output signals and event input signals. an event output signal is output by sev instruction execution. if an event is input, the core returns from low-power consumption mode caused by wfe in- struction. TMPM333FDFG/fyfg/fwfg does not use event output signals and event input signals. please do not use sev instruction and wfe instruction. 2.5 power management the cortex-m3 core provides power management system which uses sleeping signals and sleepdeep signals. sleepdeep signals are output when bit of system control register is set. these signals are output in the following circumstances: -wait-for-interrupt (wfi) instruction execution -wait-for-event (wfe) instruction execution -the timing when interrupt-service-routine (isr) exit in case that bit of system control register is set. TMPM333FDFG/fyfg/fwfg does not use sleepdeep signals so that bit must not be set. and also event signals are not used so that please do not use wfe instruction. for detail of power management, refer to the chapter "clock/mode control." 2.6 exclusive access in cortex-m3 core, the dcode bus system supports exclusive access. however TMPM333FDFG/fyfg/fwfg does not use this function. TMPM333FDFG/fyfg/fwfg page 19
TMPM333FDFG/fyfg/fwfg 2. processor core 2.6 exclusive access page 20
3. debug interface 3.1 specification overview TMPM333FDFG/fyfg/fwfg contains the serial wire jtag debug port (swj-dp) unit for interfacing with the debugging tools and the embedded trace macrocell(etm) unit for instruction trace output.trace data is output to the dedicated pins(tracedata[3:0], swv) for the debugging via the on-chip trace port interface unit (tpiu). for details about swj-dp, etm and tpiu, refer to "cortex-m3 technical reference manual" . 3.2 swj-dp swj-dp supports the serial wire debug port (swdck, swdio) and the jtag debug port (tdi, tdo, tms, tck, trst). 3.3 etm etm supports four data signal pins (tracedata[3:0]), one clock signal pin (traceclk) and trace output from swv. TMPM333FDFG/fyfg/fwfg page 21
3.4 pin functions the debug interface pins can also be used as general-purpose ports. the pa0 and pa1 pins are shared between the jtag debug port function and the serial wire debug port function. the pb0 pin is shared between the jtag debug port function and the swv trace output function. table 3-1 swj-dp,etm debug functions swj-dp pin name general- purpose port name jtag debug function sw debug function i / o explanation i / o explanation tms / swdio pa0 input jtag test mode selection i / o serial wire data input/output tck / swclk pa1 input jtag test check input serial wire clock tdo / swv pb0 output jtag test data output (output)(note) (serial wire viewer output) tdi pb1 input jtag test data input - - trst pb2 input jtag test reset - - traceclk pa2 output trace clock output tracedata0 pa3 output trace data output0 tracedata1 pa4 output trace data output1 tracedata2 pa5 output trace data output2 tracedata3 pa6 output trace data output3 note: when swv function is enabled. after reset, pa0, pa1, pb0, pb1 and pb2 pins are configured as debug port function pins. the functions of other debug interface pins need to be programmed as required. when using a low power consumption mode, take note of the following points. note 1: if pa0 and pb0 are configured as tms/swdio and tdo/swv, output continues to be enabled even in stop mode regardless of the setting of the cgstbycr bit. note 2: if pa1 is configured as a debug function pin, it prevents a low power consumption mode from being fully effective. configure pa1 to function as a general-purpose port if the debug function is not used. table 3-2 summarizes the debug interface pin and related port settings after reset. TMPM333FDFG/fyfg/fwfg 3. debug interface 3.4 pin functions page 22
table 3-2 debug interface pins and related port settings after reset port name (bit name) debug function value of related port settings after reset function (pxfr) input (pxie) output (pxcr) pull-up (pxpup) pull-down (pxpdn) pa0 tms/swdio 1 1 1 1 ? pa1 tck/swclk 1 1 0 ? 1 pb0 tdo/swv 1 0 1 0 ? pb1 tdi 1 1 0 1 ? pb2 trst 1 1 0 1 ? pa2 traceclk 0 0 0 0 ? pa3 tracedata0 0 0 0 0 ? pa4 tracedata1 0 0 0 0 ? pa5 tracedata2 0 0 0 0 ? pa6 tracedata3 0 0 0 0 ? ? : dont care 3.5 peripheral functions in halt mode when the cortex-m3 core enters in the halt mode, the watchdog-timer (wdt) automatically stops. other peripheral functions continue to operate. 3.6 reset vector break TMPM333FDFG/fyfg/fwfg is prohibited from transmission with debug tools while reset caused by reset pin is effective.when setting a stop by using reset vector, set the following procedure after reset; set break points from the debug tools, then set the application interrupt and the bit of the reset control register to reset again. note:do not reset with in slow mode. TMPM333FDFG/fyfg/fwfg page 23
3.7 connection with a debug tool 3.7.1 about connection with debug tool concerning a connection with debug tools, refer to manufactures recommendations. debug interface pins contain a pull-up resistor and a pull-down resistor.when debug interface pins are con- nected with external pull-up or pull-down, please pay attention to input level. 3.7.2 important points of using debug interface pins used as general-purpose ports TMPM333FDFG/fyfg/fwfg is prohibited from transmission with debug tools while reset caused by re- set pin is effective. therefor it cannot change to the debug mode. the pa0, pa1, pb0, pb1 and pb2 ports are the debug interface pins after reset however if these pins are changed to the general-purpose port immediately after reset, the control from the debug tools are not accepted under some circumstances.when changing the settings, please pay attention to the status of debug interface pins. table 3-3 table of using debug interface pins debug interface pins trst tdi tdo / swv tck / swclk tms / swdio trace data[3:0] trace clk jtag+sw (after reset) jtag+sw (without trst) jtag+trace sw sw+swv debugging function disabled : enabled : disabled (usable as general-purpose port) TMPM333FDFG/fyfg/fwfg 3. debug interface 3.7 connection with a debug tool page 24
4. memory map 4.1 memory map the memory maps for theTMPM333FDFG/fyfg/fwfg are based on the arm cortex-m3 processor core mem- ory map. the internal rom is mapped to the code of the cortex-m3 core memory, the internal ram is mapped to the sram region and the special function register (sfr) is mapped to the peripheral region respectively. the special function register (sfr) indicates i/o ports and control registers for the peripheral function. the sram and sfr regions are all included in the bit-band region. the cpu register region is the processor core's internal register region. for more information on each region, see the "cortex-m3 technical reference manual". note that access to regions indicated as "fault" causes a memory fault if memory faults are enabled or a hard fault if memory faults are disabled. do not access the vendor-specific region. TMPM333FDFG/fyfg/fwfg page 25
4.1.1 memory map of the TMPM333FDFG figure 4-1shows the memory map of the TMPM333FDFG. figure 4-1 memory map (TMPM333FDFG) TMPM333FDFG/fyfg/fwfg 4. memory map 4.1 memory map page 26 sfr internal ram (32k) internal rom (512k) [b)))) [b [b))) [b [b)))) [b vendor-specific cpu register region fault fault fault [')))b)))) [(b [()b)))) [(b [))))b))))
4.1.2 memory map of tmpm333fyfg figure 4-2 shows the memory map of the tmpm333fyfg. figure 4-2 memory map (tmpm333fyfg) note:in addition to 256kb flash area, the tmpm333fyfg provides 128-word data/ password area (1 page) for show product information command in the address range 0x0007_fe00 - 0x0007_ffff. see the chapter "flash memory operation" for details on the single boot mode. do not access to the range from 0x0004_0000 through the password area. TMPM333FDFG/fyfg/fwfg page 27 sfr internal ram (16k) internal rom (256k) [b)))) [b [b))) [b [b)))) [b vendor-specific cpu register region fault fault fault [')))b)))) [(b [()b)))) [(b [))))b))))
4.1.3 memory map of tmpm333fwfg figure 4-3 shows the memory map of the tmpm333fwfg. figure 4-3 memory map (tmpm333fwfg) TMPM333FDFG/fyfg/fwfg 4. memory map 4.1 memory map page 28 sfr internal ram (8k) internal rom (128k) [b)))) [b [b))) [b [b)))) [b vencor-specific cpu register region fault fault fault [')))b)))) [(b [()b)))) [(b [))))b))))
4.2 sfr area detail this section contains the list of addresses in the sfr area (0x4000_0000 through 0x4007_ffff) assigned to pe- ripheral function. access to the reserved areas in the table 4-1 is prohibited. as for the sfr area, reading the areas not described in the table 4-1 yields undefined value. writing these area is ignored. table 4-1 sfr area detail start address end address peripheral reserved 0x4000_0000 0x4000_02bf port(a to k) 0x4000_0190 0x4000_01d0 0x4000_0210 0x4000_0250 to to to to 0x4000_0193 0x4000_01d3 0x4000_0213 0x4000_0253 0x4001_0000 0x4001_027f tmrb(10ch) 0x4002_0000 0x4002_007f i2c/sio(3ch) 0x4002_0080 0x4002_013f sio/uart(3ch) 0x4003_0000 0x4003_007f adc(12ch) 0x4003_0024 to 0x4003_002f 0x4004_0000 0x4004_003f wdt 0x4004_0100 0x4004_013f rtc 0x4004_010d 0x4004_0200 0x4004_023f cg 0x4004_022c to 0x4004_023f 0x4004_0300 0x4004_033f reserved 0x4004_0400 0x4004_047f reserved 0x4004_0428 0x4004_0468 to to 0x4004_0433 0x4004_0473 0x4004_0500 0x4004_053f flash 0x4004_0504 0x4004_0524 to to 0x4004_0507 0x4004_052b 0x4004_0540 0x4004_05bf reserved 0x4004_0540 0x4004_0550 0x4004_0560 to to to 0x4004_0547 0x4004_0553 0x4004_0593 0x4004_0700 0x4004_073f reserved 0x4004_0700 to 0x4004_0707 TMPM333FDFG/fyfg/fwfg page 29
TMPM333FDFG/fyfg/fwfg 4. memory map 4.2 sfr area detail page 30
5. reset the TMPM333FDFG/fyfg/fwfg has three reset sources: an external reset pin ( reset), a watchdog timer (wdt) and the setting in the application interrupt and reset control register. for reset from the wdt, refer to the chapter on the wdt. for reset from , refer to "cortex-m3 technical reference manual". note: do not reset with in slow mode. 5.1 cold reset the power-on sequence must consider the time for the internal regulator and oscillator to be stable.in the TMPM333FDFG/fyfg/fwfg, the internal regulator requires at least 700 s to be stable. the time required to achieve stable oscillation varies with system. at cold reset, the external reset pin must be kept "low" for a duration of time sufficiently long enough for the internal regulator and oscillator to be stable. figure 5-1 shows the power-on sequence. figure 5-1 cold reset sequence note 1: the power supply must be raised (from 0v to 2.7v) at a speed of 0.37ms/v or slower. note 2: turn on the power while the reset pin is fixed to "low". release the reset while all the power supplies are stabilized within operating voltage. TMPM333FDFG/fyfg/fwfg page 31 rvdd3, dvdd3, avdd3 2.7 v 700 # s (min.) 12 cycle(min.) reset high-speed oscillation 12 cycle(min.) r e s e t high-speed oscillation the case where it takes 700 # s or more for stable oscillation 0 v reset 0.37ms/v (min.)
5.2 warm reset 5.2.1 reset period as a precondition, ensure that the power supply voltage is within the operating range and the internal high- frequency oscillator is providing stable oscillation. to reset the TMPM333FDFG/fyfg/fwfg, assert the reset signal (active low) for a minimum duration of 12 system clocks. 5.2.2 after reset a warm reset initializes the majority of the cortex-m3 processor core's system control registers and internal function registers. the processor core's system debug components (fpb, dwt, itm) register, the clock generator's cgrstflg register and the fcsecbit register are initialized by a only cold reset. after reset, the pll multiplication circuit is inactive and must be enabled in the cgpllsel register if needed. when the reset exception handling is completed, the program branches to the reset interrupt service routine. note: the reset operation may alter the internal ram state. TMPM333FDFG/fyfg/fwfg 5. reset 5.2 warm reset page 32
6. clock/mode control 6.1 features the clock/mode control block enables to select clock gear, prescaler clock and warm-up of the pll clock multi- plication circuit and oscillator. there is also the low power consumption mode which can reduce power consumption by mode transitions. this chapter describes how to control clock operating modes and mode transitions. the clock/mode control block has the following functions: ? ? ? ?
6.2 registers 6.2.1 register list the following table shows the cg-related registers and addresses. base address = 0x4004_0200 register name address (base+) system control register cgsyscr 0x0000 oscillation control register cgosccr 0x0004 standby control register cgstbycr 0x0008 pll selection register cgpllsel 0x000c system clock selection register cgcksel 0x0010 TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.2 registers page 34
6.2.2 cgsyscr (system control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - scosel after reset 0 0 0 0 0 0 0 1 15 14 13 12 11 10 9 8 bit symbol - - - fpsel - prck after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - gear after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-18 ? r read as 0. 17-16 scosel[1:0] r/w scout out 00: fs 01: fsys/2 10: fsys 11: t0 enables to output the specified clock from scout pin. 15-13 ? r read as 0. 12 fpsel r/w fperiph 0: fgear 1: fc specifies the source clock to fperiph. 11 ? r read as 0. 10-8 prck[2:0] r/w prescaler clock 000: fperiph 001: fperiph/2 010: fperiph/4 011: fperiph/8 100: fperiph/16 101: fperiph/32 110: reserved 111: reserved specifies the prescaler clock to peripheral i/o. 7-3 ? r read as 0. 2-0 gear[2:0] r/w high-speed clock gear (fc) gear 000: fc 001: reserved 010: reserved 011: reserved 100: fc/2 101: fc/4 110: fc/8 111: reserved TMPM333FDFG/fyfg/fwfg page 35
6.2.3 cgosccr (oscillation control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - xten xen after reset 0 0 0 0 0 0 1 1 7 6 5 4 3 2 1 0 bit symbol - wupt wupsel pllon wuef wueon after reset 0 0 0 1 0 0 0 0 bit bit symbol type function 31-14 ? r read as 0. 13-12 ? r/w write "0". 11-10 ? r read as 0 9 xten r/w low-speed oscillator 0: stop 1:oscillation 8 xen r/w high-speed oscillator 0: stop 1:oscillation 7 ? r read as 0 6-4 wupt[2:0] r/w warm-up time x1 000: no warm-up 001: 2 10 / input freq. 010: 2 11 / input freq. 011: 2 12 / input freq. 100: 2 13 /input freq. 101: 2 14 / input freq. 110: 2 15 / input freq. 111: 2 16 / input freq. xt1 000:no warm-up 001: 2 6 / input freq. 010: 2 7 / input freq. 011: 2 8 / input freq. 100: 2 15 / input freq. 101: 2 16 / input freq. 110: 2 17 / input freq. 111: 2 18 / input freq. 3 wupsel r/w warm-up counter 0: x1 1: xt1 specifies the oscillator to warm-up. a clock generated by the specified oscillator is used for the warm-up timer count. 2 pllon r/w pll operation 0: stop 1: oscillation specifies operation of the pll. it stops after reset.setting the bit is required. 1 wuef r status of warm-up timer (wup) 0:warm-up completed 1: warm-up operation enables to monitor the status of the warm-up timer. 0 wueon w operation of warm-up timer 0: don't care 1: starting warm-up enables to start the warm-up timer. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.2 registers page 36
6.2.4 cgstbycr (standby control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - drve after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - rxten rxen after reset 0 0 0 0 0 0 0 1 7 6 5 4 3 2 1 0 bit symbol - - - - - stby after reset 0 0 0 0 0 0 1 1 bit bit symbol type function 31-18 ? r read as 0. 17 ? r/w write "0". 16 drve r/w pin status in stop mode. 0: inactive 1:active 15-10 ? r read as 0 9 rxten r/w low-speed oscillator operation after releasing the stop mode. 0: stop 1:oscillation 8 rxen r/w high-speed oscillator operation after releasing the stop mode. 0: stop 1:oscillation 7-3 ? r read as 0. 2-0 stby[2:0] r/w low power consumption mode 000: reserved 001: stop 010: sleep 011: idle 100: reserved 101: reserved 110: reserved 111: reserved TMPM333FDFG/fyfg/fwfg page 37
6.2.5 cgpllsel (pll selection register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - pllsel after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-1 ? r read as 0. 0 pllsel r/w use of pll 0: disuse. x1 selected 1: use specifies use or disuse of the clock multiplied by the pll. "x1" is automatically set after reset. resetting is required when using the pll. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.2 registers page 38
6.2.6 cgcksel (system clock selection register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - sysck sysckflg after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-2 ? r read as 0. 1 sysck r/w system clock 0: high-speed (fc) 1: low-speed (fs) enables to specify the system clock. setting cgosccr and to "1" in advance is required. 0 sysckflg r system clock status 0: high-speed (fc) 1: low-speed (fs) shows the status of the system clock. switching the oscillator with generates time lag to complete. if the output of the oscillator specified in is read out by , the switching has been completed. TMPM333FDFG/fyfg/fwfg page 39
6.3 clock control 6.3.1 clock system block diagram each clock is defined as follows: fosc : clock input from the x1 and x2 pins fs : clock input from the xt1 and xt2 (low-speed clock) fpll : clock quadrupled by pll fc : clock specified by cgpllsel (high-speed clock) fgear : clock specified by cgsyscr fsys : clock specified by cgcksel (system clock) fperiph : clock specified by cgsyscr t0 : clock specified by cgsyscr (prescaler clock) the high-speed clock fc and the prescaler clock t0 are dividable as follows. high-speed clock : fc, fc/2, fc/4, fc/8 prescaler clock : fperiph, fperiph/2, fperiph/4, fperiph/8, fperiph/16, fperiph/32 cpu uses the following clocks. hclk and fclk stop in the low power consumption mode (idle,sleep,stop.) hclk,fclk : fsys stclk (systick timer) : fosc/32 6.3.2 initial values after reset reset operation initializes the clock configuration as follows. high-speed oscillator : oscillating low-speed oscillator : oscillating pll (phase locked loop circuit) : stop high-speed clock gear : fc (no frequency dividing) reset operation causes all the clock configurations excluding the low-speed clock (fs) to be the same as fosc. fc = fosc fsys = fosc t0 = fosc for example, reset operation configures fsys as 10mhz when a 10mhz oscillator is connected to the x1 or x2 pin. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.3 clock control page 40
6.3.3 clock system diagram figure 6-1 shows the clock system diagram. figure 6-1 clock block diagram the input clocks to selector shown with an arrow are set as default after reset. TMPM333FDFG/fyfg/fwfg page 41 warming-up timer cgosccr cgosccr high-spped oscillation pll adc conversion clock cgsyscr fgear fperiph (to peripheal i/o) fsys 1/8 1/4 1/2 cgpllsel cgosccr xt1 xt2 cgosccr starts oscillation after reset fosc cgosccr stops after releasing reset fs cgosccr starts oscillation after reset fpll = fosc ? 4 fc cgsyscr cgcksel fs  peripherali/o prescaler input  tmrb, sio 1/32 1/16 1/8 cgsyscr 1/4 1/2 fperiph fsys fs - t0 scout cgsyscr 1/2  systick timer input  cpu(stclk) 1/32 x1 x2 low-spped oscillation ahb-bus i/o cpu(hclk/fclk), rom, ram, boot rom io-bus i/o tmrb, wdt, rtc, sio, sbi, adc, port rtc sec. counter
6.3.4 clock multiplication circuit (pll) this circuit outputs the fpll clock that is quadruple of the high-speed oscillator output clock (fosc.) as a result, the input frequency to oscillator can be low, and the internal clock be made high-speed. the pll is disabled after reset. to enable the pll, set "1" to the cgosccr bit. the pll requires a certain amount of time to be stabilized, which should be secured using the warm-up function. note: it takes approximately 200s for the pll to be stabilized. 6.3.5 warm-up function the warm-up function secures the stability time for the oscillator and the pll with the warm-up timer. the warm-up function is used when returning from stop/sleep mode. in this case, an interrupt for returning from the low power consumption mode triggers the automatic timer count. after the specified time is reached, the system clock is output and the cpu starts operation. in stop/ sleep modes, the pll is disabled. when returning from these modes, configure the warm-up time in consideration of the stability time of the pll and the internal oscillator. how to configure the warm-up function. specify the count up clock for the warm-up counter in the cgosccr bit. the warm-up time can be selected by setting the cgosccr. the cgosccr is used to confirm the start and completion of warm-up through software (instruction). after the completion of warm-up is confirmed, switch the system clock by setting the cgcksel. when clock switching occurs, the current system clock can be checked by monitoring the cgcksel table 6-1 shows the warm-up time. table 6-1 warm-up time (fosc = 10mhz, fs = 32.768khz) warm-up time options cgosccr high-speed clock (fosc) cgosccr = "0" low-speed clock (fs) cgosccr = "1" 000 ? without wup ? with wup 001 2 10 /input frequency 102.4 (s) 2 6 /input frequency 1.953 (ms) 010 2 11 /input frequency 204.8 (s) 2 7 /input frequency 3.906 (ms) 011 2 12 /input frequency 409.6 (s) 2 8 /input frequency 7.813 (ms) 100 2 13 /input frequency 819.2 (s) 2 15 /input frequency 1.0 (s) 101 2 14 /input frequency 1.638 (ms) 2 16 /input frequency 2.0 (s) 110 2 15 /input frequency 3.277 (ms) 2 17 /input frequency 4.0 (s) 111 2 16 /input frequency 6.554 (ms) 2 18 /input frequency 8.0 (s) note: the warm-up timer operates according to the oscillation clock, and it may contain errors if there is any fluctuation in the oscillation frequency. therefore, the warm-up time should be taken as approximate time. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.3 clock control page 42
the following are the examples of the warm-up function configuration. securing the stability time for the pll cgosccr = "0" : specify the warm-up counter cgosccr = "010" : specify the warm-up time (204.8s) cgosccr = "1" : start the warm-up timer (wup) cgosccr read : wait until the state becomes "0" (warm-up is finished) transition from the normal mode to the slow mode cgosccr = "1" : specify the warm-up counter cgosccr = "xxx" : specify the warm-up time cgosccr = "1" : enable the low-speed oscillation (fs) cgosccr = "1" : start the warm-up timer cgosccr read : wait until the state becomes "0" (warm-up is finished) cgcksel = "1" : switch the system clock to low speed (fs) cgcksel read : confirm that the current state is "1" (the current system clock is fs) cgosccr = "0" : disable the high-speed oscillation (fosc) transition from the slow mode to the normal mode cgosccr = "0" : specify the warm-up counter cgosccr = "xxx" : specify the warm-up time cgosccr = "1" : enable the high-speed oscillation (fosc) cgosccr = "1" :start the warm-up timer cgosccr read : wait until the state becomes "0" (warm-up is finished) cgcksel = "0" : switch the system clock to high speed (fgear) cgcksel read : confirm that the current state is "0" (the current system clock is fgear) cgosccr = "0" : disable the low-speed oscillation (fs) note: when switching the system clock, ensure that the switching has been completed by reading the cgsyscr. TMPM333FDFG/fyfg/fwfg page 43
6.3.6 system clock the TMPM333FDFG/fyfg/fwfg offers two selectable system clocks: low-speed or high-speed. the high- speed clock is dividable. note 1: switching of clock gear is executed when a value is written to the cgsyscr register. the actual switching takes place after a slight delay. 6.3.6.1 high speed clock input frequency from x1 and x2: 8mhz to 10mhz allows for oscillator connection or external clock input clock gear:1/1, 1/2, 1/4, 1/8 (after reset: 1/1) table 6-2 range of high speed frequency input freq. x1, x2 min. oper- ating freq. max oper- ating freq. after reset (pll = off, cg = 1/1) clock gear (cg) pll = @on clock gear (cg) pll = @off 1/1 1/2 1/4 1/8 1/1 1/2 1/4 1/8 8mhz 1 mhz 40 mhz 8 32 16 8 4 8 4 2 1 10mhz 10 40 20 10 5 10 5 2.5 1.25 note: pll=on/off setting: available in cgosccr clock gear setting: available in cgsyscr. 6.3.6.2 low speed clock input frequency from xt1 and xt2 table 6-3 range of low speed frequency input frequency range maximum operating frequency minimum operating frequency 30 to 34 (khz) 34 khz 30 khz 6.3.7 prescaler clock control each peripheral function has a prescaler for dividing a clock. as the clock t0 to be input to each prescaler, the "fperiph" clock specified in the cgsyscr can be divided according to the setting in the cgsyscr. after the controller is reset, fperiph/1 is selected as t0. note: to use the clock gear, ensure that you make the time setting such that prescaler output tn from each peripheral function is slower than fsys ( tn < fsys). do not switch the clock gear while the timer counter or other peripheral function is operating. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.3 clock control page 44
6.3.8 system clock pin output function the tx03 enables to output the system clock from a pin. the pk1/scout pin can output the low speed clock fs, the system clock fsys and fsys/2, and the prescaler input clock for peripheral i/o t0. by setting the port k registers, the pkcr and pkfr1 to "1", the pk1/scout pin (pin number 51) becomes the scout output pin. the output clock is selected by setting the cgsyscr. table 6-4 shows the pin status in each mode when the scout pin is set to the scout output. table 6-4 scout output status in each mode mode normal slow low power consumption mode scout selection cgsyscr idle sleep stop = "00" output the fs clock = "01" output the fsys/2 clock = "10" output the fsys clock = "11" output the t0 clock fixed to "0" or "1". note: the phase difference (ac timing) between the system clock output by the scout and the internal clock is not guaranteed. TMPM333FDFG/fyfg/fwfg page 45
6.4 modes and mode transitions 6.4.1 mode transitions the normal mode and the slow mode use the high-speed and low-speed clocks for the system clock respectively. the idle, sleep and stop modes can be used as the low power consumption mode that enables to reduce power consumption by halting processor core operation. when the low-speed clock is not used, the slow and sleep modes cannot be used. figure 6-2 shows a mode transition diagram. for a detail of sleep-on-exit, refer to "cortex-m3 technical reference manual." figure 6-2 mode transition diagram TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.4 modes and mode transitions page 46 5hvhwkdvehhqshuirphg ,qvwuxfwlrq / sleep on exit ,qwhuuxsw 5hvhw normal mode idle prgh stop prgh slow mode sleep mode ,qvwuxfwlrq / sleep on exit ,qwhuuxsw ,qwhuuxsw ,qvwuxfwlrq / sleep on exit ,qvwuxfwlrq ,qwhuuxsw ,qwhuuxsw ,qvwuxfwlrq / sleep on exit ,qvwuxfwlrq / sleep on exit
6.5 operation mode two operation modes, normal and slow, are available. the features of each mode are described in the fol- lowing section. 6.5.1 normal mode this mode is to operate the cpu core and the peripheral hardware by using the high-speed clock. it is shifted to the normal mode after reset. the low-speed clock can also be used. 6.5.2 slow mode this mode is to operate the cpu core and the peripheral hardware by using the low-speed clock with high- speed clock stopped. the slow mode reduces power consumption compared to the normal mode. this mode allows only the following peripheral functions to operate: i/o ports, real-time clock (rtc). note 1: be sure to stop peripheral functions except for the cpu, rtc and i/o ports before switching to the slow mode. note 2: in the slow mode, be sure not to perform reset using the application interrupt and reset control register of the cortex-m3 nvic register. TMPM333FDFG/fyfg/fwfg page 47
6.6 low power consumption modes the tx03 has three low power consumption modes: idle, sleep and stop. to shift to the low power con- sumption mode, specify the mode in the system control register cgstbycr and execute the wfi (wait for interrupt) instruction. in this case, execute reset or generate the interrupt to release the mode. releasing by the interrupt requires settings in advance. see the chapter "exceptions" for details. note 1: the tx03 does not offer any event for releasing the low power consumption mode. transition to the low power consumption mode by executing the wfe (wait for event) instruction is prohibited. note 2: the tx03 does not support the low power consumption mode configured with the sleepdeep bit in the cortex-m3 core. setting the bit of the system control register is prohibited. the features of each mode are described as follows. 6.6.1 idle mode only the cpu is stopped in this mode. each peripheral function has one bit in its control register for enabling or disabling operation in the idle mode. when the idle mode is entered, peripheral functions for which operation in the idle mode is disabled stop operation and hold the state at that time. the following peripheral functions can be enabled or disabled in the idle mode. for setting details, see the chapter on each peripheral function. 16-bit timer/event counter (tmrb) serial channel (sio/uart) serial bus interface (i2c/sio) analog digital converter (adc) watch dog timer (wdt) 6.6.2 sleep mode in the sleep mode, the internal low-speed oscillator and real time clock can be operated. by releasing the sleep mode, the device returns to the preceding mode of the sleep mode and starts oper- ation. note: when pa1 (pin number 56 ) is configured as a debug function pin, it prevents the low power con- sumption mode from being fully effective. configure pa1 to function as a general-purpose port if the debug function is not used. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.6 low power consumption modes page 48
6.6.3 stop mode all the internal circuits including the internal oscillator are brought to a stop in the stop mode. by releasing the stop mode, the device returns to the preceding mode of the stop mode and starts operation. the stop mode enables to select the pin status by setting the cgstbycr.table 6-5 shows the pin status in the stop mode. note: when pa1 (pin number 56 ) is configured as a debug function pin, it prevents the low power con- sumption mode from being fully effective. configure pa1 to function as a general-purpose port when the debug function is not used. table 6-5 pin states in the stop mode pin name i/o = 0 = 1 not ports x1, xt1 input only x2, xt2 output only "high" level output. "high" level output. reset, nmi, mode input only ports pa0, pb0 [when used as a debug pin (pxfrn=1) and output is enabled (pxcr=1)] (note) input depends on (pxie[m]) output enabled when data is valid. disabled when data is invalid. pf7, pg3, pj0, pj1, pj2, pj3, pj6, pj7 [when used as an interrupt pin (pxfrn=1) and input is enabled (pxie=1)] (note) input output depends on (pxcr[m]) other port pins input depends on (pxie[m]) output depends on (pxcr[m]) : input or output enabled. : input or output disabled. note: x: port number / m: corresponding bit / n: function register number 6.6.4 low power consumption mode setting the low power consumption mode is specified by the setting of the standby control register cgstbycr. table 6-6 shows the mode setting in the . table 6-6 low power consumption mode setting mode cgstbycr stop 001 sleep 010 idle 011 note: do not set any value other than those shown above in . TMPM333FDFG/fyfg/fwfg page 49
6.6.5 operational status in each mode table 6-7 show the operational status in each mode. for i/o port, "" and "" indicate that input/output is enabled and disabled respectively. for other functions, "" and "" indicate that clock is supplied and is not supplied respectively. table 6-7 operational status in each mode block normal slow idle sleep stop processor core i/o port * (note 3) adc (note 1) on/off select- able for each module sio (note 1) sbi (note 1) tmrb (note 1) wdt (note 1) rtc cg pll high-speed oscilla- tor (fc) * (note 2) low-speed oscillator (fs) note 1: in the slow mode, the adc, sio, sbi, tmrb and wdt cannot be used and must be stopped. note 2: the high-speed oscillator does not stop automatically and must be stopped by setting the cgosccr bit. note 3: the status depends on the cgstbycr bit. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.6 low power consumption modes page 50
6.6.6 releasing the low power consumption mode the low power consumption mode can be released by an interrupt request, non-maskable interrupt (nmi) or reset. the release source that can be used is determined by the low power consumption mode selected. details are shown in table 6-8. table 6-8 release source in each mode low power consumption mode idle sleep stop release source interrupt int0 to 7 (note1) intrtc inttb0 to 9 intcap00 to 60, 01 to 61 intrx0 to 2, inttx0 to 2 intsbi0 to 2 intad/intadhp/intadm0, 1 nmi (intwdt) nmi ( nmi pin) reset ( reset pin) : : starts the interrupt handling after the mode is released. (the reset initializes the lsi) unavailable note 1: to release the low power consumption mode by using the level mode interrupt, keep the level until the interrupt handling is started. changing the level before then will prevent the interrupt handling from starting properly. note 2: for shifting to the low power consumption mode, set the cpu to prohibit all the interrupts other than the release source. if not, releasing may be executed by an unspecified interrupt. release by interrupt request to release the low power consumption mode by an interrupt, the cpu must be set in advance to detect the interrupt. in addition to the setting in the cpu, the clock generator must be set to detect the interrupt to be used to release the sleep and stop modes. release by non-maskable interrupt (nmi) there are two kinds of nmi sources: wdt interrupt (intwdt) and nmi pin. intwdt can only be used in the idle mode. the nmi pin can be used to release all the lower power consumption modes. release by reset any low power consumption mode can be released by reset from the reset pin. after that, the mode switches to the normal mode and all the registers are initialized as is the case with normal reset. note that returning to the stop mode by reset does not induce the automatic warm-up. keep the reset signal valid until the oscillator operation becomes stable. refer to "interrupts" for details. TMPM333FDFG/fyfg/fwfg page 51
6.6.7 warm-up mode transition may require the warm-up so that the internal oscillator provides stable oscillation. in the mode transition from stop to the normal/ slow or from sleep to normal, the warm-up counter is activated automatically. and then the system clock output is started after the elapse of configured warm-up time. it is necessary to select a oscillator to be used for warm-up in the cgosccr and to set a warm- up time in the cgosccr before executing the instruction to enter the stop/ sleep mode. note: in stop/ sleep modes, the pll is disabled. when returning from these modes, configure the warm-up time in consideration of the stability time of the pll and the internal oscillator. it takes approximately 200s for the pll to be stabilized. in the transition from normal to slow/ sleep, the warm-up is required so that the internal oscillator to stabilize if the low-speed clock is disabled. enable the low-speed clock and then activate the warm-up by software. in the transition from slow to normal when the high-speed clock is disabled, enable the high-speed clock and then activate the warm-up. table 6-9 shows whether the warm-up setting of each mode transition is required or not. table 6-9 warm-up setting in mode transition mode transition warm-up setting normal idle not required normal sleep (note1) normal slow (note 1) normal stop not required idle normal not required sleep normal auto-warm-up sleep slow not required slow normal (note 2) slow sleep not required slow stop not required stop normal auto-warm-up (note 3) stop slow auto-warm-up note 1: if the low-speed clock is disabled, enable the low-speed clock and then activate the warm-up by software. note 2: if the high-speed clock is disabled, enable the high-speed clock and then activate the warm-up by software. note 3: returning to normal mode by reset does not induce the automatic warm-up. keep the reset signal valid until the oscillator operation becomes stable. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.6 low power consumption modes page 52
6.6.8 clock operations in mode transition the clock operations in mode transition are described in chapter 6.6.8.1 to 6.6.8.4. 6.6.8.1 transition of operation modes: normal stop normal when returning to the normal mode from the stop mode, the warm-up is activated automatically. it is necessary to set the warm-up time before entering the stop mode. returning to the normal mode by reset does not induce the automatic warm-up. keep the reset signal asserted until the oscillator operation becomes stable. 6.6.8.2 transition of operation modes: normal sleep normal when returning to the normal mode from the sleep mode, the warm-up is activated automatically. it is necessary to set the warm-up time before entering the sleep mode. returning to the normal mode by reset does not induce the automatic warm-up. keep the reset signal asserted until the oscillator operation becomes stable. TMPM333FDFG/fyfg/fwfg page 53 fsys (system clock) sleep fosc normal normal mode warm-up system clock stops high-speed clock starts oscillating. warm-up starts. wfi instruction/ sleep on exit release event occurs. warm-up completes. system clock starts. oscillation continues. fs (low speed clock) fsys (system clock) stop fosc normal normal mode warm-up system clock stops high-speed clock starts oscillating. warm-up starts. wfi instruction/ sleep on exit release event occurs. warm-up completes. system clock starts
6.6.8.3 transition of operation modes: slow stop slow the warm-up is activated automatically. it is necessary to set the warm-up time before entering the stop mode. 6.6.8.4 transition of operation modes: slow sleep slow the low-speed clock continues oscillation in the sleep mode. there is no need to make a warm-up setting. TMPM333FDFG/fyfg/fwfg 6. clock/mode control 6.6 low power consumption modes page 54 fsys (system clock= fs) sleep fs slow slow mode system clock stops. wfi instruction / sleep on exit release event occurs. system clock starts. fsys (system clock=fs) stop fs slow slow mode warm-up system clock stops low-speed clock starts oscillating. warm-up starts. wfi insutruction/ sleep on exit release eventoccurs. warm-up completes. system clock starts.
7. exceptions this chapter describes features, types and handling of exceptions. exceptions have close relation to the cpu core. refer to "cortex-m3 technical reference manual" if needed. 7.1 overview an exception causes the cpu to stop the currently executing process and handle another process. there are two types of exceptions: those that are generated when some error condition occurs or when an instruction to generate an exception is executed; and those that are generated by hardware, such as an interrupt request signal from an external pin or peripheral function. all exceptions are handled by the nested vectored interrupt controller (nvic) in the cpu according to the re- spective priority levels. when an exception occurs, the cpu stores the current state to the stack and branches to the corresponding interrupt service routine (isr). upon completion of the isr, the information stored to the stack is automatically restored. 7.1.1 exception types the following types of exceptions exist in the cortex-m3. for detailed descriptions on each exception, refer to "cortex-m3 technical reference manual". ? ? ? ? ? ? ? ? ? ? ?
7.1.2 handling flowchart the following shows how an exception/interrupt is handled. in the following descriptions, indicates hardware handling. indicates software handling. each step is described later in this chapter. processing description see detection by cg/cpu the cg/cpu detects the exception request. section 7.1.2.1 handling by cpu the cpu handles the exception request. section 7.1.2.2 branch to isr the cpu branches to the corresponding interrupt service routine (isr). execution of isr necessary processing is executed. section 7.1.2.3 return from exception the cpu branches to another isr or returns to the previous program. section 7.1.2.4 7.1.2.1 exception request and detection (1) exception occurrence exception sources include instruction execution by the cpu, memory accesses, and interrupt requests from external interrupt pins or peripheral functions. an exception occurs when the cpu executes an instruction that causes an exception or when an error condition occurs during instruction execution. an exception also occurs by an instruction fetch from the execute never (xn) region or an access violation to the fault region. an interrupt request is generated from an external interrupt pin or peripheral function.for interrupts that are used for releasing a standby mode, relevant settings must be made in the clock generator.for details, refer to "7.5 interrupts". TMPM333FDFG/fyfg/fwfg 7. exceptions 7.1 overview page 56
(2) exception detection if multiple exceptions occur simultaneously, the cpu takes the exception with the highest priority. table 7-1 shows the priority of exceptions. "configurable" means that you can assign a priority level to that exception. memory management, bus fault and usage fault exceptions can be enabled or dis- abled. if a disabled exception occurs, it is handled as hard fault. table 7-1 exception types and priority no. exception type priority description 1 reset ?3 (highest) reset pin, wdt or sysretreq 2 non-maskable interrupt ?2 nmi pin or wdt 3 hard fault ?1 fault that cannot activate because a higher-priority fault is being handled or it is disabled 4 memory management configurable exception from the memory protection unit (mpu) (note 1) instruction fetch from the execute never (xn) region 5 bus fault configurable access violation to the hard fault region of the memory map 6 usage fault configurable undefined instruction execution or other faults related to instruction ex- ecution 7~10 reserved ? 11 svcall configurable system service call with svc instruction 12 debug monitor configurable debug monitor when the cpu is not faulting 13 reserved ? 14 pendsv configurable pendable system service request 15 systick configurable notification from system timer 16~ external interrupt configurable external interrupt pin or peripheral function (note 2) note 1: this product does not contain the mpu. note 2: external interrupts have different sources and numbers in each product. for details, see "7.5.1.5 list of interrupt sources". (3) priority setting priority levels the external interrupt priority is set to the interrupt priority register and other exceptions are set to bit in the system handler priority register. the configuration can be changed, and the number of bits required for setting the priority varies from 3 bits to 8 bits depending on products. thus, the range of priority values you can specify is different depending on products. in the case of 8-bit configuration, the priority can be configured in the range from 0 to 255. the highest priority is "0". if multiple elements with the same priority exist, the smaller the number, the higher the priority becomes. note: bit is defined as a 3-bit configuration with this product. priority grouping the priority group can be split into groups. by setting the of the application interrupt and reset control register, can be divided into the pre-emption priority and the sub priority. a priority is compared with the pre-emption priority. if the priority is the same as the pre- emption priority, then it is compared with the sub priority. if the sub priority is the same as the priority, the smaller the exception number, the higher the priority. TMPM333FDFG/fyfg/fwfg page 57
the table 7-2 shows the priority group setting. the pre-emption priority and the sub priority in the table are the number in the case that is defined as an 8-bit configuration. table 7-2 priority grouping setting setting number of pre-emption priorities number of subpriorities pre-emption field subpriority field 000 [7:1] [0] 128 2 001 [7:2] [1:0] 64 4 010 [7:3] [2:0] 32 8 011 [7:4] [3:0] 16 16 100 [7:5] [4:0] 8 32 101 [7:6] [5:0] 4 64 110 [7] [6:0] 2 128 111 none [7:0] 1 256 note: if the configuration of is less than 8 bits, the lower bit is "0". for the example, in the case of 3-bit configuration, the priority is set as and is "00000". 7.1.2.2 exception handling and branch to the interrupt service routine (pre-emption) when an exception occurs, the cpu suspends the currently executing process and branches to the interrupt service routine. this is called "pre-emption". (1) stacking when the cpu detects an exception, it pushes the contents of the following eight registers to the stack in the following order: program counter (pc) program status register (xpsr) r0 - r3 r12 link register (lr) the sp is decremented by eight words by the completion of the stack push.the following shows the state of the stack after the register contents have been pushed. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.1 overview page 58
old sp xpsr pc lr r12 r3 r2 r1 sp r0 (2) fetching an isr the cpu enables instruction to fetch the interrupt processing with data store to the register. prepare a vector table containing the top addresses of isrs for each exception.after reset, the vector table is located at address 0x0000_0000 in the code area.by setting the vector table offset register, you can place the vector table at any address in the code or sram space. the vector table should also contain the initial value of the main stack. (3) late-arriving if the cpu detects a higher priority exception before executing the isr for a previous exception, the cpu handles the higher priority exception first. this is called "late-arriving". a late-arriving exception causes the cpu to fetch a new vector address for branching to the corre- sponding isr, but the cpu does not newly push the register contents to the stack. (4) vector table the vector table is configured as shown below. you must always set the first four words (stack top address, reset isr address, nmi isr address, and hard fault isr address).set isr addresses for other exceptions if necessary. offset exception contents setting 0x00 reset initial value of the main stack required 0x04 reset isr address required 0x08 non-maskable interrupt isr address required 0x0c hard fault isr address required 0x10 memory management isr address optional 0x14 bus fault isr address optional 0x18 usage fault isr address optional 0x1c ~ 0x28 reserved 0x2c svcall isr address optional 0x30 debug monitor isr address optional 0x34 reserved 0x38 pendsv isr address optional 0x3c systick isr address optional 0x40 external interrupt isr address optional TMPM333FDFG/fyfg/fwfg page 59
7.1.2.3 executing an isr an isr performs necessary processing for the corresponding exception. isrs must be prepared by the user. an isr may need to include code for clearing the interrupt request so that the same interrupt will not occur again upon return to normal program execution. for details about interrupt handling, see "7.5 interrupts". if a higher priority exception occurs during isr execution for the current exception, the cpu abandons the currently executing isr and services the newly detected exception. 7.1.2.4 exception exit (1) execution after returning from an isr when returning from an isr, the cpu takes one of the following actions: ? ? ? (2) exception exit sequence when returning from an isr, the cpu performs the following operations: ? ? ? 7. exceptions 7.1 overview page 60
7.2 reset exceptions reset exceptions are generated from the following three sources. use the reset flag (cgrstflg) register of the clock generator to identify the source of a reset. ? ? ? note: do not reset with in slow mode. TMPM333FDFG/fyfg/fwfg page 61
7.3 non-maskable interrupts (nmi) non-maskable interrupts are generated from the following two sources. use the nmi flag (cgnmiflg) register of the clock generator to identify the source of a non-maskable interrupt. ? ? 7.4 systick systick provides interrupt features using the cpu's system timer. when you set a value in the systick reload value register and enable the systick features in the systick control and status register, the counter loads with the value set in the reload value register and begins counting down.when the counter reaches "0", a systick exception occurs.you may be pending exceptions and use a flag to know when the timer reaches "0". the systick calibration value register holds a reload value for counting 10 ms with the system timer. the count clock frequency varies with each product, and so the value set in the systick calibration value register also varies with each product. note: in this product, the system timer counts based on a clock obtained by dividing the clock input from the x1 pin by 32.the systick calibration value register is set to 0x9c4, which provides 10 ms timing when the clock input from x1 is 8 mhz. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.3 non-maskable interrupts (nmi) page 62
7.5 interrupts this chapter describes routes, sources and required settings of interrupts. the cpu is notified of interrupt requests by the interrupt signal from each interrupt source. it sets priority on interrupts and handles an interrupt request with the highest priority. interrupt requests for clearing a standby mode are notified to the cpu via the clock generator. therefore, appropriate settings must be made in the clock generator. 7.5.1 interrupt sources 7.5.1.1 interrupt route figure 7-1 shows an interrupt request route. the interrupts issued by the peripheral function that is not used to release standby are directly input to the cpu (route1). the peripheral function interrupts used to release standby (route 2) and interrupts from the external interrupt pin (route 3) are input to the clock generator and are input to the cpu through the logic for releasing standby (route 4 and 5). if interrupts from the external interrupt pins are not used to release standby, they are directly input to the cpu, not through the logic for standby release (route 6). figure 7-1 interrupt route TMPM333FDFG/fyfg/fwfg page 63 peripheral function cpu exiting standby mode clock generator peripheral function interruptrequest  external interrupt pin 0 1      port
7.5.1.2 generation an interrupt request is generated from an external pin or peripheral function assigned as an interrupt source or by setting the nvic's interrupt set-pending register. ? ? ? 7.5.1.3 transmission an interrupt signal from an external pin or peripheral function is directly sent to the cpu unless it is used to exit a standby mode. interrupt requests from interrupt sources that can be used for clearing a standby mode are transmitted to the cpu via the clock generator. for these interrupt sources, appropriate settings must be made in the clock generator in advance. external interrupt sources not used for exiting a standby mode can be used without setting the clock generator. 7.5.1.4 precautions when using external interrupt pins if you use external interrupts, be aware the followings not to generate unexpected interrupts. if input disabled (pxie="0"), inputs from external interrupt pins are "high". also, if external interrupts are not used as a trigger to release standby (route 6 of "figure 7-1 interrupt route"), input signals from the external interrupt pins are directly sent to the cpu. since the cpu recognizes "high" input as an interrupt, interrupts occur if corresponding interrupts are enabled by the cpu as inputs are being disabled. to use the external interrupt without setting it as a standby trigger, set the interrupt pin input as "low" and enable it. then, enable interrupts on the cpu. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.5 interrupts page 64
7.5.1.5 list of interrupt sources table 7-3 shows the list of interrupt sources. table 7-3 list of interrupt sources no. interrupt source active level (clearing standby) cg interrupt mode control register 0 int0 interrupt pin (pj0/70pin) selectable cgimcga 1 int1 interrupt pin (pj1/49pin) 2 int2 interrupt pin (pj2/86pin) 3 int3 interrupt pin (pj3/87pin) 4 int4 interrupt pin (pg3/6pin) cgimcgb 5 int5 interrupt pin (pf7/19pin) 6 intrx0 serial reception (channel.0) 7 inttx0 serial transmission (channel.0) 8 intrx1 serial reception (channel.1) 9 inttx1 serial transmission (channel.1) 10 intsbi0 serial bus interface 0 11 intsbi1 serial bus interface 1 12 reserved - 13 reserved - 14 reserved - 15 intadhp highest priority ad conversion complete interrupt 16 intadm0 ad conversion monitoring function interrupt 0 17 intadm1 ad conversion monitoring function interrupt 1 18 inttb0 16-bit tmrb match detection 0 19 inttb1 16-bit tmrb match detection 1 20 inttb2 16-bit tmrb match detection 2 21 inttb3 16-bit tmrb match detection 3 22 inttb4 16-bit tmrb match detection 4 23 inttb5 16-bit tmrb match detection 5 24 inttb6 16-bit tmrb match detection 6 25 intrtc real time clock falling edge cgimcgc 26 intcap00 16-bit tmrb input capture 00 27 intcap01 16-bit tmrb input capture 01 28 intcap10 16-bit tmrb input capture 10 29 intcap11 16-bit tmrb input capture 11 30 intcap50 16-bit tmrb input capture 50 31 intcap51 16-bit tmrb input capture 51 32 intcap60 16-bit tmrb input capture 60 33 intcap61 16-bit tmrb input capture 61 34 int6 interrupt pin (pj6/39pin) selectable cgimcgc 35 int7 interrupt pin (pj7/58pin) 36 intrx2 serial reception (channel.2) 37 inttx2 serial transmission (channel.2) 38 intsbi2 serial bus interface 2 39 reserved - TMPM333FDFG/fyfg/fwfg page 65
table 7-3 list of interrupt sources no. interrupt source active level (clearing standby) cg interrupt mode control register 40 inttb7 16-bit tmrb match detection 7 41 inttb8 16-bit tmrb match detection 8 42 inttb9 16-bit tmrb match detection 9 43 intcap20 16-bit tmrb input capture 20 44 intcap21 16-bit tmrb input capture 21 45 intcap30 16-bit tmrb input capture 30 46 intcap31 16-bit tmrb input capture 31 47 intcap40 16-bit tmrb input capture 40 48 intcap41 16-bit tmrb input capture 41 49 intad a/d conversion completion 7.5.1.6 active level the active level indicates which change in signal of an interrupt source triggers an interrupt. the cpu recognizes interrupt signals in "high" level as interrupt. interrupt signals directly sent from peripheral func- tions to the cpu are configured to output "high" to indicate an interrupt request. active level is set to the clock generator for interrupts which can be a trigger to release standby. interrupt requests from peripheral functions are set as rising-edge or falling-edge triggered. interrupt requests from interrupt pins can be set as level-sensitive ("high" or "low") or edge-triggered (rising or falling). if an interrupt source is used for clearing a standby mode, setting the relevant clock generator register is also required. enable the cgimcgx bit and specify the active level in the cgimcgx bits. you must set the active level for interrupt requests from each peripheral function as shown in table 7-3. an interrupt request detected by the clock generator is notified to the cpu with a signal in "high" level. note: for the real time clock interrupts, set the bit to "1" and specify the active level, even when they are not used for clearing a standby mode. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.5 interrupts page 66
7.5.2 interrupt handling 7.5.2.1 flowchart the following shows how an interrupt is handled. in the following descriptions, indicates hardware handling. indicates software handling. processing details see settings for detection set the relevant nvic registers for detecting interrupts. set the clock generator as well if each interrupt source is used to clear a standby mode. common setting nvic registers setting to clear standby mode clock generator "7.5.2.2 preparation" settings for sending interrupt signal execute an appropriate setting to send the interrupt signal depending on the in- terrupt type. setting for interrupt from external pin port setting for interrupt from peripheral function peripheral function (see the chapter of each peripheral function for details.) interrupt generation an interrupt request is generated. interrupt lines used for clearing a standby mode are connected to the cpu via the clock generator. "7.5.2.3 detection by clock generator" cpu detects interrupt the cpu detects the interrupt. "7.5.2.4 detection by cpu" if multiple interrupt requests occur simultaneously, the interrupt request with the highest priority is detected according to the priority order. cpu handles interrupt the cpu handles the interrupt. "7.5.2.5 cpu pro- cessing" the cpu pushes register contents to the stack before entering the isr. TMPM333FDFG/fyfg/fwfg page 67 cg detects interrupt (clearing standby mode) clearing standby mode not clearing standby mode
processing details see isr execution program for the isr. clear the interrupt source if needed. "7.5.2.6 interrupt service routine (isr)" return to preceding program configure to return to the preceding program of the isr. 7.5.2.2 preparation when preparing for an interrupt, you need to pay attention to the order of configuration to avoid any unexpected interrupt on the way. initiating an interrupt or changing its configuration must be implemented in the following order basically. disable the interrupt by the cpu. configure from the farthest route from the cpu. then enable the interrupt by the cpu. to configure the clock generator, you must follow the order indicated here not to cause any unexpected interrupt. first, configure the precondition. secondly, clear the data related to the interrupt in the clock gen- erator and then enable the interrupt. the following sections are listed in the order of interrupt handling and describe how to configure them. 1. disabling interrupt by cpu 2. cpu registers setting 3. preconfiguration (1) (interrupt from external pin) 4. preconfiguration (2) (interrupt from peripheral function) 5. preconfiguration (3) (interrupt set-pending register) 6. configuring the clock generator 7. enabling interrupt by cpu (1) disabling interrupt by cpu to make the cpu for not accepting any interrupt, write "1" to the corresponding bit of the primask register. all interrupts and exceptions other than non-maskable interrupts and hard faults can be masked. use "msr" instruction to set this register. interrupt mask register primask "1" (interrupt disabled) note 1: primask register cannot be modified by the user access level. note 2: if a fault causes when "1" is set to the primask register, it is treated as a hard fault. (2) cpu registers setting you can assign a priority level by writing to field in an interrupt priority register of the nvic register. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.5 interrupts page 68
each interrupt source is provided with eight bits for assigning a priority level from 0 to 255, but the number of bits actually used varies with each product.priority level 0 is the highest priority level.if multiple sources have the same priority, the smallest-numbered interrupt source has the highest priority. you can assign grouping priority by using the prigroup field in the application interrupt and reset control register. nvic register "priority" "group priority"(this is configurable if required.) note: "n" indicates the corresponding exceptions/interrupts. this product uses three bits for assigning a priority level. (3) preconfiguration (1) (interrupt from external pin) set "1" to the port function register of the corresponding pin. setting pxfrn[m] allows the pin to be used as the function pin. setting pxie[m] allows the pin to be used as the input port. port register pxfrn "1" pxie "1" note: x: port number / m: corresponding bit / n: function register number in modes other than stop mode, setting pxie to enable input enables the corresponding interrupt input regardless of the pxfr setting. be careful not to enable interrupts that are not used. also, be aware of the description of "7.5.1.4 precautions when using external interrupt pins". (4) preconfiguration (2) (interrupt from peripheral function) the setting varies depending on the peripheral function to be used. see the chapter of each peripheral function for details. (5) preconfiguration (3) (interrupt set-pending register) to generate an interrupt by using the interrupt set-pending register, set "1" to the corresponding bit of this register. nvic register interrupt set-pending [m] "1" note: m: corresponding bit (6) configuring the clock generator for an interrupt source to be used for exiting a standby mode, you need to set the active level and enable interrupts in the cgimcg register of the clock generator. the cgimcg register is capable of configuring each source. TMPM333FDFG/fyfg/fwfg page 69
before enabling an interrupt, clear the corresponding interrupt request already held. this can avoid unexpected interrupt.to clear corresponding interrupt request, write a value corresponding to the in- terrupt to be used to the cgicrcg register.see "7.6.3.4 cgicrcg(cg interrupt request clear register)" for each value. interrupt requests from external pins can be used without setting the clock generator if they are not used for exiting a standby mode. however, an "high" pulse or "high"-level signal must be input so that the cpu can detect it as an interrupt request. also, be aware of the description of"7.5.1.4 precautions when using external interrupt pins". clock generator register cgimcgn active level cgicrcg value corresponding to the interrupt to be used cgimcgn "1" (interrupt enabled) note: n: register number / m: number assigned to interrupt source (7) enabling interrupt by cpu enable the interrupt by the cpu as shown below. clear the suspended interrupt in the interrupt clear-pending register. enable the intended interrupt with the interrupt set-enable register. each bit of the register is assigned to a single interrupt source. writing "1" to the corresponding bit of the interrupt clear-pending register clears the suspended interrupt. writing "1" to the corresponding bit of the interrupt set-enable register enables the intended interrupt. to generate interrupts in the interrupt set-pending register setting, factors to trigger interrupts are lost if pending interrupts are cleared. thus, this operation is not necessary. at the end, primask register is zero cleared. nvic register interrupt clear-pending [m] "1" interrupt set-enable [m] "1" interrupt mask register primask "0" note 1: m : corresponding bit note 2: primask register cannot be modified by the user access level. 7.5.2.3 detection by clock generator if an interrupt source is used for exiting a standby mode, an interrupt request is detected according to the active level specified in the clock generator, and is notified to the cpu. an edge-triggered interrupt request, once detected, is held in the clock generator. a level-sensitive interrupt request must be held at the active level until it is detected, otherwise the interrupt request will cease to exist when the signal level changes from active to inactive. when the clock generator detects an interrupt request, it keeps sending the interrupt signal in "high" level to the cpu until the interrupt request is cleared in the cg interrupt request clear (cgicrcg) register. if a standby mode is exited without clearing the interrupt request, the same interrupt will be detected again when normal operation is resumed. be sure to clear each interrupt request in the isr. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.5 interrupts page 70
7.5.2.4 detection by cpu the cpu detects an interrupt request with the highest priority. 7.5.2.5 cpu processing on detecting an interrupt, the cpu pushes the contents of pc, psr, r0-r3, r12 and lr to the stack then enter the isr. 7.5.2.6 interrupt service routine (isr) an isr requires specific programming according to the application to be used. this section describes what is recommended at the service routine programming and how the source is cleared. (1) pushing during isr an isr normally pushes register contents to the stack and handles an interrupt as required. the cortex- m3 core automatically pushes the contents of pc, psr, r0-r3, r12 and lr to the stack. no extra programming is required for them. push the contents of other registers if needed. interrupt requests with higher priority and exceptions such as nmi are accepted even when an isr is being executed. we recommend you to push the contents of general-purpose registers that might be rewritten. (2) clearing an interrupt source if an interrupt source is used for clearing a standby mode, each interrupt request must be cleared with the cg interrupt request clear (cgicrcg) register. if an interrupt source is set as level-sensitive, an interrupt request continues to exist until it is cleared at its source. therefore, the interrupt source must be cleared. clearing the interrupt source automatically clears the interrupt request signal from the clock generator. if an interrupt is set as edge-sensitive, clear an interrupt request by setting the corresponding value in the cgicrcg register. when an active edge occurs again, a new interrupt request will be detected. TMPM333FDFG/fyfg/fwfg page 71
7.6 exception/interrupt-related registers the cpu's nvic registers and clock generator registers described in this chapter are shown below with their respective addresses. 7.6.1 register list nvic registers base address = 0xe000_e000 register name address systick control and status register 0x0010 systick reload value register 0x0014 systick current value register 0x0018 systick calibration value register 0x001c interrupt set-enable register 1 0x0100 interrupt set-enable register 2 0x0104 interrupt clear-enable register 1 0x0180 interrupt clear-enable register 2 0x0184 interrupt set-pending register 1 0x0200 interrupt set-pending register 2 0x0204 interrupt clear-pending register 1 0x0280 interrupt clear-pending register 2 0x0284 interrupt priority register 0x0400 ~ 0x0430 vector table offset register 0x0d08 application interrupt and reset control register 0x0d0c system handler priority register 0x0d18, 0x0d1c, 0x0d20 system handler control and state register 0x0d24 clock generator registers base address = 0x4004_0200 register name address cg interrupt request clear register cgicrcg 0x0014 nmi flag register cgnmiflg 0x0018 reset flag register cgrstflg 0x001c cg interrupt mode control register a cgimcga 0x0020 cg interrupt mode control register b cgimcgb 0x0024 cg interrupt mode control register c cgimcgc 0x0028 reserved - 0x002c reserved - 0x0030 reserved - 0x0034 reserved - 0x0038 reserved - 0x003c note: access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 72
7.6.2 nvic registers 7.6.2.1 systick control and status register 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - countflag after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - clksource tickint enable after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-17 ? r read as 0. 16 countflag r/w 0: timer not counted to 0 1: timer counted to 0 returns "1" if timer counted to "0" since last time this was read. clears on read of any part of the systick control and status register. 15-3 ? r read as 0. 2 clksource r/w 0: external reference clock 1: cpu clock 1 tickint r/w 0: do not pend systick 1: pend systick 0 enable r/w 0: disable 1: enable if "1" is set, it reloads with the value of the reload value register and starts operation. TMPM333FDFG/fyfg/fwfg page 73
7.6.2.2 systick reload value register 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol reload after reset undefined 15 14 13 12 11 10 9 8 bit symbol reload after reset undefined 7 6 5 4 3 2 1 0 bit symbol reload after reset undefined bit bit symbol type function 31-24 ? r read as 0. 23-0 reload r/w reload value set the value to load into the systick current value register when the timer reaches "0". note: in this product, the system timer counts based on a clock obtained by dividing the clock input from the x1 pin by 32. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 74
7.6.2.3 systick current value register 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol current after reset undefined 15 14 13 12 11 10 9 8 bit symbol current after reset undefined 7 6 5 4 3 2 1 0 bit symbol current after reset undefined bit bit symbol type function 31-24 ? r read as 0. 23-0 current r/w [read] current systick timer value [write] clear writing to this register with any value clears it to 0. clearing this register also clears the bit of the systick control and status register. TMPM333FDFG/fyfg/fwfg page 75
7.6.2.4 systick calibration value register 31 30 29 28 27 26 25 24 bit symbol noref skew - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol tenms after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tenms after reset 0 0 0 0 1 0 0 1 7 6 5 4 3 2 1 0 bit symbol tenms after reset 1 1 0 0 0 1 0 0 bit bit symbol type function 31 noref r 0: reference clock provided 1: no reference clock 30 skew r 0: calibration value is 10 ms. 1: calibration value is not 10 ms. 29-24 ? r read as 0. 23-0 tenms r calibration value reload value to use for 10 ms timing (0x9c4). (note) note: in this product, the system timer counts based on a clock obtained by dividing the clock input from the x1 pin by 32.the systick calibration value register is set to a value that provides 10 ms timing when the cock input from x1 is 8 mhz. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 76
7.6.2.5 interrupt set-enable register 1 31 30 29 28 27 26 25 24 bit symbol setena (interrupt 31) setena (interrupt 30) setena (interrupt 29) setena (interrupt 28) setena (interrupt 27) setena (interrupt 26) setena (interrupt 25) setena (interrupt 24) after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol setena (interrupt 23 setena (interrupt 22) setena (interrupt 21) setena (interrupt 20) setena (interrupt 19) setena (interrupt 18) setena (interrupt 17) setena (interrupt 16) after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol setena (interrupt 15) - - - setena (interrupt 11) setena (interrupt 10) setena (interrupt 9) setena (interrupt 8) after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol setena (interrupt 7) setena (interrupt 6) setena (interrupt 5) setena (interrupt 4) setena (interrupt 3) setena (interrupt 2) setena (interrupt 1) setena (interrupt 0) after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-15 setena r/w interrupt number [31:15] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 14-12 - r/w write "0". 11-0 setena r/w interrupt number [11:0] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg page 77
7.6.2.6 interrupt set-enable register 2 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - setena (interrupt 49) setena (interrupt 48) after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol setena (interrupt 47) setena (interrupt 46) setena (interrupt 45) setena (interrupt 44) setena (interrupt 43) setena (interrupt 42) setena (interrupt 41) setena (interrupt 40) after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - setena (interrupt 38) setena (interrupt 37) setena (interrupt 36) setena (interrupt 35) setena (interrupt 34) setena (interrupt 33) setena (interrupt 32) after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-18 ? r read as 0. 17-8 setena r/w interrupt number [49:40] [write] 1: enable [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 7 ? r/w write "0". 6-0 setena r/w interrupt number [38:32] [write] 1: enable [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 78
7.6.2.7 interrupt clear-enable register 1 31 30 29 28 27 26 25 24 bit symbol clrena (interrupt 31) clrena (interrupt 30) clrena (interrupt 29) clrena (interrupt 28) clrena (interrupt 27) clrena (interrupt 26) clrena (interrupt 25) clrena (interrupt 24) after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol clrena (interrupt 23) clrena (interrupt 22) clrena (interrupt 21) clrena (interrupt 20) clrena (interrupt 19) clrena (interrupt 18) clrena (interrupt 17) clrena (interrupt 16) after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol clrena (interrupt 15) - - - clrena (interrupt 11) clrena (interrupt 10) clrena (interrupt 9) clrena (interrupt 8) after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol clrena (interrupt 7) clrena (interrupt 6) clrena (interrupt 5) clrena (interrupt 4) clrena (interrupt 3) clrena (interrupt 2) clrena (interrupt 1) clrena (interrupt 0) after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-15 clrena r/w interrupt number [31:15] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 14-12 - r/w write "0". 11-0 clrena r/w interrupt number [11:0] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg page 79
7.6.2.8 interrupt clear-enable register 2 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - clrena (interrupt 49) clrena (interrupt 48) after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol clrena (interrupt 47) clrena (interrupt 46) clrena (interrupt 45) clrena (interrupt 44) clrena (interrupt 43) clrena (interrupt 42) clrena (interrupt 41) clrena (interrupt 40) after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - clrena (interrupt 38) clrena (interrupt 37) clrena (interrupt 36) clrena (interrupt 35) clrena (interrupt 34) clrena (interrupt 33) clrena (interrupt 32) after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-18 ? r read as 0. 17-8 clrena r/w interrupt number [49:40] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 7 - r/w write "0". 6-0 clrena r/w interrupt number [38:32] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 80
7.6.2.9 interrupt set-pending register 1 31 30 29 28 27 26 25 24 bit symbol setpend (interrupt 31) setpend (interrupt 30) setpend (interrupt 29) setpend (interrupt 28) setpend (interrupt 27) setpend (interrupt 26) setpend (interrupt 25) setpend (interrupt 24) after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol setpend (interrupt 23) setpend (interrupt 22) setpend (interrupt 21) setpend (interrupt 20) setpend (interrupt 19) setpend (interrupt 18) setpend (interrupt 17) setpend (interrupt 16) after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol setpend (interrupt 15) - - - setpend (interrupt 11) setpend (interrupt 10) setpend (interrupt 9) setpend (interrupt 8) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol setpend (interrupt 7) setpend (interrupt 6) setpend (interrupt 5) setpend (interrupt 4) setpend (interrupt 3) setpend (interrupt 2) setpend (interrupt 1) setpend (interrupt 0) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-15 setpend r/w interrupt number [31:15] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt clear-pending register clears the bit in this register. 14-12 - r/w write "0". 11-0 setpend r/w interrupt number [11:0] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt clear-pending register clears the bit in this register. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg page 81
7.6.2.10 interrupt set-pending register 2 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - setpend (interrupt 49) setpend (interrupt 48) after reset 0 0 0 0 0 0 undefined undefined 15 14 13 12 11 10 9 8 bit symbol setpend (interrupt 47) setpend (interrupt 46) setpend (interrupt 45) setpend (interrupt 44) setpend (interrupt 43) setpend (interrupt 42) setpend (interrupt 41) setpend (interrupt 40) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol - setpend (interrupt 38) setpend (interrupt 37) setpend (interrupt 36) setpend (interrupt 35) setpend (interrupt 34) setpend (interrupt 33) setpend (interrupt 32) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-18 ? r read as 0. 17-8 setpend r/w interrupt number [49:40] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. clear and interrupt set-pending register bit by writing "1" to the corresponding bit in the interrupt clear-pending register. 7 - r/w write "0". 6-0 setpend r/w interrupt number [38:32] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. clear and interrupt set-pending register bit by writing "1" to the corresponding bit in the interrupt clear-pending register. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 82
7.6.2.11 interrupt clear-pending register 1 31 30 29 28 27 26 25 24 bit symbol clrpend (interrupt 31) clrpend (interrupt 30) clrpend (interrupt 29) clrpend (interrupt 28) clrpend (interrupt 27) clrpend (interrupt 26) clrpend (interrupt 25) clrpend (interrupt 24) after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol clrpend (interrupt 23) clrpend (interrupt 22) clrpend (interrupt 21) clrpend (interrupt 20) clrpend (interrupt 19) clrpend (interrupt 18) clrpend (interrupt 17) clrpend (interrupt 16) after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol clrpend (interrupt 15) - - - clrpend (interrupt 11) clrpend (interrupt 10) clrpend (interrupt 9) clrpend (interrupt 8) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol clrpend (interrupt 7) clrpend (interrupt 6) clrpend (interrupt 5) clrpend (interrupt 4) clrpend (interrupt 3) clrpend (interrupt 2) clrpend (interrupt 1) clrpend (interrupt 0) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-15 clrpend r/w interrupt number [31:15] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the corresponding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 14-12 - r/w write "0". 11-0 clrpend r/w interrupt number [11:0] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the corresponding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg page 83
7.6.2.12 interrupt clear-pending register 2 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - clrpend (interrupt 49) clrpend (interrupt 48) after reset 0 0 0 0 0 0 undefined undefined 15 14 13 12 11 10 9 8 bit symbol clrpend (interrupt 47) clrpend (interrupt 46) clrpend (interrupt 45) clrpend (interrupt 44) clrpend (interrupt 43) clrpend (interrupt 42) clrpend (interrupt 41) clrpend (interrupt 40) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol - clrpend (interrupt 38) clrpend (interrupt 37) clrpend (interrupt 36) clrpend (interrupt 35) clrpend (interrupt 34) clrpend (interrupt 33) clrpend (interrupt 32) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-18 ? r read as 0. 17-8 clrpend r/w interrupt number [49:40] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the corresponding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 7 - r/w write "0". 6-0 clrpend r/w interrupt number [38:32] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can force interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the corresponding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. note: for descriptions of interrupts and interrupt numbers, see section "7.5.1.5 list of interrupt sources". TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 84
7.6.2.13 interrupt priority register each interrupt is provided with eight bits of an interrupt priority register. the following shows the addresses of the interrupt priority registers corresponding to interrupt numbers. 31 24 23 16 15 8 7 0 0xe000_e400 pri_3 pri_2 pri_1 pri_0 0xe000_e404 pri_7 pri_6 pri_5 pri_4 0xe000_e408 pri_11 pri_10 pri_9 pri_8 0xe000_e40c pri_15 ? ? ? 0xe000_e410 pri_19 pri_18 pri_17 pri_16 0xe000_e414 pri_23 pri_22 pri_21 pri_20 0xe000_e418 pri_27 pri_26 pri_25 pri_24 0xe000_e41c pri_31 pri_30 pri_29 pri_28 0xe000_e420 pri_35 pri_34 pri_33 pri_32 0xe000_e424 ? pri_38 pri_37 pri_36 0xe000_e428 pri_43 pri_42 pri_41 pri_40 0xe000_e42c pri_47 pri_46 pri_45 pri_44 0xe000_e430 ? ? pri_49 pri_48 the number of bits to be used for assigning a priority varies with each product. this product uses three bits for assigning a priority. the following shows the fields of the interrupt priority registers for interrupt numbers 0 to 3. the interrupt priority registers for all other interrupt numbers have the identical fields. unused bits return "0" when read, and writing to unused bits has no effect. 31 30 29 28 27 26 25 24 bit symbol pri_3 - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol pri_2 - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol pri_1 - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pri_0 - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-29 pri_3 r/w priority of interrupt number 3 28-24 ? r read as 0. 23-21 pri_2 r/w priority of interrupt number 2 20-16 ? r read as 0. 15-13 pri_1 r/w priority of interrupt number 1 12-8 ? r read as 0. 7-5 pri_0 r/w priority of interrupt number 0 4-0 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 85
7.6.2.14 vector table offset register 31 30 29 28 27 26 25 24 bit symbol - - tblbase tbloff after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol tbloff after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbloff after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbloff - - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-30 ? r read as 0. 29 tblbase r/w table base the vector table is in: 0: code space 1: sram space 28-7 tbloff r/w offset value set the offset value from the top of the space specified in tblbase. the offset must be aligned based on the number of exceptions in the table.this means that the minimum alignment is 32 words that you can use for up to 16 interrupts.for more interrupts, you must adjust the alignment by rounding up to the next power of two. 6-0 ? r read as 0. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 86
7.6.2.15 application interrupt and reset control register 31 30 29 28 27 26 25 24 bit symbol vectkey/vectkeystat after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol vectkey/vectkeystat after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol endianess - - - - prigroup after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - sysreset req vectclr active vectreset after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 vectkey (write)/ vectkey- stat(read) r/w register key [write] writing to this register requires 0x5fa in the field. [read] read as 0xfa05. 15 endianess r/w endianness bit:(note1) 1: big endian 0: little endian 14-11 ? r read as 0. 10-8 prigroup r/w interrupt priority grouping 000: seven bits of pre-emption priority, one bit of subpriority 001: six bits of pre-emption priority, two bits of subpriority 010: five bits of pre-emption priority, three bits of subpriority 011: four bits of pre-emption priority, four bits of subpriority 100: three bits of pre-emption priority, five bits of subpriority 101: two bits of pre-emption priority, six bits of subpriority 110: one bit of pre-emption priority, seven bits of subpriority 111: no pre-emption priority, eight bits of subpriority the bit configuration to split the interrupt priority register into pre-emption priority and sub priority. 7-3 ? r read as 0. 2 sysreset req r/w system reset request. 1=cpu outputs a sysresetreq signal. (note2) 1 vectclr active r/w clear active vector bit 1: clear all state information for active nmi, fault, and interrupts 0: do not clear. this bit self-clears. it is the responsibility of the application to reinitialize the stack. 0 vectreset r/w system reset bit 1: reset system 0: do not reset system resets the system, with the exception of debug components (fpb, dwt and itm) by setting "1" and this bit is also zero cleared. note 1: little-endian is the default memory format for this product. note 2: when sysresetreq is output, warm reset is performed on this product. is cleared by warm reset. TMPM333FDFG/fyfg/fwfg page 87
7.6.2.16 system handler priority register each exception is provided with eight bits of a system handler priority register. the following shows the addresses of the system handler priority registers corresponding to each ex- ception. 31 24 23 16 15 8 7 0 0xe000_ed18 pri_7 pri_6 (usage fault) pri_5 (bus fault) pri_4 (memory management) 0xe000_ed1c pri_11 (svcall) pri_10 pri_9 pri_8 0xe000_ed20 pri_15 (systick) pri_14 (pendsv) pri_13 pri_12 (debug monitor) the number of bits to be used for assigning a priority varies with each product. this product uses three bits for assigning a priority. the following shows the fields of the system handler priority registers for memory management, bus fault and usage fault. unused bits return "0" when read, and writing to unused bits has no effect. 31 30 29 28 27 26 25 24 bit symbol pri_7 - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol pri_6 - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol pri_5 - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pri_4 - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-29 pri_7 r/w reserved 28-24 ? r read as 0. 23-21 pri_6 r/w priority of usage fault 20-16 ? r read as 0. 15-13 pri_5 r/w priority of bus fault 12-8 ? r read as 0. 7-5 pri_4 r/w priority of memory management 4-0 ? r read as 0. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 88
7.6.2.17 system handler control and state register 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - usgfault ena busfault ena memfault ena after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol svcall pended busfault pended memfault pended usgfault pended systickact pendsvact - monitor act after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol svcallact - - - usgfault act - busfault act memfault act after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-19 ? r read as 0. 18 usgfault ena r/w usage fault 0: disabled 1: enable 17 busfaul tena r/w bus fault 0: disabled 1: enable 16 memfault ena r/w memory management 0: disabled 1: enable 15 svcall pended r/w svcall 0: not pended 1: pended 14 busfault pended r/w bus fault 0: not pended 1: pended 13 memfault pended r/w memory management 0: not pended 1: pended 12 usgfault pended r/w usage fault 0: not pended 1: pended 11 systickact r/w systick 0: inactive 1: active 10 pendsvact r/w pendsv 0: inactive 1: active 9 ? r read as 0. 8 monitoract r/w debug monitor 0: inactive 1: active 7 svcallact r/w svcall 0: inactive 1: active 6-4 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 89
bit bit symbol type function 3 usgfault act r/w usage fault 0: inactive 1: active 2 ? r read as 0. 1 busfault act r/w bus fault 0: inactive 1: active 0 memfault act r/w memory management 0: inactive 1: active note: you must clear or set the active bits with extreme caution because clearing and setting these bits does not repair stack contents. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 90
7.6.3 clock generator registers 7.6.3.1 cgimcga(cg interrupt mode control register a) 31 30 29 28 27 26 25 24 bit symbol - emcg3 emst3 - int3en after reset 0 0 1 0 0 0 undefined 0 23 22 21 20 19 18 17 16 bit symbol - emcg2 emst2 - int2en after reset 0 0 1 0 0 0 undefined 0 15 14 13 12 11 10 9 8 bit symbol - emcg1 emst1 - int1en after reset 0 0 1 0 0 0 undefined 0 7 6 5 4 3 2 1 0 bit symbol - emcg0 emst0 - int0en after reset 0 0 1 0 0 0 undefined 0 bit bit symbol type function 31 ? r read as 0. 30-28 emcg3[2:0] r/w active level setting of int3 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 27-26 emst3[1:0] r active level of int3 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 25 ? r reads as undefined. 24 int3en r/w int3 clear input 0:disable 1: enable 23 ? r read as 0. 22-20 emcg2[2:0] r/w active level setting of int2 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 19-18 emst2[1:0] r active level of int2 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 17 ? r reads as undefined. 16 int2en r/w int2 clear input 0:disable 1: enable 15 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 91
bit bit symbol type function 14-12 emcg1[2:0] r/w active level setting of int1 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 11-10 emst1[1:0] r active level of int1 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 9 ? r reads as undefined. 8 int1en r/w int1 clear input 0:disable 1: enable 7 ? r read as 0. 6-4 emcg0[2:0] r/w active level setting of int0 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 3-2 emst0[1:0] r active level of int0 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 1 ? r reads as undefined. 0 int0en r/w int0 clear input 0:disable 1: enable note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is prohibited. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 92
7.6.3.2 cgimcgb(cg interrupt mode control register b) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 1 0 0 0 undefined 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 1 0 0 0 undefined 0 15 14 13 12 11 10 9 8 bit symbol - emcg5 emst5 - int5en after reset 0 0 1 0 0 0 undefined 0 7 6 5 4 3 2 1 0 bit symbol - emcg4 emst4 - int4en after reset 0 0 1 0 0 0 undefined 0 bit bit symbol type function 31 ? r read as 0. 30-28 ? r/w write any value. 27-26 ? r read as 0. 25 ? r reads as undefined. 24 ? r/w write "0". 23 ? r read as 0. 22-20 ? r/w write any value. 19-18 ? r read as 0. 17 ? r reads as undefined. 16 ? r/w write "0". 15 ? r read as 0. 14-12 emcg5[2:0] r/w active level setting of int5 standby clear request (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 11-10 emst5[1:0] r active level of int5 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 9 ? r reads as undefined. 8 int5en r/w int5 clear input 0:disable 1: enable 7 ? r read as 0. 6-4 emcg4[2:0] r/w active level setting of int4 standby clear request (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 3-2 emst4[1:0] r active level of int4 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edges 1 ? r reads as undefined. TMPM333FDFG/fyfg/fwfg page 93
bit bit symbol type function 0 int4en r/w int4 clear input 0:disable 1: enable note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is prohibited. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 94
7.6.3.3 cgimcgc(cg interrupt mode control register c) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 1 0 0 0 undefined 0 23 22 21 20 19 18 17 16 bit symbol - emcga emsta - intaen after reset 0 0 1 0 0 0 undefined 0 15 14 13 12 11 10 9 8 bit symbol - emcg9 emst9 - int9en after reset 0 0 1 0 0 0 undefined 0 7 6 5 4 3 2 1 0 bit symbol - emcg8 emst8 - int8en after reset 0 0 1 0 0 0 undefined 0 bit bit symbol type function 31 ? r read as 0. 30-28 ? r/w write any value. 27-26 ? r read as 0. 25 ? r reads as undefined. 24 ? r/w write "0". 23 ? r read as 0. 22-20 emcga[2:0] r/w active level setting of int7 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 19-18 emsta[1:0] r active level of int7 standby clear request. 00: ? 01: rising edge 10: falling edge 11: both edges 17 ? r reads as undefined. 16 intaen r/w int7clear input 0:disable 1: enable 15 ? r read as 0. 14-12 emcg9[2:0] r/w active level setting of int6 standby clear request. (101~111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edges 11-10 emst9[1:0] r active level of int6 standby clear request. 00: ? 01: rising edge 10: falling edge 11: both edges 9 ? r reads as undefined. 8 int9en r/w int6 clear input 0:disable 1: enable 7 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 95
bit bit symbol type function 6-4 emcg8[2:0] r/w active level setting of intrtc standby clear request. set it as shown below. 010: falling edge 3-2 emst8[1:0] r active level of intrtc standby clear request. 00: ? 01: rising edge 10: falling edge 11: both edges 1 ? r reads as undefined. 0 int8en r/w intrtc clear input 0:disable 1: enable note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is prohibited. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 96
7.6.3.4 cgicrcg(cg interrupt request clear register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - icrcg after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-5 ? r read as 0. 4-0 icrcg[4:0] w clear interrupt requests. 0_0000: int0 0_0001: int1 0_0010: int2 0_0011: int3 0_0100: int4 0_0101: int5 0_0110: reserved 0_0111: reserved 0_1000: intrtc 0_1001: int6 0_1010: int7 0_1011 to 1_1111: setting prohibited. read as 0. TMPM333FDFG/fyfg/fwfg page 97
7.6.3.5 cgnmiflg(nmi flag register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - nmiflg1 nmiflg0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-2 ? r read as 0. 1 nmiflg1 r nmi source generation flag 0: not applicable 1: generated from nmi pin 0 nmiflg0 r nmi source generation flag 0: not applicable 1: generated from wdt note: are cleared to "0" when they are read. TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 98
7.6.3.6 cgrstflg (reset flag register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after pin reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after pin reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after pin reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - sysrstf - wdtrstf pinrstf ponrstf after pin reset 0 0 0 0 0 0 1 1 / 0 bit bit symbol type function 31-5 ? r read as 0. 4 sysrstf r/w debug reset flag(note1) 0: "0" is written 1: reset from sysresetreq 3 ? r/w write as 0. 2 wdtrstf r/w wdt reset flag 0: "0" is written 1: reset from wdt 1 pinrstf r/w reset pin flag 0: "0" is written 1: reset from reset pin 0 ponrstf r/w power-on flag 0: "0" is written 1: "1" is set to this bit in initial reset state right after power-on. note 1: this flag indicates a reset generated by the sysresetreq bit of the application interrupt and reset control register of the cpu's nvic. note 2: this register is not cleared automatically. write "0" to clear the register. TMPM333FDFG/fyfg/fwfg page 99
TMPM333FDFG/fyfg/fwfg 7. exceptions 7.6 exception/interrupt-related registers page 100
8. input/output ports 8.1 port functions 8.1.1 function lists TMPM333FDFG/fyfg/fwfg has 78 ports. besides the ports function, these ports can be used as i/o pins for peripheral functions. table 8-1, table 8-2 and table 8-3 show the port function table. table 8-1 port function list (port a-port c) port pin input/ output pull-up pull-down schmitt input noise filter program- mable open-drain function pin port a pa0 i/o pull-up ? ? tms/ swdio pa1 i/o pull-down ? ? ? tck/ swclk pa2 i/o pull-up ? ? ? traceclk pa3 i/o pull-up ? ? ? tracedata0 pa4 i/o pull-up ? ? ? tracedata1 pa5 i/o pull-up ? ? ? tracedata2 pa6 i/o pull-up ? ? ? tracedata3 pa7 i/o pull-up ? ? ? ? port b pb0 i/o pull-up ? ? ? tdo/ swv pb1 i/o pull-up ? ? ? tdi pb2 i/o pull-up ? ? trst pb3 i/o pull-up ? ? ? ? pb4 i/o pull-up ? ? ? ? pb5 i/o pull-up ? ? ? ? pb6 i/o pull-up ? ? ? ? pb7 i/o pull-up ? ? ? ? port c pc0 input pull-up ? ? ? ain0 pc1 input pull-up ? ? ? ain1 pc2 input pull-up ? ? ? ain2 pc3 input pull-up ? ? ? ain3 : exist - : not exist note:the noise elimination width of the noise filter is approximately 30 ns under typical conditions. TMPM333FDFG/fyfg/fwfg page 101
table 8-2 port function list (port d-port g) port pin input/out- put pull-up pull-down schmitt input noise filter program- mable open-drain function pin port d pd0 input pull-up ? ? ? ain4, tb5in0 pd1 input pull-up ? ? ? ain5, tb5in1 pd2 input pull-up ? ? ? ain6, tb6in0 pd3 input pull-up ? ? ? ain7, tb6in1 pd4 input pull-up ? ? ? ain8 pd5 input pull-up ? ? ? ain9 pd6 input pull-up ? ? ? ain10 pd7 input pull-up ? ? ? ain11 port e pe0 i/o pull-up ? ? txd0 pe1 i/o pull-up ? rxd0 pe2 i/o pull-up ? sclk0, cts0 pe3 i/o pull-up ? ? pe4 i/o pull-up ? ? txd1 pe5 i/o pull-up ? rxd1 pe6 i/o pull-up ? sclk1, cts1 port f pf0 i/o pull-up ? ? txd2 pf1 i/o pull-up ? rxd2 pf2 i/o pull-up ? sclk2, cts2 pf3 i/o pull-up ? ? pf4 i/o pull-up ? sda1/ so1 pf5 i/o pull-up ? scl1/ si1 pf6 i/o pull-up ? sck1 pf7 i/o pull-up int5 port g pg0 i/o pull-up ? sda0/ so0 pg1 i/o pull-up ? scl0/ si0 pg2 i/o pull-up ? sck0 pg3 i/o pull-up int4 pg4 i/o pull-up ? sda2/ so2 pg5 i/o pull-up ? scl2/ si2 pg6 i/o pull-up ? sck2 pg7 i/o pull-up ? ? tb8out : exist - : not exist note:the noise elimination width of the noise filter is approximately 30 ns under typical conditions. TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.1 port functions page 102
table 8-3 port function list (port h-port k) port pin input/out- put pull-up pull-down schmitt input noise filter program- mable open-drain function pin port h ph0 i/o pull-up ? ? tb0in0, boot ph1 i/o pull-up ? ? tb0in1 ph2 i/o pull-up ? ? tb1in0 ph3 i/o pull-up ? ? tb1in1 ph4 i/o pull-up ? ? tb2in0 ph5 i/o pull-up ? ? tb2in1 ph6 i/o pull-up ? ? tb3in0 ph7 i/o pull-up ? ? tb3in1 port i pi0 i/o pull-up ? ? ? tb0out pi1 i/o pull-up ? ? ? tb1out pi2 i/o pull-up ? ? ? tb2out pi3 i/o pull-up ? ? ? tb3out pi4 i/o pull-up ? ? ? tb4out pi5 i/o pull-up ? ? ? tb5out pi6 i/o pull-up ? ? tb4in0 pi7 i/o pull-up ? ? tb4in1 port j pj0 i/o pull-up ? int0 pj1 i/o pull-up ? int1 pj2 i/o pull-up ? int2 pj3 i/o pull-up ? int3 pj4 i/o pull-up ? ? ? tb6out pj5 i/o pull-up ? ? ? tb7out pj6 i/o pull-up ? int6 pj7 i/o pull-up ? int7 port k pk0 i/o ? ? (note1) ? pk1 i/o pull-up ? ? ? scout, alarm pk2 i/o pull-up ? ? ? tb9out : exist - : not exist note 1: n-ch open drain port. note 2: the noise elimination width of the noise filter is approximately 30 ns under typical conditions. TMPM333FDFG/fyfg/fwfg page 103
8.1.2 port registers outline the following registers need to be configured to use ports. ? ? ? ? ? ? ? 8. input/output ports 8.1 port functions page 104
8.1.3 port states in stop mode input and output in stop mode are enabled/disabled by the cgstbycr bit. if pxie or pxcr is enabled with =1, input or output is enabled respectively in stop mode.if =0, both input and output are disabled in stop mode except for some ports even if pxie or pxcr are enabled. table 8-4 shows the pin conditions in stop mode. table 8-4 port conditions in stop mode pin name i/o = 0 = 1 exclud- ing port x1, xt1 input only x2, xt2 output only "high" level output "high" level output reset, nmi, mode input only port pa0, pb0 [when used for debug (pxfrn=1) and output is enabled (pxcr=1)] (note) input depends on pxie[m] output enabled when data is valid. disabled when data is invalid. pf7, pg3, pj0 to pj3, pj6, pj7 [when used for interrupt (pxfrn=1) and input is enabled (pxie=1)] (note) input output depends on pxcr[m]. other ports input depends on pxie[m]. output depends on pxcr[m]. :input or output enabled :input or output disabled note:"x" indicates a port number, "m" a corresponding bit and "n" a function register number. 8.1.4 precautions for mode transition between stop and sleep if pa1 is configured as a debug function pin of tck/swclk, it prevents the low power consumption mode from being fully effective. configure pa1 to function as a general-purpose port if the debug function is not used. TMPM333FDFG/fyfg/fwfg page 105
8.2 port functions this chapter describes the port registers detail. this chapter describes only "circuit type" reading circuit configuration.for detailed circuit diagram, refer to "8.3 block diagrams of ports". 8.2.1 port a (pa0 to pa7) the port a is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input/output function, the port a performs the debug interface and the debug trace output. pa0 and pa1 are assigned as the debug interface after reset. pa0 is initialized as the tms/swdio pin with input, output and pull-up enabled. pa1 is initialized as the tck/swclk pin with input and pull-down enabled. pins from pa2 to pa7 operate as general-purpose-ports, and input, output and pull-up are disabled. note 1: if pa0 is configured as the tms/swdio pin, output is enabled even in stop mode regardless of the cgstbycr bit setting note 2: if pa1 is configured as the tck/swclk pin, it prevents the low power consumption mode from being fully effective. configure pa1 to function as a general-purpose port if the tck/swclk is not used. 8.2.1.1 port a circuit type 7 6 5 4 3 2 1 0 type t1 t9 t9 t9 t9 t9 t6 t12 8.2.1.2 port a register base address = 0x4000_0000 register name address (base+) port a data register padata 0x0000 port a output control register pacr 0x0004 port a function register 1 pafr1 0x0008 port a pull-up control register papup 0x002c port a pull-down control register papdn 0x0030 port a input control register paie 0x0038 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 106
8.2.1.3 padata (port a data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7-pa0 r/w port a data register. 8.2.1.4 pacr (port a output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pa7c pa6c pa5c pa4c pa3c pa2c pa1c pa0c after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7c-pa0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 107
8.2.1.5 pafr1 (port a function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pa6f1 pa5f1 pa4f1 pa3f1 pa2f1 pa1f1 pa0f1 after reset 0 0 0 0 0 0 1 1 bit bit symbol type function 31-7 ? r read as 0. 6 pa6f1 r/w 0: port 1: tracedata3 5 pa5f1 r/w 0: port 1: tracedata2 4 pa4f1 r/w 0: port 1: tracedata1 3 pa3f1 r/w 0: port 1: tracedata0 2 pa2f1 r/w 0: port 1: traceclk 1 pa1f1 r/w 0: port 1: tck/swclk 0 pa0f1 r/w 0: port 1: tms/swdio TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 108
8.2.1.6 papup (port a pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pa7up pa6up pa5up pa4up pa3up pa2up - pa0up after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-8 ? r read as 0. 7-2 pa7up-pa2up r/w pull-up 0: disable 1: enable 1 ? r read as 0. 0 pa0up r/w pull-up 0:disable 1:enable 8.2.1.7 papdn (port a pull-down control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - pa1dn - after reset 0 0 0 0 0 0 1 0 bit bit symbol type function 31-2 ? r read as 0. 1 pa1dn r/w pull-down 0: disable 1: enable 0 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 109
8.2.1.8 paie (port a input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pa7ie pa6ie pa5ie pa4ie pa3ie pa2ie pa1ie pa0ie after reset 0 0 0 0 0 0 1 1 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7ie-pa0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 110
8.2.2 port b (pb0 to pb7) the port b is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input/output function, the port b performs the debug interface. reset configures pb0, pb1 and pb2 as debug interface.pb0 is initialized as the tdo/swv pin with output enabled. pb1 is initialized as the tdi pin with input and pull-up enabled. pb2 is initialized as the trst pin with input and pull-up enabled.pb3 to pb7 are initialized as general-purpose ports with input, output and pull-up disabled. note:if pb0 is configured as the tdo/swv pin, output is enabled even in stop mode regardless of the cgstbycr bit setting. 8.2.2.1 port b circuit type 7 6 5 4 3 2 1 0 type t1 t1 t1 t1 t1 t2 t2 t11 8.2.2.2 port b register base address = 0x4000_0040 register name address (base+) port b data register pbdata 0x0000 port b output control register pbcr 0x0004 port b function register 1 pbfr1 0x0008 port b pull-up control register pbpup 0x002c port b input control register pbie 0x0038 TMPM333FDFG/fyfg/fwfg page 111
8.2.2.3 pbdata (port b data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7-pb0 r/w port b data register. 8.2.2.4 pbcr (port b output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pb7c pb6c pb5c pb4c pb3c pb2c pb1c pb0c after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7c-pb0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 112
8.2.2.5 pbfr1 (port b function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pb2f1 pb1f1 pb0f1 after reset 0 0 0 0 0 1 1 1 bit bit symbol type function 31-3 ? r read as 0. 2 pb2f1 r/w 0: port 1: trst 1 pb1f1 r/w 0: port 1: tdi 0 pb0f1 r/w 0: port 1: tdo/swv TMPM333FDFG/fyfg/fwfg page 113
8.2.2.6 pbpup (port b pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pb7up pb6up pb5up pb4up pb3up pb2up pb1up pb0up after reset 0 0 0 0 0 1 1 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7up-pb0up r/w pull-up 0: disable 1: enable 8.2.2.7 pbie (port b input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pb7ie pb6ie pb5ie pb4ie pb3ie pb2ie pb1ie pb0ie after reset 0 0 0 0 0 1 1 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7ie-pb0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 114
8.2.3 port c (pc0 to pc3) the port c is a 4-bit input port. besides the general-purpose input function, the port c functions as analog input pins of the ad converter. reset initializes all bits of the port c as general-purpose input ports with input and pull-up disabled. to use the port c as an analog input of the ad converter, disable input on pcie and disable pull-up on pcpup. note:unless you use all the bits of port c and port d as analog input pins, conversion accuracy may be reduced. be sure to verify that this causes no problem on your system. 8.2.3.1 port c circuit type 7 6 5 4 3 2 1 0 type ? ? ? ? t17 t17 t17 t17 8.2.3.2 port c register base address = 0x4000_0080 register name address (base+) port c data register pcdata 0x0000 port c pull-up control register pcpup 0x002c port c input control register pcie 0x0038 TMPM333FDFG/fyfg/fwfg page 115
8.2.3.3 pcdata (port c data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - pc3 pc2 pc1 pc0 after reset 0 0 0 0 1 1 1 1 bit bit symbol type function 31-4 ? r read as 0. 3-0 pc3-pc0 r port c data register. 8.2.3.4 pcpup (port c pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - pc3up pc2up pc1up pc0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-4 ? r read as 0. 3-0 pc3up-pc0up r/w pull-up 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 116
8.2.3.5 pcie (port c input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - pc3ie pc2ie pc1ie pc0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-4 ? r read as 0. 3-0 pc3ie-pc0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 117
8.2.4 port d (pd0 to pd7) the port d is an 8-bit input port. besides the general-purpose input function, the port d receives an analog input of the ad converter and a 16-bit timer input. reset initializes all bits of the port d as general-purpose input ports with input and pull-up disabled. set the pdfr1 and pdie when you use the port d as input pins of the 16-bit timer. to use the port d as an analog input of the ad converter, disable input on pdie and disable pull-up on pdpup. note:unless you use all the bits of port c and port d as analog input pins, conversion accuracy may be reduced. be sure to verify that this causes no problem on your system. 8.2.4.1 port d circuit type 7 6 5 4 3 2 1 0 type t17 t17 t17 t17 t18 t18 t18 t18 8.2.4.2 port d register base address = 0x4000_00c0 register name address (base+) port d data register pddata 0x0000 port d function register 1 pdfr1 0x0008 port d pull-up control register pdpup 0x002c port d input control register pdie 0x0038 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 118
8.2.4.3 pddata (port d data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 after reset 1 1 1 1 1 1 1 1 bit bit symbol type function 31-8 ? r read as 0. 7-0 pd7-pd0 r port d data register. 8.2.4.4 pdfr1 (port d function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - pd3f1 pd2f1 pd1f1 pd0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-4 ? r read as 0. 3 pd3f1 r/w 0: port 1: tb6in1 2 pd2f1 r/w 0: port 1: tb6in0 1 pd1f1 r/w 0: port 1: tb5in1 0 pd0f1 r/w 0: port 1: tb5in0 TMPM333FDFG/fyfg/fwfg page 119
8.2.4.5 pdpup (port d pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pd7up pd6up pd5up pd4up pd3up pd2up pd1up pd0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pd7up-pd0up r/w pull-up 0: disable 1: enable 8.2.4.6 pdie (port d input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pd7ie pd6ie pd5ie pd4ie pd3ie pd2ie pd1ie pd0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pd7ie-pd0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 120
8.2.5 port e (pe0 to pe6) the port e is a general-purpose, 7-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port e performs the serial interface function. reset initializes all bits of the port e as general-purpose ports with input, output and pull-up disabled. the port e has two types of function register. if you use the port e as a general-purpose port, set "0" to the corresponding bit of the two registers. if you use the port e as other than a general-purpose port, set "1" to the corresponding bit of the function register. do not set "1" to the both function registers at the same time. 8.2.5.1 port e circuit type 7 6 5 4 3 2 1 0 type ? t16 t4 t10 t4 t16 t4 t10 8.2.5.2 port e register base address = 0x4000_0100 register name address (base+) port e data register pedata 0x0000 port e output control register pecr 0x0004 port e function register 1 pefr1 0x0008 port e function register 2 pefr2 0x000c port e open drain control register peod 0x0028 port e pull-up control register pepup 0x002c port e input control register peie 0x0038 TMPM333FDFG/fyfg/fwfg page 121
8.2.5.3 pedata (port e data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6 pe5 pe4 pe3 pe2 pe1 pe0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6-0 pe6-pe0 r/w port e data register 8.2.5.4 pecr (port e output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6c pe5c pe4c pe3c pe2c pe1c pe0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6-0 pe6c-pe0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 122
8.2.5.5 pefr1(port e function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6f1 pe5f1 pe4f1 pe3f1 pe2f1 pe1f1 pe0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6 pe6f1 r/w 0: port 1: sclk1 5 pe5f1 r/w 0: port 1: rxd1 4 pe4f1 r/w 0: port 1: txd1 3 pe3f1 r/w 0: port 1: reserved 2 pe2f1 r/w 0: port 1: sclk0 1 pe1f1 r/w 0: port 1: rxd0 0 pe0f1 r/w 0: port 1: txd0 TMPM333FDFG/fyfg/fwfg page 123
8.2.5.6 pefr2(port e function register 2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6f2 - - - pe2f2 - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6 pe6f2 r/w 0: port 1: cts1 5-3 ? r read as 0. 2 pe2f2 r/w 0: port 1: cts0 1-0 ? r read as 0. 8.2.5.7 peod (port e open drain control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6od pe5od pe4od pe3od pe2od pe1od pe0od after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6-0 pe6od- pe0od r/w 0: cmos 1: open-drain TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 124
8.2.5.8 pepup (port e pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6up pe5up pe4up pe3up pe2up pe1up pe0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6-0 pe6up-pe0up r/w pull-up 0: disable 1: enable 8.2.5.9 peie (port e input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - pe6ie pe5ie pe4ie pe3ie pe2ie pe1ie pe0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6-0 pe6ie-pe0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 125
8.2.6 port f (pf0 to pf7) the port f is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port f performs the functions of the serial interface, the serial bus interface and the external interrupt input. reset initializes all bits of the port f as general-purpose ports with input, output and pull-up disabled. the port f has two types of function register. if you use the port f as a general-purpose port, set "0" to the corresponding bit of the two registers. if you use the port f as other than a general-purpose port, set "1" to the corresponding bit of the function register. do not set "1" to the both function registers at the same time. to use the external interrupt input for releasing stop mode, select this function in the pffr1 and enable input in the pfie register. these settings enable the interrupt input even if the cgstbycr bit in the clock/mode control block is set to stop driving of pins during stop mode. note:in modes other than stop mode, interrupt input is enabled regardless of the pffr register setting if input is enabled in pxie. make sure to disable unused interrupts when programming the device. 8.2.6.1 port f circuit type 7 6 5 4 3 2 1 0 type t8 t13 t13 t13 t4 t16 t4 t10 8.2.6.2 port f register base address = 0x4000_0140 register name address (base+) port f data register pfdata 0x0000 port f output control register pfcr 0x0004 port f function register 1 pffr1 0x0008 port f function register 2 pffr2 0x000c port f open drain control register pfod 0x0028 port f pull-up control register pfpup 0x002c port f input control register pfie 0x0038 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 126
8.2.6.3 pfdata (port f data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pf7-pf0 r/w port f data register 8.2.6.4 pfcr (port f output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7c pf6c pf5c pf4c pf3c pf2c pf1c pf0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pf7c-pf0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 127
8.2.6.5 pffr1(port f function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7f1 pf6f1 pf5f1 pf4f1 pf3f1 pf2f1 pf1f1 pf0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 pf7f1 r/w 0: port 1: int5 6 pf6f1 r/w 0: port 1: sck1 5 pf5f1 r/w 0: port 1: si1/scl1 4 pf4f1 r/w 0: port 1: so1/sda1 3 pf3f1 r/w 0: port 1: reserved 2 pf2f1 r/w 0: port 1: sclk2 1 pf1f1 r/w 0: port 1: rxd2 0 pf0f1 r/w 0: port 1: txd2 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 128
8.2.6.6 pffr2(port f function register 2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pf2f2 - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2 pf2f2 r/w 0: port 1: cts2 1-0 ? r read as 0. 8.2.6.7 pfod (port f open drain control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7od pf6od pf5od pf4od pf3od pf2od pf1od pf0od after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pf7od-pf0od r/w 0: cmos 1: open-drain TMPM333FDFG/fyfg/fwfg page 129
8.2.6.8 pfpup (port f pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7up pf6up pf5up pf4up pf3up pf2up pf1up pf0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pf7up-pf0up r/w pull-up 0: disable 1: enable 8.2.6.9 pfie (port f input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pf7ie pf6ie pf5ie pf4ie pf3ie pf2ie pf1ie pf0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pf7ie-pf0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 130
8.2.7 port g (pg0 to pg7) the port g is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port g performs the functions of the serial bus interface, the external interrupt input, and the 16-bit timer output. reset initializes all bits of the port g as general-purpose ports with input, output and pull-up disabled. to use the external interrupt input for releasing stop mode, select function in the pgfr register and enable input in the pgie register. these settings enable the interrupt input even if the cgstbycr bit in the clock/mode control block is set to stop driving of pins during stop mode. note:in modes other than stop mode, interrupt input is enabled regardless of the pgfr register setting if input is enabled in pgie. make sure to disable unused interrupts when programming the device. 8.2.7.1 port g circuit type 7 6 5 4 3 2 1 0 type t10 t13 t13 t13 t8 t13 t13 t13 8.2.7.2 port g register base address = 0x4000_0180 register name address (base+) port g data register pgdata 0x0000 port g output control register pgcr 0x0004 port g function register 1 pgfr1 0x0008 reserved - 0x0010 port g open drain control register pgod 0x0028 port g pull-up control register pgpup 0x002c port g input control register pgie 0x0038 note:access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg page 131
8.2.7.3 pgdata (port g data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7 pg6 pg5 pg4 pg3 pg2 pg1 pg0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7-pg0 r/w port g data register. 8.2.7.4 pgcr (port g output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7c pg6c pg5c pg4c pg3c pg2c pg1c pg0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7c-pg0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 132
8.2.7.5 pgfr1(port g function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7f1 pg6f1 pg5f1 pg4f1 pg3f1 pg2f1 pg1f1 pg0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 pg7f1 r/w 0: port 1: tb8out 6 pg6f1 r/w 0: port 1: sck2 5 pg5f1 r/w 0: port 1: si2/scl2 4 pg4f1 r/w 0: port 1: so2/sda2 3 pg3f1 r/w 0: port 1: int4 2 pg2f1 r/w 0: port 1: sck0 1 pg1f1 r/w 0: port 1: si0/scl0 0 pg0f1 r/w 0: port 1: so0/sda0 TMPM333FDFG/fyfg/fwfg page 133
8.2.7.6 pgod (port g open drain control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7od pg6od pg5od pg4od pg3od pg2od pg1od pg0od after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7od- pg0od r/w 0: cmos 1: open-drain 8.2.7.7 pgpup (port g pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7up pg6up pg5up pg4up pg3up pg2up pg1up pg0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7up- pg0up r/w pull-up 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 134
8.2.7.8 pgie (port g input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pg7ie pg6ie pg5ie pg4ie pg3ie pg2ie pg1ie pg0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7ie-pg0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 135
8.2.8 port h (ph0 to ph7) the port h is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port h performs the functions of the 16-bit timer input and the operation mode setting. while a reset signal is in "low" state, the 8.2.8.1 port h circuit type 7 6 5 4 3 2 1 0 type t3 t3 t3 t3 t3 t3 t3 t5 8.2.8.2 port h register base address = 0x4000_01c0 register name address (base+) port h data register phdata 0x0000 port h output control register phcr 0x0004 port h function register 1 phfr1 0x0008 reserved - 0x0010 port h pull-up control register phpup 0x002c port h input control register phie 0x0038 note:access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 136
8.2.8.3 phdata (port h data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 ph7-ph0 r/w port h data register. 8.2.8.4 phcr (port h output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ph7c ph6c ph5c ph4c ph3c ph2c ph1c ph0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 ph7c-ph0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 137
8.2.8.5 phfr1(port h function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ph7f1 ph6f1 ph5f1 ph4f1 ph3f1 ph2f1 ph1f1 ph0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 ph7f1 r/w 0: port 1: tb3in1 6 ph6f1 r/w 0: port 1: tb3in0 5 ph5f1 r/w 0: port 1: tb2in1 4 ph4f1 r/w 0: port 1: tb2in0 3 ph3f1 r/w 0: port 1: tb1in1 2 ph2f1 r/w 0: port 1: tb1in0 1 ph1f1 r/w 0: port 1: tb0in1 0 ph0f1 r/w 0: port 1: tb0in0 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 138
8.2.8.6 phpup (port h pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ph7up ph6up ph5up ph4up ph3up ph2up ph1up ph0up after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-8 ? r read as 0. 7-0 ph7up-ph0up r/w pull-up 0: disable 1: enable 8.2.8.7 phie (port h input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ph7ie ph6ie ph5ie ph4ie ph3ie ph2ie ph1ie ph0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 ph7ie-ph0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 139
8.2.9 port i (pi0 to pi7) the port i is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port i performs the 16-bit timer input/output function. reset initializes all bits of the port i as general-purpose ports with input, output and pull-up disabled. 8.2.9.1 port i circuit type 7 6 5 4 3 2 1 0 type t3 t3 t9 t9 t9 t9 t9 t9 8.2.9.2 port i register base address = 0x4000_0200 register name address (base+) port i data register pidata 0x0000 port i output control register picr 0x0004 port i function register 1 pifr1 0x0008 reserve - 0x0010 port i pull-up control register pipup 0x002c port i input control register piie 0x0038 note:access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 140
8.2.9.3 pidata(port i data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pi7 pi6 pi5 pi4 pi3 pi2 pi1 pi0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pi7-pi0 r/w port i data register. 8.2.9.4 picr (port i output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pi7c pi6c pi5c pi4c pi3c pi2c pi1c pi0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pi7c-pi0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 141
8.2.9.5 pifr1(port i function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pi7f1 pi6f1 pi5f1 pi4f1 pi3f1 pi2f1 pi1f1 pi0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 pi7f1 r/w 0: port 1: tb4in1 6 pi6f1 r/w 0: port 1: tb4in0 5 pi5f1 r/w 0: port 1: tb5out 4 pi4f1 r/w 0: port 1: tb4out 3 pi3f1 r/w 0: port 1: tb3out 2 pi2f1 r/w 0: port 1: tb2out 1 pi1f1 r/w 0: port 1: tb1out 0 pi0f1 r/w 0: port 1: tb0out TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 142
8.2.9.6 pipup (port i pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pi7up pi6up pi5up pi4up pi3up pi2up pi1up pi0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pi7up-pi0up r/w pull-up 0: disable 1: enable 8.2.9.7 piie (port i input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pi7ie pi6ie pi5ie pi4ie pi3ie pi2ie pi1ie pi0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pi7ie-pi0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 143
8.2.10 port j (pj0 to pj7) the port j is a general-purpose, 8-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port j performs the functions of the 16-bit timer output and the external interrupt input. reset initializes all bits of the port j as to perform as the general-purpose ports with input, output and pull-up disabled. to use the external interrupt input for releasing stop mode, select this function in the pjfr1 register and enable input in the pjie register. these settings enable the interrupt input even if the cgstbycr bit in the clock/mode control block is set to stop driving of pins during stop mode. note:in modes other than stop mode, interrupt input is enabled regardless of the pjfr register setting if input is enabled in pjie. make sure to disable unused interrupts when programming the device. 8.2.10.1 port j circuit type 7 6 5 4 3 2 1 0 type t7 t7 t9 t9 t7 t7 t7 t7 8.2.10.2 port j register base address = 0x4000_0240 register name address (base+) port j data register pjdata 0x0000 port j output control register pjcr 0x0004 port j function register 1 pjfr1 0x0008 reserved - 0x0010 port j pull-up control register pjpup 0x002c port j input control register pjie 0x0038 note:access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 144
8.2.10.3 pjdata (port j data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pj7 pj6 pj5 pj4 pj3 pj2 pj1 pj0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7-pj0 r/w port j data register. 8.2.10.4 pjcr (port j output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pj7c pj6c pj5c pj4c pj3c pj2c pj1c pj0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7c-pj0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 145
8.2.10.5 pjfr1(port j function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pj7f1 pj6f1 pj5f1 pj4f1 pj3f1 pj2f1 pj1f1 pj0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 pj7f1 r/w 0: port 1: int7 6 pj6f1 r/w 0: port 1: int6 5 pj5f1 r/w 0: port 1: tb7out 4 pj4f1 r/w 0: port 1: tb6out 3 pj3f1 r/w 0: port 1: int3 2 pj2f1 r/w 0: port 1: int2 1 pj1f1 r/w 0: port 1: int1 0 pj0f1 r/w 0: port 1: int0 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 146
8.2.10.6 pjpup (port j pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pj7up pj6up pj5up pj4up pj3up pj2up pj1up pj0up after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7up-pj0up r/w pull-up 0: disable 1: enable 8.2.10.7 pjie (port j input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol pj7ie pj6ie pj5ie pj4ie pj3ie pj2ie pj1ie pj0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7ie-pj0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 147
8.2.11 port k (pk0 to pk2) the port k is a general-purpose, 3-bit input/output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose port function, the port k performs the functions of the 16-bit timer output, the clock output and the alarm output. reset initializes all bits of the port k as general-purpose ports with input, output and pull-up disabled. note:pk0 is an n-ch open drain port. 8.2.11.1 port k circuit type 7 6 5 4 3 2 1 0 type ? ? ? ? ? t9 t15 t14 8.2.11.2 port k register base address = 0x4000_0280 register name address (base+) port k data register pkdata 0x0000 port k output control register pkcr 0x0004 port k function register 1 pkfr1 0x0008 port k function register 2 pkfr2 0x000c port k pull-up control register pkpup 0x002c port k input control register pkie 0x0038 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 148
8.2.11.3 pkdata(port k data register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pk2 pk1 pk0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2-0 pk2-pk0 r/w port k data register. 8.2.11.4 pkcr (port k output control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pk2c pk1c pk0c after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2-0 pk2c-pk0c r/w output 0: disable 1: enable TMPM333FDFG/fyfg/fwfg page 149
8.2.11.5 pkfr1(port k function register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pk2f1 pk1f1 pk0f1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2 pk2f1 r/w 0: port 1: tb9out 1 pk1f1 r/w 0: port 1: scout 0 pk0f1 r/w 0: port 1: reserved TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 150
8.2.11.6 pkfr2(port k function register 2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - pk1f2 - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-2 ? r read as 0. 1 pk1f2 r/w 0: port 1: alarm 0 ? r read as 0. 8.2.11.7 pkpup (port k pull-up control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pk2up pk1up - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2-1 pk2up-pk1up r/w pull-up 0: disable 1: enable 0 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 151
8.2.11.8 pkie (port k input control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - pk2ie pk1ie pk0ie after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2-0 pk2ie-pk0ie r/w input 0: disable 1: enable TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.2 port functions page 152
8.3 block diagrams of ports 8.3.1 port types the ports are classified as shown below. please refer to the following pages for the block diagrams of each port type. dot lines in the figure indicate the part of the equivalent circuit described in the "block diagrams of ports". table 8-5 function lists type gp port function 1 function 2 analog pull-up pull-down programma- ble open-drain note t1 i/o ? ? ? r ? ? t2 i/o input ? ? nor ? ? t3 i/o input ? ? r ? ? t4 i/o input ? ? r ? t5 i/o input ? ? nor ? ? boot input enabled during reset t6 i/o input ? ? ? nor ? t7 i/o input (int) ? ? r ? ? t8 i/o input (int) ? ? r ? t9 i/o output ? ? r ? ? t10 i/o output ? ? r ? t11 i/o output ? ? r ? ? function output triggered by enable signal t12 i/o i/o ? ? nor ? ? function output triggered by enable signal t13 i/o i/o ? ? r ? t14 i/o i/o ? ? ? ? ? nch open drain port t15 i/o output output ? r ? ? t16 i/o i/o input ? r ? t17 input ? ? r ? ? t18 input input ? r ? ? int: interrupt input ?: not exist : exist r: forced disable during reset. nor: unaffected by reset. TMPM333FDFG/fyfg/fwfg page 153
8.3.2 type t1 figure 8-1 port type t1 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 154 pxpup (pull-up control) pxcr (output controll) pxdata (output latch) pxie (input control) reset i/o port drive disable in stop mode (set by ) port read 0 1 internal data bus
8.3.3 type t2 figure 8-2 port type t2 TMPM333FDFG/fyfg/fwfg page 155 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function input drive disable in stop mode set by  internal data bus
8.3.4 type t3 figure 8-3 port type t3 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 156 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function input drive disable in stop mode (set by ) internal data bus
8.3.5 type t4 figure 8-4 port type t4 TMPM333FDFG/fyfg/fwfg page 157 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function input pxod (open drain control) drive disable in stop mode set by internal data bus
8.3.6 type5 t5 figure 8-5 port type t5 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 158 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port 3ruw5hdg pxfr1 (function control) 0 1 function input b oo t drive disable in stop mode (set by ) internal data base
8.3.7 type t6 figure 8-6 port type t6 TMPM333FDFG/fyfg/fwfg page 159 pxpdn (pull-down control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function input drive disable in stop mode (set by ) ,qwhuqdo'dwd%xv
8.3.8 type t7 figure 8-7 port type t7 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 160 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 interrupt input drive disable in stop mode (set by ) noise filter ( qv7\s ) internal data bas
8.3.9 type t8 figure 8-8 port type t8 TMPM333FDFG/fyfg/fwfg page 161 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 interrupt input pxod (open-drain control) drive disable in stop mode set by noise filter ( qv7\s ) internal data bas
8.3.10 type t9 figure 8-9 port type t9 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 162 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function output 0 1 drive disable in stop mode (set by internal data bus
8.3.11 type t10 figure 8-10 port type t10 TMPM333FDFG/fyfg/fwfg page 163 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 pxod (open-drain control) function output 0 1 drive disable in stop mode (set by ) internal data bus
8.3.12 type t11 figure 8-11 port type t11 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 164 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function output 0 1 function output enable 0 1 drive disable in stop mode (set by ) internal data bus
8.3.13 type t12 figure 8-12 port type t12 TMPM333FDFG/fyfg/fwfg page 165 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function output 0 1 function output enable 0 1 function input drive disable in stop mode (set by ) internal data bus
8.3.14 type t13 figure 8-13 port type t13 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 166 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 pxod (open-drain control) function output 0 1 function input drive disable in stop mode (set by ) internal data bus
8.3.15 type t14 figure 8-14 port type t14 TMPM333FDFG/fyfg/fwfg page 167 pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 function output 0 1 function input n-chanel open-drain drive disable in stop mode (set by ) internal data bus
8.3.16 type t15 figure 8-15 port type t15 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 168 pxpup (pull-up control) pxcr (output control) pxfr1 (function control) pxie (input control) reset i/o port port read pxfr2 (function control) pxdata (output latch) function output2 0 1 function output1 0 1 drive disable in stop mode set by internal data bus
8.3.17 type t16 figure 8-16 port type t16 TMPM333FDFG/fyfg/fwfg page 169 pxpup (pull-up control) pxcr (output control) pxdata (output latch) pxie (input control) reset i/o port port read pxfr1 (function control) 0 1 pxod (open-drain control) function output1 0 1 function input1 pxfr2 (function control) function input2 drive disable in stop mode set by internal data bus
8.3.18 type t17 figure 8-17 port type t17 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.3 block diagrams of ports page 170 pxpup (pull-up control) pxie (input control) reset input port port read analog input drive disable in stop mode 6hwe\ internal data bus
8.3.19 type t18 figure 8-18 port typet18 TMPM333FDFG/fyfg/fwfg page 171 pxpup (pull-up control) pxie (input control) reset i/o port port read a nalog input pxfr1 (function control) function input drive disable in stop mode set by ) internal data bus
8.4 appendix (port setting list) the following table shows the register setting for each function. initialization of the ports where the [ ? 8.4.1 port a setting table 8-6 port setting list (port a) pin port type function after reset pacr pafr1 papup papdn paie pa0 t12 input port 0 0 x 0 1 output port 1 0 x 0 0 tms(input)/ swdio(i/o) ? 1 1 1 0 1 pa1 t6 input port 0 0 0 x 1 output port 1 0 0 x 0 tck(input)/ swclk(input) ? 0 1 0 1 1 pa2 t9 input port 0 0 x 0 1 output port 1 0 x 0 0 traceclk(output) 1 1 x 0 0 pa3 t9 input port 0 0 x 0 1 output port 1 0 x 0 0 tracedata0(output) 1 1 x 0 0 pa4 t9 input port 0 0 x 0 1 output port 1 0 x 0 0 tracedata1(output) 1 1 x 0 0 pa5 t9 input port 0 0 x 0 1 output port 1 0 x 0 0 tracedata2(output) 1 1 x 0 0 pa6 t9 input port 0 0 x 0 1 output port 1 0 x 0 0 tracedata3(output) 1 1 x 0 0 pa7 t1 input port 0 0 x 0 1 output port 1 0 x 0 0 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 172
8.4.2 port b setting table 8-7 port setting list (port b) pin port type function after re- set pbcr pbfr1 pbpup pbie pb0 t11 input port 0 0 x 1 output port 1 0 x 0 tdo(output)/ swv(output) 1 1 0 0 pb1 t2 input port 0 0 x 1 output port 1 0 x 0 tdi(input) 0 1 1 1 pb2 t2 input port 0 0 x 1 output port 1 0 x 0 trst(input) 0 1 1 1 pb3 t1 input port 0 0 x 1 output port 1 0 x 0 pb4 t1 input port 0 0 x 1 output port 1 0 x 0 pb5 t1 input port 0 0 x 1 output port 1 0 x 0 pb6 t1 input port 0 0 x 1 output port 1 0 x 0 pb7 t1 input port 0 0 x 1 output port 1 0 x 0 TMPM333FDFG/fyfg/fwfg page 173
8.4.3 port c setting table 8-8 port setting list (port c) pin port type function after re- set pcpup pcie pc0 t17 input port x 1 analog input 0 0 pc1 t17 input port x 1 analog input 0 0 pc2 t17 input port x 1 analog input 0 0 pc3 t17 input port x 1 analog input 0 0 8.4.4 port d setting table 8-9 port setting list (port d) pin port type function after re- set pdfr1 pdpup pdie pd0 t18 input port 0 x 1 tb5in0(input) 1 x 1 analog input x 0 0 pd1 t18 input port 0 x 1 tb5in1(input) 1 x 1 analog input x 0 0 pd2 t18 input port 0 x 1 tb6in0(input) 1 x 1 analog input x 0 0 pd3 t18 input port 0 x 1 tb6in1(input) 1 x 1 analog input x 0 0 pd4 t17 input port 0 x 1 analog input x 0 0 pd5 t17 input port 0 x 1 analog input x 0 0 pd6 t17 input port 0 x 1 analog input x 0 0 pd7 t17 input port 0 x 1 analog input x 0 0 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 174
8.4.5 port e setting table 8-10 port setting list (port e) pin port type function after re- set pecr pefr1 pefr2 peod pepup peie pe0 t10 input port 0 0 0 x x 1 output port 1 0 0 x x 0 txd0(output) 1 1 0 x x 0 pe1 t4 input port 0 0 0 x x 1 output port 1 0 0 x x 0 rxd0(input) 0 1 0 x x 1 pe2 t16 input port 0 0 0 x x 1 output port 1 0 0 x x 0 sclk0(input) 0 1 0 x x 1 sclk0(output) 1 1 0 x x 0 cts0(input) 0 0 1 x x 1 pe3 t4 input port 0 0 0 x x 1 output port 1 0 0 x x 0 pe4 t10 input port 0 0 0 x x 1 output port 1 0 0 x x 0 txd1(output) 1 1 0 x x 0 pe5 t4 input port 0 0 0 x x 1 output port 1 0 0 x x 0 rxd1(input) 0 1 0 x x 1 pe6 t16 input port 0 0 0 x x 1 output port 1 0 0 x x 0 sclk1(input) 0 1 0 x x 1 sclk1(output) 1 1 0 x x 0 cts1(input) 0 0 1 x x 1 TMPM333FDFG/fyfg/fwfg page 175
8.4.6 port f setting table 8-11 port setting list (port f) pin port type function after re- set pfcr pffr1 pffr2 pfod pfpup pfie pf0 t10 input port 0 0 0 x x 1 output port 1 0 0 x x 0 txd2(output) 1 1 0 x x 0 pf1 t4 input port 0 0 0 x x 1 output port 1 0 0 x x 0 rxd2(input) 0 1 0 x x 1 pf2 t16 input port 0 0 0 x x 1 output port 1 0 0 x x 0 sclk2(input) 0 1 1 x x 1 sclk2(output) 1 1 0 x x 0 cts2(input) 0 0 0 x x 1 pf3 t4 input port 0 0 0 x x 1 output port 1 0 0 x x 0 pf4 t13 input port 0 0 0 x x 1 output port 1 0 0 x x 0 so1(output) 1 1 0 x x 0 sda1(input/output) 1 1 0 1 x 1 pf5 t13 input port 0 0 0 x x 1 output port 1 0 0 x x 0 si1(input) 0 1 0 x x 1 scl1(input/output) 1 1 0 1 x 1 pf6 t13 input port 0 0 0 x x 1 output port 1 0 0 x x 0 sck1(input) 0 1 0 x x 1 sck1(output) 1 1 0 x x 0 pf7 t8 input port 0 0 0 x x 1 output port 1 0 0 x x 0 int5(input) 0 1 0 x x 1 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 176
8.4.7 port g setting table 8-12 port setting list (port g) pin port type function after re- set pgcr pgfr1 pgod pgpup pgie pg0 t13 input port 0 0 x x 1 output port 1 0 x x 0 so0(output) 1 1 x x 0 sda0(input/output) 1 1 1 x 1 pg1 t13 input port 0 0 x x 1 output port 1 0 x x 0 si0(input) 0 1 x x 1 scl0(input/output) 1 1 1 x 1 pg2 t13 input port 0 0 x x 1 output port 1 0 x x 0 sck0(input) 0 1 x x 1 sck0(output) 1 1 x x 0 pg3 t8 input port 0 0 x x 1 output port 1 0 x x 0 int4(input) 0 1 x x 1 pg4 t13 input port 0 0 x x 1 output port 1 0 x x 0 so2(output) 1 1 x x 0 sda2(input/output) 1 1 1 x 1 pg5 t13 input port 0 0 x x 1 output port 1 0 x x 0 si2(input) 0 1 x x 1 scl2(input/output) 1 1 1 x 1 pg6 t13 input port 0 0 x x 1 output port 1 0 x x 0 sck2(input) 0 1 x x 1 sck2(output) 1 1 x x 0 pg7 t10 input port 0 0 x x 1 output port 1 0 x x 0 tb8out(output) 1 1 x x 0 TMPM333FDFG/fyfg/fwfg page 177
8.4.8 port h setting table 8-13 port setting list (port h) pin port type function after re- set phcr phfr1 phpup phie ph0 t5 input port 0 0 x 1 output port 1 0 x 0 tb0in0(input) 0 1 x 1 ph1 t3 input port 0 0 x 1 output port 1 0 x 0 tb0in1(input) 0 1 x 1 ph2 t3 input port 0 0 x 1 output port 1 0 x 0 tb1in0(input) 0 1 x 1 ph3 t3 input port 0 0 x 1 output port 1 0 x 0 tb1in1(input) 0 1 x 1 ph4 t3 input port 0 0 x 1 output port 1 0 x 0 tb2in0(input) 0 1 x 1 ph5 t3 input port 0 0 x 1 output port 1 0 x 0 tb2in1(input) 0 1 x 1 ph6 t3 input port 0 0 x 1 output port 1 0 x 0 tb3in0(input) 0 1 x 1 ph7 t3 input port 0 0 x 1 output port 1 0 x 0 tb3in1(input) 0 1 x 1 note:the ph0 input and pull-up are enabled and act as boot input pin while a reset is in "low" state. TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 178
8.4.9 port i setting table 8-14 port setting list (port i) pin port type function after re- set picr pifr1 pipup piie pi0 t9 input port 0 0 x 1 output port 1 0 x 0 tb0out(output) 1 1 x 0 pi1 t9 input port 0 0 x 1 output port 1 0 x 0 tb1out(output) 1 1 x 0 pi2 t9 input port 0 0 x 1 output port 1 0 x 0 tb2out(output) 1 1 x 0 pi3 t9 input port 0 0 x 1 output port 1 0 x 0 tb3out(output) 1 1 x 0 pi4 t9 input port 0 0 x 1 output port 1 0 x 0 tb4out(output) 1 1 x 0 pi5 t9 input port 0 0 x 1 output port 1 0 x 0 tb5out(output) 1 1 x 0 pi6 t3 input port 0 0 x 1 output port 1 0 x 0 tb4in0(input) 0 1 x 1 pi7 t3 input port 0 0 x 1 output port 1 0 x 0 tb4in1(input) 0 1 x 1 TMPM333FDFG/fyfg/fwfg page 179
8.4.10 port j setting table 8-15 port setting list (port j) pin port type function after re- set pjcr pjfr1 pjpup pjie pj0 t7 input port 0 0 x 1 output port 1 0 x 0 int0(input) 0 1 x 1 pj1 t7 input port 0 0 x 1 output port 1 0 x 0 int1(input) 0 1 x 1 pj2 t7 input port 0 0 x 1 output port 1 0 x 0 int2(input) 0 1 x 1 pj3 t7 input port 0 0 x 1 output port 1 0 x 0 int3(input) 0 1 x 1 pj4 t9 input port 0 0 x 1 output port 1 0 x 0 tb6out(output) 1 1 x 0 pj5 t9 input port 0 0 x 1 output port 1 0 x 0 tb7out(output) 1 1 x 0 pj6 t7 input port 0 0 x 1 output port 1 0 x 0 int6(input) 0 1 x 1 pj7 t7 input port 0 0 x 1 output port 1 0 x 0 int7(input) 0 1 x 1 TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 180
8.4.11 port k setting table 8-16 port setting list (port k) pin port type function after re- set pkcr pkfr1 pkfr2 pkpup pkie pk0 t14 input port 0 0 0 0 1 output port 1 0 0 0 0 pk1 t15 input port 0 0 0 x 1 output port 1 0 0 x 0 scout(output) 1 1 0 x 0 alarm(output) 1 0 1 x 0 pk2 t9 input port 0 0 0 x 1 output port 1 0 0 x 0 tb9out(output) 1 1 0 x 0 note:pk0 is an n-ch open drain port. TMPM333FDFG/fyfg/fwfg page 181
TMPM333FDFG/fyfg/fwfg 8. input/output ports 8.4 appendix (port setting list) page 182
9. 16-bit timer/event counters(tmrb) 9.1 outline tmrb operate in the following four operation modes: ? ? ? ? ? ? ? TMPM333FDFG/fyfg/fwfg page 183
9.2 differences in the specifications TMPM333FDFG/fyfg/fwfg contains 10-channel of tmrb. each channel functions independently and the channels operate in the same way except for the differences in their specification as shown in table 9-1. some of the channels can put the capture trigger and the synchronous start trigger on other channels. 1. the flip-flop output of tmrb 7 through tmrb 9 can be used as the capture trigger of other channels. ? ? ? ? ? table 9-1 differences in the specifications of tmrb modules specification external pins trigger function between timers interrupt channel external clock/ capture trigger input pins timer flip-flop output pin capture trigger synchronous start trigger channel capture interrupt tmrb interrupt signal port (pin number) signal port (pin number) tmrb0 tb0in0 tb0in1 ph0 (30) ph1 (31) tb0out pi0 (38) tb7out ? intcap00 intcap01 inttb0 tmrb1 tb1in0 tb1in1 ph2 (32) ph3 (36) tb1out pi1 (40) tb7out tmrb0 intcap10 intcap11 inttb1 tmrb2 tb2in0 tb2in1 ph4 (9) ph5 (10) tb2out pi2 (42) tb8out tmrb0 intcap20 intcap21 inttb2 tmrb3 tb3in0 tb3in1 ph6 (84) ph7 (85) tb3out pi3 (48) tb8out tmrb0 intcap30 intcap31 inttb3 tmrb4 tb4in0 tb4in1 pi6 (79) pi7 (83) tb4out pi4 (52) tb8out ? intcap40 intcap41 inttb4 tmrb5 tb5in0 tb5in1 pd0 (95) pd1 (96) tb5out pi5 (53) tb9out tmrb4 intcap50 intcap51 inttb5 tmrb6 tb6in0 tb6in1 pd2 (97) pd3 (98) tb6out pj4 (88) tb9out tmrb4 intcap60 intcap61 inttb6 tmrb7 ? ? tb7out pj5 (8) ? tmrb4 ? inttb7 tmrb8 ? ? tb8out pg7 (11) ? ? ? inttb8 tmrb9 ? ? tb9out pk2 (7) ? ? ? inttb9 TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.2 differences in the specifications page 184
9.3 configuration each channel consists of a 16-bit up-counter, two 16-bit timer registers (double-buffered), two 16-bit capture reg- isters, two comparators, a capture input control, a timer flip-flop and its associated control circuit.timer operation modes and the timer flip-flop are controlled by a register. figure 9-1 tmrbx block diagram(x= 0 to 9) TMPM333FDFG/fyfg/fwfg page 185 2481632 t1 t4 t16 t1 t4 t16 tmrbx interrupt inttbx tbxin0 tbxin1 internal data bus run/ clear tbxmod tbxcr tbxmod tbxmod tbxmod prescaler clock : t0 timer flip-flop timer flip-flop output tbxout register buffer0 internal data bus count clock tbxff0 match detection capture control register buffer1 match detection timer flip-flop control capture interrupt intcapx1 tbxcr interrupt mask register tbxim capture interrupt intcapx0 comparator (cp0) comparator (cp1) 16-bit up-counter (uc) capture register1 tbxcp1 capture register0 tbxcp0 up counter capture register tbxuc prescaler/ up-counter control tbxrun tbxcr synchronous start trigger input synchronous start trigger output run/clear tbxout status register tbxst timer register0 tbxrg0 timer register1 tbxrg1 register 1 interrupt output overflow interrupt output register 0 interrupt output register 1 interrupt mask register 0 interrupt mask overflow interrupt mask
9.4 registers 9.4.1 register list according to channel the following table shows the register names and addresses of each channel. channel x base address channel0 0x4001_0000 channel1 0x4001_0040 channel2 0x4001_0080 channel3 0x4001_00c0 channel4 0x4001_0100 channel5 0x4001_0140 channel6 0x4001_0180 channel7 0x4001_01c0 channel8 0x4001_0200 channel9 0x4001_0240 register name(x=0 to 9) address(base+) enable register tbxen 0x0000 run register tbxrun 0x0004 control register tbxcr 0x0008 mode register tbxmod 0x000c flip-flop control register tbxffcr 0x0010 status register tbxst 0x0014 interrupt mask register tbxim 0x0018 up counter capture register tbxuc 0x001c timer register 0 tbxrg0 0x0020 timer register 1 tbxrg1 0x0024 capture register 0 tbxcp0 0x0028 capture register 1 tbxcp1 0x002c TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.4 registers page 186
9.4.2 tbxen (enable register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tben - - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tben r/w tmrbx operation 0: disabled 1: enabled specifies the tmrb operation. when the operation is disabled, no clock is supplied to the other registers in the tmrb module. this can reduce power consumption. (this disables reading from and writing to the other reg- isters except tbxen register.) to use the tmrb, enable the tmrb operation (set to "1") before programming each register in the tmrb module. if the tmrb operation is executed and then disabled, the settings will be maintained in each register. 6-0 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 187
9.4.3 tbxrun(run register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - tbprun - tbrun after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2 tbprun r/w prescaler operation 0: stop & clear 1: count 1 ? r read as 0. 0 tbrun r/w count operation 0: stop & clear 1: count TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.4 registers page 188
9.4.4 tbxcr(control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbwbf - tbsync - i2tb - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tbwbf r/w double buffer 0: disabled 1: enabled 6 ? r/w write 0. 5 tbsync r/w synchronous mode switching 0: individual (unit of channel) 1: synchronous 4 ? r read as 0. 3 i2tb r/w operation at idle mode 0: stop 1:operation 2-0 ? r read as 0. TMPM333FDFG/fyfg/fwfg page 189
9.4.5 tbxmod(mode register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - tbcp tbcpm tbcle tbclk after reset 0 0 1 0 0 0 0 0 bit bit symbol type function 31-7 ? r read as 0. 6 ? r/w write 0. 5 tbcp w capture control by software 0: capture by software 1: dont care when "0" is written, the capture register 0 (tbxcp0) takes count value. read as 1. 4-3 tbcpm[1:0] r/w capture timing 00: disable capture timing 01: tbxin0 tbxin1 takes count values into capture register 0 (tbxcp0) upon rising of tbxin0 pin input. takes count values into capture register 1 (tbxcp1) upon rising of tbxin1 pin input. 10: tbxin0 tbxin0 takes count values into capture register 0 (tbxcp0) upon rising of tbxin0 pin input. takes count values into capture register 1 (tbxcp1) upon falling of tbxin0 pin input. 11: tbxout tbxout takes count values into capture register 0 (tbxcp0) upon rising of 16-bit timer match output (tbxout) and into capture register 1 (tbxcp1) upon falling of tbxout. (tmrb0 and tmrb1:tb7out, tmrb2 through tmrb4:tb8out, tmrb5 and tmrb6:tb9out). 2 tbcle r/w up-counter control 0: disables clearing of the up-counter. 1: enables clearing of the up-counter. clears and controls the up-counter. when "0" is written, it disables clearing of the up-counter. when "1" is written, it clears up counter when there is a match with timer regsiter1 (tbxrg1). 1-0 tbclk[1:0] r/w selects the tmrbx source clock. 00: tbxin0 pin input 01: t1 10: t4 11: t16 TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.4 registers page 190
9.4.6 tbxffcr(flip-flop control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - tbc1t1 tbc0t1 tbe1t1 tbe0t1 tbff0c after reset 1 1 0 0 0 0 1 1 bit bit symbol type function 31-8 ? r read as 0. 7-6 ? r read as 1. 5 tbc1t1 r/w tbxff0 reverse trigger when the up-counter value is taken into the tbxcp1. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is taken into the capture register 1 (tbxcp1). 4 tbc0t1 r/w tbxff0 reverse trigger when the up-counter value is taken into the tbxcp0. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is taken into the capture register 0 (tbxcp0). 3 tbe1t1 r/w tbxff0 reverse trigger when the up-counter value is matched with tbxrg1. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is matched with the timer register 1 (tbxrg1). 2 tbe0t1 r/w tbxff0 reverse trigger when the up-counter value is matched with tbxrg0. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when an up-counter value is matched with the timer register 0 (tbxrg0). 1-0 tbff0c[1:0] r/w tbxff0 control 00: invert reverses the value of tbxff0 (reverse by using software). 01: set sets tbxff0 to "1". 10: clear clears tbxff0 to "0". 11: don't care * this is always read as "11". TMPM333FDFG/fyfg/fwfg page 191
9.4.7 tbxst(status register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - inttbof inttb1 inttb0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2 inttbof r overflow flag 0:no overflow occurs 1:overflow occurs when an up-counter is overflow, "1" is set. 1 inttb1 r match flag (tbxrg1) 0:no detection of a mach 1:detects a match with tbxrg1 when a match with the timer register 1 (tbxrg1) is detected,"1" is set. 0 inttb0 r match flag (tbxrg0) 0:no match is detected 1:detects a match with tbxrg0 when a match with the timer register 0 (tbxrg0) is detected, "1" is set. note 1: the factors only which is not masked by tbxim output interrupt request to the cpu.even if the mask setting is done, the flag is set. note 2: the flag is cleared by reading the tbxst register.to clear the flag, tbxst register should be read. TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.4 registers page 192
9.4.8 tbxim(interrupt mask register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - tbimof tbim1 tbim0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-3 ? r read as 0. 2 tbimof r/w overflow interrupt mask 0:disable 1:enable sets the up-counter overflow interrupt to disable or enable. 1 tbim1 r/w match interrupt mask (tbxrg1) 0:disable 1:enable sets the match interrupt mask with the timer register 1 (tbxrg1) to enable or disable. 0 tbim0 r/w match interrupt mask (tbxrg0) 0:disable 1:enable sets the match interrupt mask with the timer register 0 (tbxrg0) to enable or disable. 9.4.9 tbxuc(up counter capture register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbuc after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbuc after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-0 tbuc[15:0] r captures a value by reading up-counter out. if tbxuc is read, current up-counter value can be captured. TMPM333FDFG/fyfg/fwfg page 193
9.4.10 tbxrg0(timer register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbrg0 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbrg0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-0 tbrg0[15:0] r/w sets a value comparing to the up-counter. 9.4.11 tbxrg1(timer register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbrg1 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbrg1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-0 tbrg1[15:0] r/w sets a value comparing to the up-counter. TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.4 registers page 194
9.4.12 tbxcp0(capture register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbcp0 after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol tbcp0 after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-16 ? r read as 0. 15-0 tbcp0[15:0] r a value captured from the up-counter is read. 9.4.13 tbxcp1(capture register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol tbcp1 after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol tbcp1 after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-16 ? r read as 0. 15-0 tbcp1[15:0] r a value captured from the up-counter is read. TMPM333FDFG/fyfg/fwfg page 195
9.5 description of operations for each circuit the channels operate in the same way, except for the differences in their specifications as shown in table 9-1 . 9.5.1 prescaler there is a 4-bit prescaler to generate the source clock for up-counter uc. the prescaler input clock t0 is fperiph/1, fperiph/2, fperiph/4, fperiph/8, fperiph/16 or fperiph/32 selected by cgsyscr in the cg.the peripheral clock, fperiph, is either fgear, a clock selected by cgsyscr in the cg, or fc, which is a clock before it is divided by the clock gear. the operation or the stoppage of a prescaler is set with tbxrun where writing "1" starts counting and writing "0" clears and stops counting. table 9-2 and table 9-3 show prescaler output clock resolutions. table 9-2 prescaler output clock resolutions(fc = 40mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.05 s) fc/2 3 (0.2 s) fc/2 5 (0.8 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fc/2) 000 (fperiph/1) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) 001 (fperiph/2) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 010 (fperiph/4) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 011 (fperiph/8) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 100 (fperiph/16) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 101 (fperiph/32) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fc/4) 000 (fperiph/1) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 110 (fc/8) 000 (fperiph/1) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 001 (fperiph/2) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 010 (fperiph/4) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 011 (fperiph/8) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 100 (fperiph/16) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 101 (fperiph/32) fc/2 9 (12.8 s) fc/2 11 (51.2 s) fc/2 13 (204.8 s) TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.5 description of operations for each circuit page 196
table 9-2 prescaler output clock resolutions(fc = 40mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.05 s) fc/2 3 (0.2 s) fc/2 5 (0.8 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.2 s) fc/2 5 (0.8 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.2 s) fc/2 5 (0.8 s) 001 (fperiph/2) ? fc/2 4 (0.4 s) fc/2 6 (1.6 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (0.8 s) 001 (fperiph/2) ? fc/2 4 (0.4 s) fc/2 6 (1.6 s) 010 (fperiph/4) ? fc/2 5 (0.8 s) fc/2 7 (3.2 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) note 1: the prescaler output clock tn must be selected so that tn < fsys is satisfied (so that tn is slower than fsys). note 2: do not change the clock gear while the timer is operating. note 3: "?" denotes a setting prohibited. TMPM333FDFG/fyfg/fwfg page 197
table 9-3 prescaler output clock resolutions(fc = 32mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 3 (0.25 s) fc/2 5 (1.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fc/2) 000 (fperiph/1) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) 001 (fperiph/2) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 010 (fperiph/4) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 011 (fperiph/8) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 100 (fperiph/16) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 101 (fperiph/32) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fc/4) 000 (fperiph/1) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 110 (fc/8) 000 (fperiph/1) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 001 (fperiph/2) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 010 (fperiph/4) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 011 (fperiph/8) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 100 (fperiph/16) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 101 (fperiph/32) fc/2 9 (16.0 s) fc/2 11 (64.0 s) fc/2 13 (256.0 s) TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.5 description of operations for each circuit page 198
table 9-3 prescaler output clock resolutions(fc = 32mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 3 (0.25 s) fc/2 5 (1.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.25 s) fc/2 5 (1.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.25 s) fc/2 5 (1.0 s) 001 (fperiph/2) ? fc/2 4 (0.5 s) fc/2 6 (2.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (1.0 s) 001 (fperiph/2) ? fc/2 4 (0.5 s) fc/2 6 (2.0 s) 010 (fperiph/4) ? fc/2 5 (1.0 s) fc/2 7 (4.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) note 1: the prescaler output clock tn must be selected so that tn < fsys is satisfied (so that tn is slower than fsys). note 2: do not change the clock gear while the timer is operating. note 3: "?" denotes a setting prohibited. TMPM333FDFG/fyfg/fwfg page 199
9.5.2 up-counter (uc) uc is a 16-bit binary counter. ? ? ? ? 9.5.3 timer registers (tbxrg0, tbxrg1) tbxrg0 and tbxrg1 are registers for setting values to compare with up-counter values and two registers are built into each channel. if the comparator detects a match between a value set in this timer register and that in a uc up-counter, it outputs the match detection signal. tbxrg0 and tbxrg1 are consisted of the double-buffered configuration which are paired with register buf- fers. the double buffering is disabled in the initial state. controlling double buffering disable or enable is specified by tbxcr bit. if = "0", the double buffering becomes disable. if = "1", it becomes enable. when the double buffering is enabled, a data transfer from the register buffer to the timer register (tbxrg0/1) is done in the case that uc is matched with tbxrg1.when the counter is stopped even if double buffering is enabled, the double buffering operates as a single buffer, and an immediate data can be written to the tbxrg0 and tbxrg1. TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.5 description of operations for each circuit page 200
9.5.4 capture this is a circuit that controls the timing of latching values from the uc up-counter into the tbxcp0 and tbxcp1 capture registers. the timing with which to latch data is specified by tbxmod. software can also be used to import values from the uc up-counter into the capture register; specifically, uc values are taken into the tbxcp0 capture register each time "0" is written to tbxmod. 9.5.5 capture registers (tbxcp0, tbxcp1) this register captures an up-counter (uc) value. 9.5.6 up-counter capture register (tbxuc) other than the capturing functions shown above, the current count value of the uc can be captured by reading the tbxuc registers. 9.5.7 comparators (cp0, cp1) this register compares with the up-counter (uc) and the value setting of the timer register (tbxrg0 and tbxrg1) to detect whether there is a match or not. if a match is detected, inttbx is generated. 9.5.8 timer flip-flop (tbxff0) the timer flip-flop (tbxff0) is reversed by a match signal from the comparator and a latch signal to the capture registers. it can be enabled or disabled to reverse by setting the tbxffcr. the value of tbxff0 becomes undefined after a reset. the flip-flop can be reversed by writing "00" to tbxffcr. it can be set to "1" by writing "01," and can be cleared to "0" by writing "10." the value of tbxff0 can be output to the timer output pin (tbxout). if the timer output is performed, the corresponding port settings must be programmed beforehand. 9.5.9 capture interrupt (intcapx0, intcapx1) interrupts intcapx0 and intcapx1 can be generated at the timing of latching values from the uc up-counter into the tbxcp0 and tbxcp1 capture registers. the interrupt timing is specified by the cpu. TMPM333FDFG/fyfg/fwfg page 201
9.6 description of operations for each mode 9.6.1 16-bit interval timer mode in the case of generating constant period interrupt, set the interval time to the timer register (tbxrg1) to generate the inttbx interrupt. 7 6 5 4 3 2 1 0 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. interrupt set-enable register * * * * * * * * permits inttbx interrupt by setting corresponding bit to "1". tbxffcr x x 0 0 0 0 1 1 disable to tbxff0 reverse trigger tbxmod x 0 1 0 0 1 * * changes to prescaler output clock as input clock. specifies capture function to disable. (** = 01, 10, 11) tbxrg1 * * * * * * * * specifies a time interval. (16 bits) * * * * * * * * tbxrun * * * * * 1 x 1 starts tmrbx. note:x; dont care ?; no change 9.6.2 16-bit event counter mode it is possible to make it the event counter by using an input clock as an external clock (tbxin0 pin input). the up-counter counts up on the rising edge of tbxin0 pin input. it is possible to read the count value by capturing value using software and reading the captured value. 7 6 5 4 3 2 1 0 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. pxie[m] 1 allocates corresponding port totbxin0. pxfr1[m] 1 tbxffcr x x 0 0 0 0 1 1 disables to tbxff0 reverse trigger tbxmod x 0 1 0 0 0 0 0 changes totbxin0 as an input clock tbxrun * * * * * 1 x 1 starts tmrbx. tbxmod x 0 0 0 0 0 0 0 software capture is done. note 1: m: corresponding bit of port note 2: x; dont care ?; no change TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.6 description of operations for each mode page 202
9.6.3 16-bit ppg (programmable pulse generation) output mode square waves with any frequency and any duty (programmable square waves) can be output. the output pulse can be either low-active or high-active. programmable square waves can be output from the tbxout pin by triggering the timer flip-flop (tbxff) to reverse when the set value of the up-counter (uc) matches the set values of the timer registers (tbxrg0 and tbxrg1). note that the set values of tbxrg0 and tbxrg1 must satisfy the following requirement: (set value of tbxrg0) < (set value of tbxrg1) figure 9-2 example of output of programmable pulse generation (ppg) in this mode, by enabling the double buffering of tbxrg0, the value of register buffer 0 is shifted into tbxrg0 when the set value of the up-counter matches the set value of tbxrg1. this facilitates handling of small duties. figure 9-3 register buffer operation TMPM333FDFG/fyfg/fwfg page 203 q 2 q 1 match with tbxrg1 tbxrg0 (compare value) q 3 q 2 register buffer trigger to shift to tbxrg1 write tbxrg0 up-counter= q 1 up-counter= q 2 match with tbxrg0 tbxout pin match with tbxrg0 (inttbx interrupt) match with tbxrg1 (inttbx interrupt)
the block diagram of this mode is shown below. figure 9-4 block diagram of 16-bit ppg mode each register in the 16-bit ppg output mode must be programmed as listed below. 7 6 5 4 3 2 1 0 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. tbxcr 0 0 ? x ? x x x disables double buffering. tbxrg0 specifies a duty. (16 bits) tbxrg1 specifies a cycle. (16 bits) tbxcr 1 0 x 0 0 0 0 0 enables the tbxrg0 double buffering. (changes the duty/cycle when the inttbx interrupt is gener- ated) tbxffcr x x 0 0 1 1 1 0 specifies to trigger tbxff0 to reverse when a match with tbxrg0 or tbxrg1 is detected,and sets the initial value of tbxff0 to "0." tbxmod x 0 1 0 0 1 designates the prescaler output clock as the input clock,and disables the capture function. ( = 01, 10, 11) pxcr[m] 1 allocates corresponding port to tbxout. pxfr1[m] 1 tbxrun 1 x 1 starts tmrbx. note 1: m: corresponding bit of port note 2: x; dont care ?; no change TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.6 description of operations for each mode page 204 selector internal data bus tbxcr write tbxrg0 tbxout (ppg output) tbxrun match tbxin0 t1 t4 t16 tbxrg0 clear 16-bit up-counter uc tbxrg1 f/f (tbxff0) write tbxrg1 tbxcr register buffer 0 register buffer 1 16-bit comparator 16-bit comparator selector selector
9.6.4 timer synchronous mode this mode enables the timers to start synchronously. if the mode is used with ppg output, the output can be applied to drive a motor. tmrb is consisted of two pairs of 4-channel tmrb. if one channel starts, remaining 3 channels can be start synchronously. in the TMPM333FDFG/fyfg/fwfg, the following combinations allow to use. start trigger channel (master channel) synchronous operation channel (slave channel) tmrb0 tmrb1, tmrb2, tmrb3 tmrb4 tmrb5, tmrb6, tmrb7 use of the timer synchronous mode is specified in tbxcr bit. ? ? TMPM333FDFG/fyfg/fwfg page 205
9.7 applications using the capture function the capture function can be used to develop many applications, including those described below: 1. one-shot pulse output triggered by an external pulse 2. frequency measurement 3. pulse width measurement 4. time difference measurement 9.7.1 one-shot pulse output triggered by an external pulse one-shot pulse output triggered by an external pulse is carried out as follows: the 16-bit up-counter is made to count up by putting it in a free-running state using the prescaler output clock. an external pulse is input through the tbxin0 pin. a trigger is generated at the rising of the external pulse by using the capture function and the value of the up-counter is taken into the capture registers (tbxcp0). the cpu must be programmed so that an interrupt intcapx0 is generated at the rising of an external trigger pulse. this interrupt is used to set the timer registers (tbxrg0) to the sum of the tbxcp0 value (c) and the delay time (d), (c + d), and set the timer registers (tbxrg1) to the sum of the tbxrg0 values and the pulse width (p) of one-shot pulse, (c + d + p).[tbxrg1 change must be completed before the next match.] in addition, the timer flip-flop control registers(tbxffcr) must be set to "11". this enables triggering the timer flip-flop (tbxff0) to reverse when tbxuc matches tbxrg0 and tbxrg1. this trigger is disabled by the inttbx interrupt after a one-shot pulse is output. symbols (c), (d) and (p) used in the text correspond to symbols c, d and p in "figure 9-5 one-shot pulse output (with delay)". figure 9-5 one-shot pulse output (with delay) TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.7 applications using the capture function page 206 count clock (internal clock) timer output tbxout pin tbxin0 pin input (external trigger pulse) match with tbxrg0 match with tbxrg1 c (p) c + d c + d + p enable reverse enable reverse put the counter in a free-running state. taking data into the capture register (tbxcp0). inttbx generation disable reverse when data is taken into tbxcp0. pulse width (d) delay time inttbx generation intcapx0 generation
the followings show the settings in the case that 2 ms width one-shot pulse is output after 3ms by triggering tbxin0 input at the rising edge. ( t1 is selected for counting.) changes source clock to t1. fetches a count value into the tbxcp0 at the rising edge of tbxin0. 7 6 5 4 3 2 1 0 [main processing] capture setting by tbxin0 pxie[m] 1 allocates corresponding port to tbxin0. pxfr1[m] 1 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. tbxmod x 0 1 0 1 0 0 1 changes source clock to t1. fetches a count value into the tbxcp0 at the rising edge of tbxin0. tbxffcr x x 0 0 0 0 1 0 clears tbxff0 reverse trigger and disables. pxcr[m] 1 allocates corresponding port totbxout. pxfr1[m] 1 interrupt set-enable register permits to generate interrupts specified by intcapx0 interrupt corresponding bit by setting to "1". tbxrun 1 x 1 starts the tmrbx module. [processing of intcapx0 interrupt service routine] pulse output setting tbxrg0 sets count value. (tbxcap0 + 3ms/t1) tbxrg1 sets count value.(tbxcap0 + (3+2)ms/t1) tbxffcr x x ? ? 1 1 ? ? reverses tbxff0 if tbxrg0 consistent with tbxrg1. tbxim x x x x x 1 0 1 masks except tbxrg1 correspondence interrupt. interrupt set-enable register permits to generate interrupt specified by inttbx interrupt cor- responding bit setting to "1". [processing of inttbx interrupt service routine] output disable tbxffcr x x ? ? 0 0 ? ? clears tbxff0 reverse trigger setting. interrupt enable clear register prohibits interrupts specified by inttbx interrupt correspond- ing bit by setting to "1". note 1: m: corresponding bit of port note 2: x; dont care ?; no change if a delay is not required, tbxff0 is reversed when data is taken into tbxcp0, and tbxrg1 is set to the sum of the tbxcp0 value (c) and the one-shot pulse width (p), (c + p), by generating the intcapx0 interrupt. (tbxrg1 change must be completed before the next match.) tbxff0 is enabled to reverse when uc matches with tbxrg1, and is disabled by generating the inttbx interrupt. figure 9-6 one-shot pulse output triggered by an external pulse (without delay) TMPM333FDFG/fyfg/fwfg page 207 count clock (prescaler output clock) timer output tbxout pin tbxin0 input (external trigger pulse) match with tbxrg1 c (p) c + p enable reverse inttbx generation enable reverse when data is taken into tbxcp0. taking data into the capture register tbxcp0. taking data into the capture register tbxcp1. disable reverse when data is taken into tbxcp1. pulse width intcapx0 generation
9.7.2 frequency measurement the frequency of an external clock can be measured by using the capture function. to measure frequency, another 16-bit timer is used in combination with the 16-bit event counter mode. as an example, we explain with tmrb3 and tmrb8. tb8out of the 16-bit timer tmrb8 is used to specify the measurement time. tmrb3 count clock selects tb3in0 input and performs count operation by using external clock input. if tb3mod is set "11", tmrb3 count clock takes the counter value into the tb3cp0 at the rising edge of tb8out and takes the counter value into tb3cp1 at the falling edge of tb8out. this setting allows a count value of the 16-bit up-counter uc to be taken into the capture register (tb3cp0) upon rising of a timer flip-flop output (tb8out) of the 16-bit timer (tmrb8), and an uc counter value to be taken into the capture register (tb3cp1) upon falling of tb8out of the 16-bit timer (tmrb8). a frequency is then obtained from the difference between tb3cp0 and tb3cp1 based on the measurement, by generating the inttb8 16-bit timer interrupt. for example, if the difference between tb3cp0 and tb3cp1 is 100 and the level width setting value of tb8out is 0.5 s, the frequency is 200 hz (100 0.5 s = 200 hz). figure 9-7 frequency measurement TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.7 applications using the capture function page 208 count clock (tb3in0 pin input) taking data into tb3cp1 tb8out taking data into tb3cp0 c1 c1 c1 c2 c2 c2 inttb8
9.7.3 pulse width measurement by using the capture function, the "high" level width of an external pulse can be measured. specifically, by putting it in a free-running state using the prescaler output clock, an external pulse is input through the tbxin0 pin and the up-counter (uc) is made to count up. a trigger is generated at each rising and falling edge of the external pulse by using the capture function and the value of the up-counter is taken into the capture registers (tbxcp0, tbxcp1). the cpu must be programmed so that intcapx1 is generated at the falling edge of an external pulse input through the tbxin0 pin. the "high" level pulse width can be calculated by multiplying the difference between tbxcp0 and tbxcp1 by the clock cycle of an internal clock. for example, if the difference between tbxcp0 and tbxcp1 is 100 and the cycle of the prescaler output clock is 0.5 s , the pulse width is 100 0.5 s = 50 s. caution must be exercised when measuring pulse widths exceeding the uc maximum count time which is dependant upon the source clock used. the measurement of such pulse widths must be made using software. the "low" level width of an external pulse can also be measured. in such cases, the difference between c2 generated the first time and c1 generated the second time is initially obtained by performing the second stage of intcapx0 interrupt processing as shown in "figure 9-8 pulse width measurement" and this difference is mul- tiplied by the cycle of the prescaler output clock to obtain the "low" level width. figure 9-8 pulse width measurement TMPM333FDFG/fyfg/fwfg page 209 prescaler output clock taking data into tbxcp1 tbxin0 pin input (external pulse) taking data into tbxcp0 c1 c1 c1 c2 c2 c2 intcapx1 intcapx0
9.7.4 time difference measurement the time difference of two events can be measured by the capture function. the up-counter (uc) is made to count up by putting it in a free-running state using the prescaler output clock. the value of uc is taken into the capture register (tbxcp0) at the rising edge of the tbxin0 pin input pulse. the cpu must be programmed to generate intcapx0 interrupt at this time. the value of uc is taken into the capture register (tbxcp1) at the rising edge of the tbxin1 pin input pulse. the cpu must be programmed to generate intcapx1 interrupt at this time. the time difference can be calculated by multiplying the difference between tbxcp1 and tbxcp0 by the clock cycle of an internal clock. figure 9-9 time difference measurement TMPM333FDFG/fyfg/fwfg 9. 16-bit timer/event counters(tmrb) 9.7 applications using the capture function page 210 prescaler output clock taking data into tbxcp1 tbxin0 pin input tbxin1 pin input taking data into tbxcp0 c1 c2 intcapx0 intcapx1 time difference
10. serial channel (sio/uart) 10.1 overview this device has two mode for the serial channel, one is the synchronous communication mode (i/o interface mode), and the other is the asynchronous communication mode (uart mode). their features are given in the following. ? ? ? ? 10.2 difference in the specifications of sio modules TMPM333FDFG/fyfg/fwfg has three sio channels. each channel functions independently. the used pins and interrupt in each channel are collected in the following. table 10-1 difference in the specifications of sio modules channel 0 channel 1 channel 2 pin name txd pe0(20pin) pe4(23pin) pf0(33pin) rxd pe1(21pin) pe5(24pin) pf1(34pin) cts/slck pe2(22pin) pe6(25pin) pf2(35pin) interrupt receive interrupt intrx0 intrx1 intrx2 transmit interrupt inttx0 inttx1 inttx2 TMPM333FDFG/fyfg/fwfg page 211
10.3 configuration figure 10-1 shows sio block diagram. figure 10-1 sio block diagram TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.3 configuration page 212 t0 f sys t t1 t t4 t t16 t t64 t t1 scxbrcr tbxout (from tmrbx) scxbrcr scxcr sioclk scxmod0 scxmod0 txdclk scxcr scxmod0 scxmod0 scxmod0 scxbrcr scxbradd prescaler uart mode sclkx input sclkx output rxdx txdx interrupt request intrxx interrupt request inttxx ? 2 scxcr i/o interface mode ctsx rxdclk 2 4 8 16 32 64 128 t t4 t t16 t t64 baud rate generator i/o interface mode transmission counter (only at uart : 16) serial channel interrupt control transmission control recive control recive shift register tb8 transmit buffer (scxbuf) rb8 recive buffer (scxbuf) parity control fifo control error flag fifo control internal data bus internal data bus internal data bus selector selector selector selector transmit shift register divider serial clock generation circuit recive counter (only at uart : 16)
10.4 registers description 10.4.1 registers list in each channel the each channel registers and addresses are shown here. channel x base address channel0 0x4002_0080 channel1 0x4002_00c0 channel2 0x4002_0100 register name (x=0 to 2) address (base+) enable register scxen 0x0000 buffer register scxbuf 0x0004 control register scxcr 0x0008 mode control register 0 scxmod0 0x000c baud rate generator control register scxbrcr 0x0010 baud rate generator control register 2 scxbradd 0x0014 mode control register 1 scxmod1 0x0018 mode control register 2 scxmod2 0x001c rx fifo configuration register scxrfc 0x0020 tx fifo configuration register scxtfc 0x0024 rx fifo status register scxrst 0x0028 tx fifo status register scxtst 0x002c fifo configuration register scxfcnf 0x0030 note:do not modify any control register when data is being transmitted or received. TMPM333FDFG/fyfg/fwfg page 213
10.4.2 scxen (enable register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - sioe after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-1 ? r read as 0. 0 sioe r/w sio operation 0: disabled 1: enabled specified the sio operation. to use the sio, set = "1". when the operation is disabled, no clock is supplied to the other registers in the sio module. this can reduce the power consumption. if the sio operation is executed and then disabled, the settings will be maintained in each register except for scxtfc. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 214
10.4.3 scxbuf (buffer register) scxbuf works as a transmit buffer or fifo for write operation and as a receive buffer or fifo for read operation. 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tb / rb after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 tb[7:0] / rb [7:0] r/w [write] tb : transmit buffer / fifo [read] rb : receive buffer / fifo TMPM333FDFG/fyfg/fwfg page 215
10.4.4 scxcr (control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol rb8 even pe oerr perr ferr sclks ioc after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 rb8 r receive data bit 8 (for uart) 9th bit of the received data in the 9 bits uart mode. 6 even r/w parity (for uart) 0: odd 1: even selects even or odd parity. "0" : odd parity, "1" : even parity. the parity bit may be used only in the 7- or 8-bit uart mode. 5 pe r/w add parity (for uart) 0: disabled 1: enabled controls enabling/ disabling parity. the parity bit may be used only in the 7- or 8-bit uart mode. 4 oerr r overrun error flag (note) 0: normal operation 1: error 3 perr r parity / underrun error flag (note) 0: normal operation 1: error 2 ferr r framing error flag (note) 0: normal operation 1: error 1 sclks r/w selecting input clock edge (for i/o interface) 0: rising edges 1: falling edges selects input clock edge for data transmission and reception. set to "0" in the clock output mode. 0 ioc r/w selecting clock (for i/o interface) 0: baud rate generator 1: sclk pin input note: any error flag (oerr, perr, ferr) is cleared to "0" when read. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 216
10.4.5 scxmod0 (mode control register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tb8 ctse rxe wu sm sc after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tb8 r/w transmit data bit 8 (for uart) writes the 9th bit of transmit data in the 9 bits uart mode. 6 ctse r/w handshake function control (for uart) 0: cts disabled 1: cts enabled controls handshake function. setting "1" enables handshake function using cts pin. 5 rxe r/w receive control (note) 0: disabled 1: enabled 4 wu r/w wake-up function (for uart) 0: disabled 1: enabled this function is available only at 9-bit uart mode. in other mode, this function has no meaning. in it is enabled, interrupt only when rb9 = "1" at 9-bit uart mode. 3-2 sm[1:0] r/w specifies transfer mode. 00: i/o interface mode 01: 7-bit length uart mode 10: 8-bit length uart mode 11: 9-bit length uart mode 1-0 sc[1:0] r/w serial transfer clock (for uart) 00: timer tb9out 01: baud rate generator 10: internal clock fsys 11: external clock (sclk input) (as for the i/o interface mode, the serial transfer clock can be set in the control register (scxcr). note 1: with set to "0", set each mode register (scxmod0, scxmod1 and scxmod2). then set to "1". note 2: do not stop the receive operation (by setting scxmod0 = "0") when data is being received. TMPM333FDFG/fyfg/fwfg page 217
10.4.6 scxmod1 (mode control register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol i2sc fdpx txe sint - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 i2sc r/w idle 0: stop 1: operate specifies the idle mode operation. 6-5 fdpx[1:0] r/w transfer mode setting 00: transfer prohibited 01: half duplex (recieve) 10: half duplex (trasmitt) 11: full duplex configures the transfer mode in the i/o interface mode. also configures the fifo if it is enabled. in the uart mode, it is used only to specify the fifo configuration. 4 txe r/w transmit control (note) 0 :disabled 1: enabled this bit enables transmission and is valid for all the transfer modes. 3-1 sint[2:0] r/w interval time of continuous transmission (for i/o interface) 000: none 001: 1sclk 010: 2sclk 011: 4sclk 100: 8sclk 101: 16sclk 110: 32sclk 111: 64sclk this parameter is valid only for the i/o interface mode when sclk pin output is selected. in other modes, this function has no meaning. specifies the interval time of continuous transmission when double buffering or fifo is enabled in the i/o interface mode. 0 ? r/w write a "0". note 1: specify the all mode first and then enable the bit. note 2: do not stop the transmit operation (by setting = "0")when data is being transmitted. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 218
10.4.7 scxmod2 (mode control register 2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tbemp rbfll txrun sblen drchg wbuf swrst after reset 1 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tbemp r transmit buffer empty flag. 0: full 1: empty if double buffering is disabled, this flag is insignificant. this flag shows that the transmit double buffers are empty. when data in the transmit double buffers is moved to the transmit shift register and the double buffers are empty, this bit is set to "1". writing data again to the double buffers sets this bit to "0". 6 rbfll r receive buffer full flag. 0: empty 1: full this is a flag to show that the receive double buffers are full. when a receive operation is completed and received data is moved from the receive shift register to the receive double buffers, this bit changes to "1" while reading this bit changes it to "0". if double buffering is disabled, this flag is insignificant. 5 txrun r in transmission flag 0: stop 1: operate this is a status flag to show that data transmission is in progress. and bits indicate the following status. status 1 ? transmission in progress 0 1 transmission completed 0 wait state with data in transmitt buffer 4 sblen r/w stop bit (for uart) 0 : 1-bit 1 : 2-bit this specifies the length of transmission stop bit in the uart mode. on the receive side, the decision is made using only a single bit regardless of the setting. 3 drchg r/w setting transfer direction 0: lsb first 1: msb first specifies the direction of data transfer in the i/o interface mode. in the uart mode, set this bit to lsb first. TMPM333FDFG/fyfg/fwfg page 219
bit bit symbol type function 2 wbuf r/w double-buffer 0: disabled 1 : enabled this parameter enables or disables the transmit/receive double buffers to transmit (in both sclk output/input modes) and receive (in sclk output mode) data in the i/o interface mode and to transmit data in the uart mode. when receiving data in the i/o interface mode (sclk input) and uart mode, double buffering is enabled in both cases that 0 or 1 is set to bit. 1-0 swrst[1:0] r/w software reset overwriting "01" in place of "10" generates a software reset. when this software reset is executed, the following bits are initialized and the transmit/receive circuit, the transmit circuit and the fifo become initial state (see note1 and note2). register bit scxmod0 rxe scxmod1 txe scxmod2 tbemp, rbfll, txrun scxcr oerr, perr, ferr note 1: while data transmission is in progress, any software reset operation must be executed twice in succession. note 2: a software reset requires 2 clocks-duration at the time between the end of recognition and the start of exe- cution of software reset instruction. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 220
10.4.8 scxbrcr (baud rate generator control register), scxbradd (baud rate gen- erator control register 2) the division ratio of the baud rate generator can be specified in the registers shown below. scxbrcr 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - bradde brck brs after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 ? r/w write "0". 6 bradde r/w n + (16 ? k)/16 divider function (for uart) 0: disabled 1: enabled this division function can only be used in the uart mode. 5-4 brck[1:0] r/w select input clock to the baud rate generator. 00: t1 01: t4 10: t16 11: t64 3-0 brs[3:0] r/w division ratio "n" 0000: 16 0001: 1 0010: 2 ... 1111: 15 TMPM333FDFG/fyfg/fwfg page 221
scxbradd 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - brk after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-4 ? r read as 0. 3-0 brk[3:0] r/w specify k for the "n + (16 ? k)/16" division (for uart) 0000: prohibited 0001: k = 1 0010: k = 2 ... 1111: k = 15 table 10-2 lists the settings of baud rate generator division ratio. table 10-2 setting division ratio = "0" = "1" (note1) (only uart mode) specify "n" (note2) (note3) no setting required specify "k" (note4) division ratio divide by n note 1: to use the "n + (16 - k)/16" division function, be sure to set to "1" after setting the k value to . the "n + (16 - k)/16" division function can only be used in the uart mode. note 2: as a division ratio, 1 ("0001") or 16 ("0000") can not be applied to n when using the "n + (16 - k)/16" division function in the uart mode. note 3: the division ratio "1" of the baud rate generator can be specified only when the double buffering is used in the i/o interface mode. note 4: specifying "k = 0" is prohibited. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 222 n + (16 ? k) 16 glylvlrq
10.4.9 scxfcnf ( fifo configuration register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - rfst tfie rfie rxtxcnt cnfg after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0 7-5 - r/w be sure to write "000" 4 rfst r/w bytes used in rx fifo 0:maximum 1:same as fill level of rx fifo when rx fifo is enabled, the number of rx fifo bytes to be used is selected (note1) 0: the maximun number of bytes of the fifo configured (see also ). 1: same as the fill level for receive interrupt generation specified by scxrfc 3 tfie r/w tx interrupt for tx fifo 0: disabled 1:enabled when tx fifo is enabled, transmit interrupts are enabled or disabled by this parameter. 2 rfie r/w rx interrupt for rx fifo 0: disabled 1:enabled when rx fifo is enabled, receive interrupts are enabled or disabled by this parameter. 1 rxtxcnt r/w automatic disable of rxe/txe 0: none 1: auto diabled controls automatic disabling of transmission and reception. setting "1" enables to operate as follows half duplex rx when receive shift register, the receive buffer and the rx fifo are filled, scxmod0 is automatically set to "0" to inhibit further reception. half duplex tx when the tx fifo, the transmit buffer and the transmit shift register is empty, scxmod1 is automatically set to "0" to inhibit further transmission. full duplex when either of the above two conditions is satisfied, txe/rxe are automatically set to "0" to inhibit further transmission and reception. 0 cnfg r/w enables fifo. 0: disabled 1: enabled if enabled, the scxmod1 setting automatically configures fifo as follows: (the type of tx/rx can be specified in the mode control register 1 scxmod1). half duplex rx rx fifo 4byte half duplex tx tx fifo 4byte full duplex rx fifo 2byte + tx fifo 2byte note 1: regarding tx fifo, the maximum number of bytes being configured is always available. the available num- ber of bytes is the bytes already written to the tx fifo. note 2: the fifo can not use in 9bit uart mode. TMPM333FDFG/fyfg/fwfg page 223
10.4.10 scxrfc (rx fifo configuration register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol rfcs rfis - - - - ril after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 rfcs w rx fifo clear 1: clear setting "1" clears rx fifo and "0" is always read. 6 rfis r/w select interrupt generation condition 0: when the data reaches to the specified fill level. 1: when the data reaches to the specified fill level or the data exceeds the specified fill level at the time data is read. 5-2 ? r read as 0. 1-0 ril[1:0] r/w fifo fill level to generate rx interrupts half duplex full duplex 00 4byte 2byte 01 1byte 1byte 10 2byte 2byte 11 3byte 1byte note:to use tx/rx fifo buffer, tx/rx fifo must be cleared after setting the sio transfer mode (half duplex/ full duplex) and enabling fifo (scxfcnf = "1"). TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 224
10.4.11 scxtfc (tx fifo configuration register) (note2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tfcs tfis - - - - til after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tfcs w tx fifo clear (note 1) 1: clears tx fifo. setting "1" clears tx fifo and "0" is always read. 6 tfis r/w selects interrupt generation condition. 0: an interrupt is generated when the data reaches to the specified fill level. 1: an interrupt is generated when the data reaches to the specified fill level or the data can not reach the specified fill level at the time new data is read. 5-2 ? r read as 0. 1-0 til[1:0] r/w selects fifo fill level. other than full duplex full duplex 00 empty empty 01 1 byte 1 byte 10 2 byte empty 11 3 byte 1 byte note 1: to use tx/rx fifo buffer, tx/rx fifo must be cleared after setting the sio transfer mode (half duplex/full duplex) and enabling fifo (scxfcnf = "1"). note 2: after you perform the following operations, configure the scxtfc register again. scxen = "0" (sio operation stop) conditions are as follows:scxmod1 = "0" (operation is prohibited in idle mode) and releasing the low power consumption mode which started by the wfi (wait for interrupt) instruction. TMPM333FDFG/fyfg/fwfg page 225
10.4.12 scxrst (rx fifo status register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol ror - - - - rlvl after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 ror r rx fifo overrun (note) 0: not generated 1: generated 6-3 ? r read as 0. 2-0 rlvl[2:0] r status of rx fifo fill level. 000: empty 001: 1 byte 010: 2 byte 011: 3 byte 100: 4 byte note: the bit is cleared to "0" when receive data is read from the scxbuf register. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.4 registers description page 226
10.4.13 scxtst (tx fifo status register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tur - - - - tlvl after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 tur r tx fifo under run (note) 0: not generated 1: generated. 6-3 ? r read as 0. 2-0 tlvl[2:0] r status of tx fifo fill level. 000: empty 001: 1 byte 010: 2 byte 011: 3 byte 100: 4 byte note: the bit is cleared to "0" when transmit data is written to the scxbuf register. TMPM333FDFG/fyfg/fwfg page 227
10.5 operation in each mode table 10-3 shows the modes and data formats. table 10-3 mode and data format mode mode type data length transfer direction specifies whether to use parity bits. stop bit length (transmit) mode 0 synchronous communication mode (io interface mode) 8 bit lsb first/msb first - - mode 1 asynchronous communication mode (uart mode) 7 bit lsb first 1 bit or 2 bit mode 2 8 bit mode 3 9 bit mode 0 is a synchronous communication and can be used to extend i/o. this mode transmits and receives data in synchronization with sclk. sclk can be used for both input and output. the direction of data transfer can be selected from lsb first and msb first. this mode is not allowed either to use parity bits or stop bits. the mode 1, mode 2 and mode 3 are asynchronous modes and the transfer direction is fixed to the lsb first. parity bits can be added in the mode 1 and mode 2. the mode 3 has a wakeup function in which the master controller can start up slave controllers via the serial link (multi-controller system). stop bit in transmission can be selected from 1 bit and 2 bits. the stop bit length in reception is fixed to a one bit. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.5 operation in each mode page 228
10.6 data format 10.6.1 data format list figure 10-2 shows data format. figure 10-2 data format TMPM333FDFG/fyfg/fwfg page 229 mode1 (7bits uart mode) bit 0 1 2 3 4 5 6 stop start without parity bit 0 1 2 3 4 5 6 parity stop start with parity mode2 (8bits uart mode) bit 0 1 2 3 4 5 6 start 7 stop without parity bit 0 1 2 3 4 5 6 7 parity stop start with parity stop bit 0 1 2 3 4 5 6 start 7 8 bit 0 1 2 3 4 5 6 7 bit 8 stop (wake-up) start mode3 (9bits uart mode) bit 8 = 1 represents address. (select code) bit 8 = 0 represents data. 1 bit 0 2 3 4 5 6 mode0 (i/o interface mode) / lsb first transmission direction 7 6 bit 7 5 4 3 2 1 mode0 (i/o interface mode ) / msb first transmission direction 0
10.6.2 parity control the parity bit can be added only in the 7- or 8-bit uart mode. setting "1" to scxcr enables the parity. the bit of scxcr selects either even or odd parity. 10.6.2.1 transmission upon data transmission, the parity control circuit automatically generates the parity with the data in the transmit buffer. after data transmission is complete, the parity bit will be stored in scxbuf in the 7-bit uart mode and scxmod in the 8-bit uart mode. the and settings must be completed before data is written to the transmit buffer. 10.6.2.2 receiving data if the received data is moved from the receive shift register to the receive buffer, a parity is generated. in the 7-bit uart mode, the generated parity is compared with the parity stored in scxbuf, while in the 8-bit uart mode, it is compared with the one in scxcr. if there is any difference, a parity error occurs and the of the scxcr register is set to "1". in use of the fifo, indicates that a parity error was generated in one of the recieved data. 10.6.3 stop bit length the length of the stop bit in the uart transmission mode can be selected from one bit or two bits by setting the scxmod2. the length of the stop bit data is determined as one-bit when it is received regardless of the setting of this bit. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.6 data format page 230
10.7 clock control 10.7.1 prescaler there is a 7-bit prescaler to divide a prescaler input clock t0 by 2, 8, 32 and 128. use the cgsyscr register in the clock/mode control block to select the input clock t0 of the prescaler. the prescaler becomes active only when the baud rate generator is selected as a transfer clock by scxmod0 = "11". table 10-4 (operation frequency 40mhz), table 10-5 (operation frequency 32mhz) show the resolution of the input clock to the baud rate generator. table 10-4 clock resolution to the baud rate generator fc = 40 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock se- lection cgsyscr prescaler output clock resolution t1 t4 t16 t64 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.05 s) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 100 (fc/2) 000 (fperiph/1) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 001 (fperiph/2) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 010 (fperiph/4) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 011 (fperiph/8) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 100 (fperiph/16) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 101 (fperiph/32) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) fc/2 13 (204.8 s) 101 (fc/4) 000 (fperiph/1) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 001 (fperiph/2) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 010 (fperiph/4) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 011 (fperiph/8) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 100 (fperiph/16) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) fc/2 13 (204.8 s) 101 (fperiph/32) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) fc/2 14 (409.6 s) 110 (fc/8) 000 (fperiph/1) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 001 (fperiph/2) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 010 (fperiph/4) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 011 (fperiph/8) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) fc/2 13 (204.8 s) 100 (fperiph/16) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) fc/2 14 (409.6 s) 101 (fperiph/32) fc/2 9 (12.8 s) fc/2 11 (51.2 s) fc/2 13 (204.8 s) fc/2 15 (819.2 s) TMPM333FDFG/fyfg/fwfg page 231
table 10-4 clock resolution to the baud rate generator fc = 40 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock se- lection cgsyscr prescaler output clock resolution t1 t4 t16 t64 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.05 s) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) fc/2 2 (0.1 s) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) ? fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) fc/2 3 (0.2 s) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (0.8 s) fc/2 7 (3.2 s) 001 (fperiph/2) ? fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) 010 (fperiph/4) ? fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) 011 (fperiph/8) fc/2 4 (0.4 s) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) 100 (fperiph/16) fc/2 5 (0.8 s) fc/2 7 (3.2 s) fc/2 9 (12.8 s) fc/2 11 (51.2 s) 101 (fperiph/32) fc/2 6 (1.6 s) fc/2 8 (6.4 s) fc/2 10 (25.6 s) fc/2 12 (102.4 s) note 1: the prescaler output clock tn must be selected so that the relationship "tn fsys / 2" is satisfied (so that tn is slower than fsys). note 2: do not change the clock gear while sio is operating. note 3: the dashes in the above table indicate that the setting is prohibited. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.7 clock control page 232
table 10-5 clock resolution to the baud rate generator fc = 32 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock se- lection cgsyscr prescaler output clock resolution t1 t4 t16 t64 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 100 (fc/2) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 001 (fperiph/2) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 010 (fperiph/4) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 011 (fperiph/8) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 100 (fperiph/16) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 101 (fperiph/32) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) fc/2 13 (256.0 s) 101 (fc/4) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 001 (fperiph/2) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 010 (fperiph/4) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 011 (fperiph/8) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 100 (fperiph/16) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) fc/2 13 (256.0 s) 101 (fperiph/32) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) fc/2 14 (512.0 s) 110 (fc/8) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 001 (fperiph/2) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 010 (fperiph/4) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 011 (fperiph/8) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) fc/2 13 (256.0 s) 100 (fperiph/16) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) fc/2 14 (512.0 s) 101 (fperiph/32) fc/2 9 (16.0 s) fc/2 11 (64.0 s) fc/2 13 (256.0 s) fc/2 15 (1024 s) TMPM333FDFG/fyfg/fwfg page 233
table 10-5 clock resolution to the baud rate generator fc = 32 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock se- lection cgsyscr prescaler output clock resolution t1 t4 t16 t64 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.0625 s) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) fc/2 2 (0.125 s) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) ? fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) fc/2 3 (0.25 s) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (1.0 s) fc/2 7 (4.0 s) 001 (fperiph/2) ? fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) 010 (fperiph/4) ? fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) 011 (fperiph/8) fc/2 4 (0.5 s) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) 100 (fperiph/16) fc/2 5 (1.0 s) fc/2 7 (4.0 s) fc/2 9 (16.0 s) fc/2 11 (64.0 s) 101 (fperiph/32) fc/2 6 (2.0 s) fc/2 8 (8.0 s) fc/2 10 (32.0 s) fc/2 12 (128.0 s) note 1: the prescaler output clock tn must be selected so that the relationship "tn fsys / 2" is satisfied (so that tn is slower than fsys / 2). note 2: do not change the clock gear while sio is operating. note 3: the dashes in the above table indicate that the setting is prohibited. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.7 clock control page 234
10.7.2 serial clock generation circuit the serial clock circuit is a block to generate transmit and receive clocks (sioclk) and consists of the circuits in which clocks can be selected by the settings of the baud rates generator and modes. 10.7.2.1 baud rate generator the baud rate generator generates transmit and receive clocks to determine the serial channel transfer rate. (1) baud rate generator input clock the input clock of the baud rate generator is selected from the prescaler outputs divided by 2, 8, 32 and 128. this input clock is selected by setting the scxbrcr. (2) baud rate generator output clock the frequency division ratio of the output clock in the baud rate generator is set by scxbrcr and scxbradd. the following frequency divide ratios can be used; 1/n frequency division in the i/o interface mode ,either 1/n or n + (16-k)/16 in the uart mode. the table below shows the frequency division ratio which can be selected. mode divide function setting scxbrcr divide by n scxbrcr divide by k scxbradd i/o interface divide by n 1 to 16 (note) - uart divide by n 1 to 16 - n + (16-k)/16 division 2 to 15 1 to 15 note:1/n (n=1)frequency division ratio can be used only when a double buffer is enabled. TMPM333FDFG/fyfg/fwfg page 235
10.7.2.2 clock selection circuit a clock can be selected by setting the modes and the register. modes can be specified by setting the scxmod0. the input clock in i/o interface mode is selected by setting scxcr. the clock in uart mode is selected by setting scxmod0. (1) transfer clock in i/o interface mode table 10-6 shows clock selection in i/o interface mode. table 10-6 clock selection in i/o interface mode mode scxmod0 input/output selection scxcr clock edge selection scxcr clock of use i/o interface mode sclk output set to "0". (fixed to the rising edge) divided by 2 of the baud rate gen- erator output. sclk input rising edge sclk input rising edge falling edge sclk input falling edge to get the highest baud rate, the baud rate generator must be set as below. note: when deciding clock settings, make sure that ac electrical character is satisfied. ? ? ? ? ? TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.7 clock control page 236
the highest baud rate is less than 40 8 = 5.0 mbps. (2) transfer clock in the uart mode table 10-7 shows the clock selection in the uart mode. in the uart mode, selected clock is divided by 16 in the receive counter or the transmit counter before use. table 10-7 clock selection in uart mode mode scxmod0 clock selection scxmod0 uart mode timer output baud rate generator fsys sclk input the examples of baud rate in each clock settings. ? if the baud rate generator is used - fc = 40mhz - fgear = 40mhz (cgsyscr = "000" : fc selected) - t0 = 40mhz (cgsyscr = "000" : 1 division ratio) - clock = t1 = 20mhz (scxbrcr = "00" : t1 selected) the highest baud rate is 1.25mbps because 20mhz is divided by 16. table 10-8 shows examples of baud rate when the baud rate generator is used with the following clock settings. ? fc = 9.8304mhz ? fgear = 9.8304mhz (cgsyscr = "000" : fc selected) ? t0 = 4.9152mhz (cgsyscr = "001" : 2 division ratio) table 10-8 example of uart mode baud rate (using the baud rate generator) fc [mhz] division ratio n (scxbrcr) t1 (fc/4) t4 (fc/16) t16 (fc/64) t64 (fc/256) 9.830400 2 76.800 19.200 4.800 1.200 4 38.400 9.600 2.400 0.600 8 19.200 4.800 1.200 0.300 16 9.600 2.400 0.600 0.150 unit ? if the sclk input is used to use sclk input, the following conditions must be satisfied. - sclk cycle > 2/fsys the highest baud rate must be less than 40 2 16 = 1.25 mbps. ? if fsys is used since the highest value of fsys is 40mhz, the highest baud rate is 40 16 = 2.5mbps. TMPM333FDFG/fyfg/fwfg page 237
? ? ? ? ? table 10-9 example of uart mode baud rate (using the timer output) tbxrg0 setting fc 32mhz 9.8304mhz 8mhz 0x0001 250 76.8 62.5 0x0002 125 38.4 31.25 0x0003 - 25.6 - 0x0004 62.5 19.2 15.625 0x0005 50 15.36 12.5 0x0006 - 12.8 - 0x0008 31.25 9.6 - 0x000a 25 7.68 6.25 0x0010 15.625 4.8 - 0x0014 12.5 3.84 3.125 unitkbps TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.7 clock control page 238 baud rate calculation transfer rate = clock frequency selected by cgsyscr (tbxrg0 2) 2 16 in the case the timer prescaler clock t1 (2divition ratio) is selected. one clock cycle is a period that the timer flip-flop is inverted twice.
10.8 transmit/receive buffer and fifo 10.8.1 configuration figure 10-3 shows the configuration of transmit buffer, receive buffer and fifo. appropriate settings are required for using buffer and fifo. the configuration may be predefined depending on the mode. figure 10-3 the configuration of buffer and fifo 10.8.2 transmit/receive buffer transmit buffer and receive buffer are double-buffered. the buffer configuration is specified by scxmod2. in the case of using a receive buffer, if sclk input is set to generate clock output in the i/o interface mode or the uart mode is selected, its double buffered despite the settings. in other modes, its according to the settings. table 10-10 shows correlation between modes and buffers. table 10-10 mode and buffer composition mode scxmod2 "0" "1" uart transmit single double receive double double i/o interface (sclk input) transmit single double receive double double i/o interface (sclk output) transmit single double receive single double 10.8.3 fifo in addition to the double buffer function above described, 4-byte fifo can be used. TMPM333FDFG/fyfg/fwfg page 239 6tcpuokv(+(1 6tcpuokvdwhhgt 6tcpuokvujkhvtgikuvgt 6:& 4gegkxg(+(1 (ktuvuvcig 5geqpfuvcig 6jktfuvcig (qwtvjuvcig 4gegkxgdwhhgt 4gegkxgujkhvtgikuvgt 4:& (ktuvuvcig 5geqpfuvcig 6jktfuvcig (qwtvjuvcig
to enable fifo, enable the double buffer by setting scxmod2 to "1" and scxfcnf to "1". the fifo buffer configuration is specified by scxmod1. note:to use tx/rx fifo buffer, tx/rx fifo must be cleared after setting the sio transfer mode (half duplex/ full duplex) and enabling fifo (scxfcnf = "1"). table 10-11 shows correlation between modes and fifo. table 10-11 mode and fifo composition scxmod1 rx fifo tx fifo half duplex rx "01" 4byte - half duplex tx "10" - 4byte full duplex "11" 2byte 2byte 10.9 status flag the scxmod2 register has two types of flag. this bit is significant only when the double buffer is enabled. is a flag to show that the receive buffer is full. when one frame of data is received and the data is moved from the receive shift register to the receive buffers, this bit changes to "1" while reading this bit changes it to "0". shows that the transmit buffers are empty. when data in the transmit buffers is moved to the transmit shift register, this bit is set to "1" when data is set to the transmit buffers, the bit is cleared to "0". 10.10 error flag three error flags are provided in the scxcr register. the meaning of the flags is changed depending on the modes. the table below shows the meanings in each mode. these flags are cleared to "0" after reading the scxcr register. mode flag uart overrun error parity error framing error i/o interface (sclk input) overrun error underrun error (when using double buffer or fifo) fixed to 0 fixed to 0 (when a double buffer and fifo unused) i/o interface (sclk output) undefined undefined fixed to 0 10.10.1 oerr flag in both uart and i/o interface modes, this bit is set to "1" when an error is generated by completing the reception of the next frame of receive data before the receive buffer has been read. if the receive fifo is enabled, the received data is automatically moved to the receive fifo and no overrun error will be generated until the receive fifo is full (or until the usable bytes are fully occupied). TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.9 status flag page 240
in the i/o interface with sclk output mode, the sclk output stops upon setting the flag. note:to switch the i/o interface sclk output mode to other modes, read the scxcr register and clear the overrun flag. 10.10.2 perr flag this flag indicates a parity error in the uart mode and an under-run error in the i/o interface mode. in the uart mode, is set to "1" when the parity generated from the received data is different from the parity received. in the i/o interface mode, is set to "1" under the following conditions when a double buffer is enabled. in the sclk input mode, is set to "1" when the sclk is input after completing data output of the transmit shift register with no data in the tarnsmit buffer. in the sclk output mode, is set to "1" after completing output of all data and the sclk output stops. note:to switch the i/o interface sclk output mode to other modes, read the scxcr register and clear the under-run flag. 10.10.3 ferr flag a framing error is generated if the corresponding stop bit is determined to be "0" by sampling the bit at around the center. regardless of the stop bit length settings in the scxmod2register, the stop bit status is determined by only 1. this bit is fixed to "0" in the i/o interface mode. TMPM333FDFG/fyfg/fwfg page 241
10.11 receive 10.11.1 receive counter the receive counter is a 4-bit binary counter and is up-counted by sioclk. in the uart mode, sixteen sioclk clock pulses are used in receiving a single data bit and the data symbol is sampled at the seventh, eighth, and ninth pulses. from these three samples, majority logic is applied to decide the received data. 10.11.2 receive control unit 10.11.2.1 i/o interface mode in the sclk output mode with scxcr set to "0", the rxd pin is sampled on the rising edge of the shift clock outputted to the sclk pin. in the sclk input mode with scxcr set to "1", the serial receive data rxd pin is sampled on the rising or falling edge of sclk input signal depending on the scxcr setting. 10.11.2.2 uart mode the receive control unit has a start bit detection circuit, which is used to initiate receive operation when a normal start bit is detected. 10.11.3 receive operation 10.11.3.1 receive buffer the received data is stored by 1 bit in the receive shift register. when a complete set of bits has been stored, the interrupt intrxx is generated. when the double buffer is enabled, the data is moved to the receive buffer (scxbuf) and the receive buffer full flag (scxmod2) is set to "1". the receive buffer full flag is "0" cleared by reading the receive buffer. figure 10-4 receive buffer operation TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.11 receive page 242 data 1 data 1 receive shift register receive buffer scxmod2 receive interrupt(intrxx) receive buffer read
10.11.3.2 receive fifo operation when fifo is enabled, the received data is moved from receive buffer to receive fifo and the receive buffer full flag is cleared immediately. an interrupt will be generated according to the scxrfc setting. note:when the data with parity bit are received in uart mode by using the fifo, the parity error flag is shown the occurring the parity error in the received data. the following describes configurations and operations in the half duplex rx mode. scxmod1[6:5] =01 : transfer mode is set to half duplex mode scxfcnf[4:0] = 10111 : automatically inhibits continuous reception after reaching the fill level. : the number of bytes to be used in the receive fifo is the same as the interrupt generation fill level. scxrfc[1:0] = 00 : the fill level of fifo in which generated receive interrupt is set to 4-byte. scxrfc[7:6] = 11 : clears receive fifo and sets the condition of interrupt generation. after setting of the above fifo configuration, the data reception is started by writing "1" to the scxmod0 . when the data is stored all in the receive shift register, receive buffer and receive fifo, scxmod0 is automatically cleared and the receive operation is finished. in this above condition, if the cotinuous reception after reaching the fill level is enabed, and it is possible to receive a data continuouslywith and reading the data in the fifo. figure 10-5 receive fifo operation TMPM333FDFG/fyfg/fwfg page 243 receive shift register receive buffer scxmod2 rx interrupt (intrxx) rx fifo the first stage the second stage the third stage the fourth stage scxmod0 data1 data1 data2 data2 data1 data3 data2 data1 data3 data4 data2 data1 data3 data4 data2 data1 data3 data4 data1 data2 data1 data3 data2 data4 data3 data4 data5 data5 data5 data6
10.11.3.3 i/o interface mode with sclk output in the i/o interface mode and sclk output setting, sclk output stops when all received data is stored in the receive buffer and fifo. so, in this mode, the overrun error flag has no meaning. the timing of sclk output stop and re-output depends on receive buffer and fifo. (1) case of single buffer stop sclk output after receiving a data. in this mode, i/o interface can transfer each data with the transfer device by hand-shake. when the data in a buffer is read, sclk output is restarted. (2) case of double buffer stop sclk output after receiving the data into a receive shift register and a receive buffer. when the data is read, sclk output is restarted. (3) case of fifo stop sclk output after receiving the data into a shift register, received buffer and fifo. when one byte data is read, the data in the received buffer is transferred into fifo and the data in the receive shift register is transferred into received buffer and sclk output is restarted. and if scxfcnfis set to "1", sclk stops and receive operation stops with clearing scxmod0 bit too. 10.11.3.4 read received data in spite of enabling or disabling fifo, read the received data from the receive buffer (scxbuf). when receive fifo is disabled, the buffer full flag scxmod2 is cleared to "0" by this reading. in the case of the next data can be received in the receive shift register before reading a data from the receive buffer. the parity bit to be added in the 8-bit uart mode as well as the most significant bit in the 9-bit uart mode will be stored in scxcr. when the receive fifo is available, the 9-bit uart mode is prohibited because up to 8-bit data can be stored in fifo. in the 8-bit uart mode, the parity bit is lost but parity error is determined and the result is stored in scxcr. 10.11.3.5 wake-up function in the 9-bit uart mode, the slave controller can be operated in the wake-up mode by setting the wake-up function scxmod0 to "1." in this case, the interrupt intrxx will be generated only when scxcr is set to "1." TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.11 receive page 244
10.11.3.6 overrun error when fifo is disabled, the overrun errorr is occurred and set overrun flag without completing data read before receiveing the next data. when overrun error is ocurred, a content of receive buffer and scxcr is not lost, but a content of receive shift register is lost. when fifo is enabled, overrun error is ocurred and set overrun flag by no reading the data before moving the next data into received buffer when fifo is full . in this case, the contens of fifo are not lost. in the i/o interface mode with sclk output setting, the clock output automatically stops, so this flag has no meaning. note:when the mode is changed from i/o interface sclk outout mode to the other mode, read scxcr and clear overrun flag. TMPM333FDFG/fyfg/fwfg page 245
10.12 transmission 10.12.1 transmission counter the transmit counter is a 4-bit binary counter and is counted by sioclk as in the case of the receive counter. in uart mode, it generates a transmit clock (txdclk) on every 16th clock pulse. figure 10-6 generation of transmission clock 10.12.2 transmission control 10.12.2.1 i/o interface mode in the sclk output mode with scxcr set to "0", each bit of data in the transmit buffer is outputted to the txd pin on the falling edge of the shift clock outputted from the sclk pin. in the sclk input mode with scxcr set to "1", each bit of data in the transmit buffer is outputted to the txd pin on the rising or falling edge of the sclk input signal according to the scxcr setting. 10.12.2.2 uart mode when the transmit data is written in the transmit buffer, data transmission is initiated on the rising edge of the next txdclk and the transmit shift clock signal is also generated. 10.12.3 transmit operation 10.12.3.1 operation of transmission buffer if double buffering is disabled, the cpu writes data only to transmit shift buffer and the transmit interrupt inttxx is generated upon completion of data transmission. if double buffering is enabled (including the case the transmit fifo is enabled), data written to the transmit buffer is moved to the transmit shift register. the inttxx interrupt is generated at the same time and the transmit buffer empty flag (scxmod2) is set to "1". this flag indicates that the next transmit data can be written. when the next data is written to the transmit buffer, the flag is cleared to "0". TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.12 transmission page 246 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 sioclk txdclk
figure 10-7 operation of transmission buffer (double-buffer is enabled) 10.12.3.2 transmit fifo operation when fifo is enabled, the maximum 5-byte data can be stored using the transmit buffer and fifo. once transmission is enabled, data is transferred to the transmit shift register from the transmit buffer and start transmission. if data exists in the fifo, the data is moved to the transmit buffer immediately, and the flag is cleared to "0". note: to use tx fifo buffer, tx fifo must be cleared after setting the sio transfer mode (half duplex/ full duplex) and enabling fifo (scxfcnf = "1"). settings and operations to transmit 4-byte data stream by setting the transfer mode to half duplex are shown as below. scxmod1[6:5] =10 : transfer mode is set to half duplex. scxfcnf[4:0] = 11011 : transmission is automatically disabled if fifo becomes empty. the number of bytes to be used in the receive fifo is the same as the interrupt generation fill level. scxtfc[1:0] = 00 : sets the interrupt generation fill level to "0". scxtfc[7:6] = 11 : clears receive fifo and sets the condition of interrupt generation. after above settings are configured, data transmission can be initiated by writing 5 bytes of data to the transmit buffer or fifo, and setting the scxmod1 bit to "1". when the last transmit data is moved to the transmit buffer, the transmit fifo interrupt is generated. when transmission of the last data is completed, the clock is stopped and the transmission sequence is terminated. once above settings are configured, if the transmission is not set as auto disabled, the transmission should lasts by writing transmit data. TMPM333FDFG/fyfg/fwfg page 247 data 1 transmit buffer scxmod2 transmit shift register(inttxx) write data data 2 data 1 transmit shift register
10.12.3.3 i/o interface mode/transmission by sclk output if sclk is set to generate clock the i/o interface mode, the sclk output automatically stops when all data transmission is completed and underrun error will not occur. the timing of suspension and resume of sclk output is different depending on the buffer and fifo usage. (1) single buffer the sclk output stops each time one frame of data is transferred. handshaking for each data with the other side of communication can be enabled. the sclk output resumes when the next data is written in the buffer. (2) double buffer the sclk output stops upon completion of data transmission of the transmit shift register and the transmit buffer. the sclk output resumes when the next data is written in the buffer. (3) fifo the transmission of all data stored in the transmit shift register, transmit buffer and fifo is completed, the sclk output stops. the next data is written, sclk output resumes. if scxfcnf is configured, scxmod0 bit is cleared at the same time as sclk stop and the transmission stops. 10.12.3.4 under-run error if the transmit fifo is disabled in the i/o interface sclk input mode and if no data is set in transmit buffer before the next frame clock input, which occurs upon completion of data transmission from transmit shift register, an under-run error occurs and scxcr is set to "1". TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.12 transmission page 248 transmit fifo fourth stage scxmod2 data 5 transmit buffer transmit shift register transmit interrupt(inttxx) scxmod1 third stage second stage first stage data 4 data 3 data 2 data 1 data 5 data 4 data 3 data 2 data 5 data 4 data 3 data 1 data 2 data 3 data 5 data 4 data 5 data 4 data 5
in the i/o interface mode with sclk output setting, the clock output automatically stops, so this flag has no meaning. note: before switching the i/o interface sclk output mode to other modes, read the scxcr register and clear the underrun flag. TMPM333FDFG/fyfg/fwfg page 249
10.13 handshake function the function of the handshake is to enable frame-by-frame data transmission by using the cts (clear to send) pin and to prevent overrun errors. this function can be enabled or disabled by scxmod0. when the cts pin is set to "high" level, the current data transmission can be completed but the next data trans- mission is suspended until the cts pin returns to the "low" level. however in this case, the inttxx interrupt is generated in the normal timing, the next transmit data is written in the transmit buffer, and it waits until it is ready to transmit data. note: ( 1) if the cts signal is set to "h" during transmission, the next data transmission is suspended after the current transmission is completed. ( 2) data transmission starts on the first falling edge of the txdclk clock after cts is set to "l". although no rts pin is provided, a handshake control function can easily implemented by assigning one bit of the port for the rts function. by setting the port to "high" level upon completion of data reception (in the receive interrupt routine), the transmit side can be requested to suspend data transmission. figure 10-8 handshake function figure 10-9 cts signal timing TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.13 handshake function page 250 transmission is suspended during this period. start bit bit 0 txd sioclk data write to transmit buffer or shift register txdclk cts 13 14 15 16 1 2 3 14 15 16 1 2 3 a b txd cts rxd rts (any port) transmit side receive side
10.14 interrupt/error generation timing 10.14.1 rx interrupts figure 10-10 shows the data flow of receive operation and the route of read. figure 10-10 receive buffer/fifo configuration diagram 10.14.1.1 single buffer / double buffer rx interrupts are generated at the time depends on the transfer mode and the buffer configurations, which are given as follows. buffer configurations uart modes io interface modes single buffer ? ?immediately after the raising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) double buffer ?around the center of the first stop bit ?immediately after the raising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) ?on data transfer from the shift register to the buffer by reading buffer. note:interrupts are not generated when an overrun error is occurred. 10.14.1.2 fifo in use of fifo, receive interrupt is generated on the condition that the following either operation and scxrfc setting are established. ? ? table 10-12 receive interrupt conditions in use of fifo scxrfc interrupt conditions "0" "the fill level of fifo" is equal to "the fill level of fifo interruption generation." "1" "the fill level of fifo" is greater than or equal to "the fill level of fifo intrruption generation." TMPM333FDFG/fyfg/fwfg page 251 4:(+(1 6jghktuvuvcig 6jgugeqpfuvcig 6jgvjktfuvcig 6jghqwtvjuvcig 4gegkxgdwhhgt 4gegkxgujkhvtgikuvgt 4:& +hvjgtgegkxgdwhhgtkugorv[ vjgfcvckuoqxgf +hvjg4:(+(1kupqvhwnn vjgfcvckuoqxgf
 4gcfkpikpvjgukpingdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfchvgttgegkxkpicnndkvu
 4gcfkpikpvjgfqwdngdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfyjgpvjgfcvckuoqxgfvq vjgtgegkxgdwhhgt
 4gcfkpikpwugvjg(+(1 ??#pkpvgttwrvkuigpgtcvgf ???yjgpvjgfcvckuoqxgfvqvjg(+(1 ???qtyjgptgcfkpivjg(+(1
10.14.2 tx interrupts figure 10-11 shows the data flow of transmit operation and the route of read. figure 10-11 transmit buffer/fifo configuration diagram 10.14.2.1 single buffer / double buffer tx interrupts are generated at the time depends on the transfer mode and the buffer configurations, which are given as follows. buffer configurations uart modes io interface modes single buffer just before the stop bit is sent immediately after the raising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) double buffer when a data is moved from the transmit buffet to the transmit shift register. note:if double buffer is enabled, a interrupt is also generated when the data is moved from the buffer to the shift register by writing to the buffer. 10.14.2.2 fifo in use of fifo, transmit interrupt is generated on the condition that the fllowing either operation and scxtfc setting are established. ? ? table 10-13 transmit interrupt conditions in use of fifo scxtfc interrupt conditions "0" "the fill level of fifo" is equal to "the fill level of fifo interruption generation." "1" "the fill level of fifo" is smaller than or equal to "the fill level of fifo intrruption generation." TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.14 interrupt/error generation timing page 252 6:(+(1 6jghktuvuvcig 6jgugeqpfuvcig 6jgvjktfuvcig 6jghqwtvjuvcig 6tcpuokvdwhhgt 6tcpuokvujkhvtgikuvgt 6:& +hvjgujkhvtgikuvgtkugorv[ vjgfcvckuoqxgf +hvjgvtcpuokvdwhhgtkugorv[ vjgfcvckuoqxgf
 9tkvkpikpvjgukpingdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfchvgtvtcpuokvvkpicnndkvu
 9tkvkpikpvjgfqwdngdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfyjgpvjgfcvckuoqxgfvq vjgvtcpuokvujkhvtgikuvgt
 9tkvkpikpwugvjg(+(1 ??#pkpvgttwrvkuigpgtcvgf ???yjgpvjgfcvckuoqxgfvqvjgvtcpuokvdwhhgt ???qtyjgpytkvkpivqvjg(+(1
10.14.3 error generation 10.14.3.1 uart mode modes 9 bits 7 bits 8 bits 7 bits+ parity 8 bits + parity framing error overrun error around the center of stop bit parity error ? around the center of parity bit 10.14.3.2 io interface mode overrun error immediately after the raising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) underrun error immediately after the rising or falling edge of the next sclk. (rising or falling is determined according to scxcr setting.) note:over-run error and under-run error have no meaning in sclk output mode. 10.15 software reset software reset is generated by writing scxmod2 as "10" followed by "01". as a result, scxmod0, scxmod1, scxmod2, scxcr are initialized. and the receive circuit, the transmit circuit and the fifo become initial stete. other states are maintained. TMPM333FDFG/fyfg/fwfg page 253
10.16 operation in each mode 10.16.1 mode 0 (i/o interface mode) mode 0 consists of two modes, the sclk output mode to output synchronous clock and the sclk input mode to accept synchronous clock from an external source. the following operational descriptions are for the case use of fifo is disabled. for details of fifo operation, refer to the previous sections describing receive/transmit fifo functions. 10.16.1.1 transmitting data (1) sclk output mode ? ? TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 254
figure 10-12 transmit operation in the i/o interface mode (sclk output mode) TMPM333FDFG/fyfg/fwfg page 255 bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data w rite timing sclk output bit 7 bit 0 = "0" (if double buffering is disabled) bit 0 bit 1 bit 6 txd (inttxx interrupt request) sclk output = "1" (if double buffering is enabled and there is data in buffer) bit 7 bit 0 tbemp bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data w rite timing sclk output = "1" (if double buffering is enabled and threre is no data in buffer) bit 7 tbemp transmit data w rite timing
(2) sclk input mode if double buffering is disabled (scxmod2 = "0") if the sclk is input in the condition where data is written in the transmit buffer, 8-bit data is outputted from the txd pin. when all data is output, an interrupt inttxx is generated. the next transmit data must be written before the timing point "a" as shown in figure 10-13. if double buffer is enabled (scxmod2 = "1") data is moved from the transmit buffer to the transmit shift register when the cpu writes data to the transmit buffer before the sclk input becomes active or when data transmission from the transmit shift register is completed. simultaneously, the transmit buffer empty flag scxmod2 is set to "1", and the inttxx interrupt is generated. if the sclk input becomes active while no data is in the transmit buffer, although the internal bit counter is started, an under-run error occurs and 8-bit dummy data (0xff) is sent. TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 256
figure 10-13 transmit operation in the i/o interface mode (sclk input mode) TMPM333FDFG/fyfg/fwfg page 257 bit 0 bit 1 bit 6 txd0 (inttx0 interrupt request) transmit data write timing sclk0 input (=1 falling edge mode) sclk0 input (=0 rising edge mode) bit 5 bit 7 bit 1 bit 0 a = "0" (if double buffering is disabled) bit 0 bit 1 bit 6 txd0 (inttx0 interrupt request) sclk0 input (=1 falling edge mode) sclk0 input (=0 rising edge mode) bit 5 bit 7 bit 1 bit 0 a = "1" (if double buffering is enabled and there is data in buffer2) tbemp bit 0 bit 1 bit 6 txd0 (inttx0 interrupt request) sclk0 input (=1 falling edge mode) sclk0 input (=0 rising edge mode) bit 5 bit 7 a = "1" (if double buffering is enabled and there is no data in buffer2) tbemp 1 1 perr (functions to detect under-run errors) transmit data write timing transmit data write timing
10.16.1.2 receive (1) sclk output mode the sclk output can be started by setting the receive enable bit scxmod0 to "1". ? ? TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 258
figure 10-14 receive operation in the i/o interface mode (sclk output mode) TMPM333FDFG/fyfg/fwfg page 259 bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output bit 7 bit 0 = "0" (if double buffering is disable g bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output bit 0 = "1" (if double buffering is enabled and data is read from buffer) bit 7 bit 7 rbfll bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output = "1" (if double buffering is enabled and data cannot be read from buffer) bit 7 bit 7 rbfll
(2) sclk input mode in the sclk input mode, receiving double buffering is always enabled, the received frame can be moved to the receive buffer from the shift register, and the receive buffer can receive the next frame successively. the intrx receive interrupt is generated each time received data is moved to the receive buffer. figure 10-15 receive operation in the i/o interface mode (sclk input mode) TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 260 bit 0 bit 1 bit 6 rxd (intrxx interrupt request) receive data read timing sclk input (=?1? falling mode) sclk input (=?0? rising mode) bit 5 bit 7 bit 0 if data is read from buffer rbfll bit 0 bit 1 bit 6 rxd (intrxx interrupt request) receive data read timing sclk input (=?1? falling mode) sclk input (=?0? rising mode) bit 5 bit 7 bit 0 if data cannot be read from buffer rbfll oerr
10.16.1.3 transmit and receive (full-duplex) (1) sclk output mode if scxmod2 is set to "0" and the double buffers are disabled sclk is outputted when the cpu writes data to the transmit buffer. subsequently, 8 bits of data are shifted into receive buffer and the intrxx receive interrupt is generated. concurrently, 8 bits of data written to the transmit buffer are outputted from the txd pin, the inttxx transmit interrupt is generated when transmission of all data bits has been completed. then, the sclk output stops. the next round of data transmission and reception starts when the data is read from the receive buffer and the next transmit data is written to the transmit buffer by the cpu. the order of reading the receive buffer and writing to the transmit buffer can be freely determined. data transmission is resumed only when both conditions are satisfied. if scxmod2 is set to "1" and the double buffers are enabled sclk is outputted when the cpu writes data to the transmit buffer. 8 bits of data are shifted into the receive shift register, moved to the receive buffer, and the intrxx interrupt is generated. while 8 bits of data is received, 8 bits of transmit data is outputted from the txd pin. when all data bits are sent out, the inttxx interrupt is generated and the next data is moved from the transmit buffer to the transmit shift register. if the transmit buffer has no data to be moved to the transmit buffer (scxmod2 = 1) or when the receive buffer is full (scxmod2 = 1), the sclk output is stop- ped. when both conditions, receive data is read and transmit data is written, are satisfied, the sclk output is resumed and the next round of data transmission and reception is started. TMPM333FDFG/fyfg/fwfg page 261
figure 10-16 transmit/receive operation in the i/o interface mode (sclk output mode) TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 262 bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 bit 1 bit 0 = "0" (if double buffering is disabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 = "1" (if double buffering is enabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 (intrxx interrupt request)
(2) sclk input mode if scxmod2 is set to "0" and the transmit double buffer is disabled when receiving data, double buffer is always enabled regardless of the scxmod2 settings. 8-bit data written in the transmit buffer is outputted from the txd pin and 8 bit of data is shifted into the receive buffer when the sclk input becomes active.the inttxx interrupt is generated upon completion of data transmission. the inttrxx interrupt is generated when the data is moved from shift register to receive buffer after completion of data reception. note that transmit data must be written into the transmit buffer before the sclk input for the next frame (data must be written before the point a in figure 10-17). data must be read before completing reception of the next frame data. if scxmod2 is set to "1" and the double buffer is enabled. the interrupt intrxx is generated at the timing the transmit buffer data is moved to the transmit shift register after completing data transmission from the transmit shift register. at the same time, data received is shifted to the shift register, it is moved to the receive buffer, and the intrxx interrupt is generated. note that transmit data must be written into the transmit buffer before the sclk input for the next frame (data must be written before the point a in figure 10-17). data must be read before completing reception of the next frame data. upon the sclk input for the next frame, transmission from transmit shift register (in which data has been moved from transmit buffer) is started while receive data is shifted into receive shift register simultaneously. if data in receive buffer has not been read when the last bit of the frame is received, an overrun error occurs. similarly, if there is no data written to transmit buffer when sclk for the next frame is input, an under-run error occurs. TMPM333FDFG/fyfg/fwfg page 263
figure 10-17 transmit/receive operation in the i/o interface mode (sclk input mode) TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 264 bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 a = "0" (if double buffering is disabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled with no errors) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled with error generation) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) perr(under-run errors) a a
10.16.2 mode 1 (7-bit uart mode) the 7-bit uart mode can be selected by setting the serial mode control register (scxmod) to "01". in this mode, parity bits can be added to the transmit data stream; the serial mode control register (scxcr) controls the parity enable/disable setting. when is set to "1" (enable), either even or odd parity may be selected using the scxcr bit. the length of the stop bit can be specified using scxmod2. the following table shows the control register settings for transmitting in the following data format. clocking condi- tions system clock : high-speed (fc) high-speed clock gear: x1 (fc) prescaler clock: fperiph/2 (fperiph = fsys) 7 6 5 4 3 2 1 0 scxmod0 x 0 - 0 0 1 0 1 set 7-bit uart mode scxcr x 1 1 x x x 0 0 even parity enabled scxbrcr 0 0 1 0 0 1 0 0 set 2400bps scxbuf * * * * * * * * set transmit data x : dont care - : no change 10.16.3 mode 2 (8-bit uart mode) the 8-bit uart mode can be selected by setting scxmod0 to "10." in this mode, parity bits can be added and parity enable/disable is controlled using scxcr. if = "1" (enabled), either even or odd parity can be selected using scxcr. the control register settings for receiving data in the following format are as follows: clocking condi- tions system clock: high-speed (fc) high-speed clock gear: x1 prescaler clock: fperiph/2 (fperiph = fsys) TMPM333FDFG/fyfg/fwfg page 265 stop start bit 0 1 2 3 4 5 6 7 odd parity recetion direction (reception rate of9600 bps @fc = 9.8304 mhz) stop start bit 0 1 2 3456 even parity 7udqvplvvlrqgluhfwlrq ( 7udqvplvvlrqudwhri bps @fc = 9.8304 mhz)
7 6 5 4 3 2 1 0 scxmod0 x 0 0 0 1 0 0 1 set 8-bit uart mode scxcr x 0 1 x x x 0 0 odd parity enabled scxbrcr 0 0 0 1 0 1 0 0 set 9600bps scxmod0 - - 1 - - - - - reception enabled x : dont care - : no change 10.16.4 mode 3 (9-bit uart mode) the 9-bit uart mode can be selected by setting scxmod0 to "11." in this mode, parity bits must be disabled (scxcr = "0"). the most significant bit (9th bit) is written to bit 7 of the serial mode control register 0 (scxmod0) for transmitting data. the data is stored in bit 7 of the serial control register scxcr. when writing or reading data to/from the buffers, the most significant bit must be written or read first before writing or reading to/from scxbuf. the stop bit length can be specified using scxmod2. 10.16.4.1 wakeup function in the 9-bit uart mode, slave controllers can be operated in the wake-up mode by setting the wake-up function control bit scxmod0 to "1." in this case, the interrupt intrxx will be generated only when scxcr is set to "1". note:the txd pin of the slave controller must be set to the open drain output mode using the ode register. figure 10-18 serial links to use wake-up function TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 266 txd rxd master txd rxd slave1 txd rxd slave2 txd rxd slave3
10.16.4.2 protocol 1. select the 9-bit uart mode for the master and slave controllers. 2. set scxmod to "1" for the slave controllers to make them ready to receive data. 3. the master controller is to transmit a single frame of data that includes the slave controller select code (8 bits). in this, the most significant bit (bit 8) must be set to "1". 4. each slave controller receives the above data frame; if the code received matches with the con- troller's own select code, it clears the wu bit to "0". 5. the master controller transmits data to the designated slave controller (the controller of which scxmod bit is cleared to "0"). in this, the most significant bit (bit 8) must be set to "0". 6. the slave controllers with the bit set to "1" ignore the receive data because the most significant bit (bit 8) is set to "0" and thus no interrupt (intrxx) is generated.also, the slave controller with the bit set to "0" can transmit data to the master controller to inform that the data has been successfully received. TMPM333FDFG/fyfg/fwfg page 267 stop start bit 0 1 2 3 4 5 6 7 bit 8 data "0" stop start bit 0 1 2 3 4 5 6 78 select code of the slave controller "1"
TMPM333FDFG/fyfg/fwfg 10. serial channel (sio/uart) 10.16 operation in each mode page 268
11. serial bus interface (i2c/sio) the TMPM333FDFG/fyfg/fwfg contains three serial bus interface (i2c/sio) channels, in which the following two operating modes are included: ? ? table 11-1 port settings for using serial bus interface channel operating mode pin port function regis- ter port output control register port input control register port open drain output control register sbi0 i2c bus mode scl0 :pg1 sda0 :pg0 pgfr1[1:0] = "11" pgcr[1:0] = "11" pgie[1:0] = "11" pgod[1:0] = "11" sio mode sck0 :pg2 si0 :pg1 so0 :pg0 pgfr1[2:0] = "111" pgcr[2:0] = "101" (sck0 output) pgcr[2:0] = "001"(sck0 input) pgie[2:0] = "010" (sck0 output) pgie[2:0] = "110" (sck0 input) pgod[2:0] = "xxx" sbi1 i2c bus mode scl1 :pf5 sda1 :pf4 pffr1[5:4] = "11" pfcr[5:4] = "11" pfie[5:4] = "11" pfod[5:4] = "11" sio mode sck1 :pf6 si1 :pf5 so1 :pf4 pffr1[6:4] = "111" pfcr[6:4] = "101" (sck1output) pfcr[6:4] = "001" (sck1 input) pfie[6:4] = "010" (sck1 output) pfie[6:4] = "110" (sck1 input) pfod[6:4] = "xxx" sbi2 i2c bus mode scl2 :pg5 sda2 :pg4 pgfr1[5:4] = "11" pgcr[5:4] = "11" pgie[5:4] = "11" pgod[5:4] = "11" sio mode sck2 :pg6 si2 :pg5 so2 :pg4 pgfr1[6:4] = "111" pgcr[6:4] = "101" (sck2 output) pgcr[6:4] = "001" (sck2 input) pgie[6:4] = "010" (sck2 output) pgie[6:4] = "110" (sck2 input) pgod[6:4] = "xxx" note:x: don't care TMPM333FDFG/fyfg/fwfg page 269
11.1 configuration the configuration is shown in figure 11-1 . figure 11-1 (i2c/sio) block interface TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.1 configuration page 270 control register2/ status register control register0, 1 baud rate register0 i2c bus address register data buffer register sckx sbixcr2/ sbixsr sbixdbr sbixcr0, 1 sbixbr0 shift register noise canceller sio data control transfer control circuit noise canceller i2c bus clock synchroni- zation + control sio clock control frequency divider fsys i2c bus data control input/ output control sda so si scl sck intsbix interrupt request sdax sox sclx six sbixi2car
11.2 register the following registers control the serial bus interface and provide its status information for monitoring. the register below performs different functions depending on the mode. for details, refer to "11.4 control registers in the i2c bus mode" and "11.7 control register of sio mode". 11.2.1 registers for each channel the tables below show the registers and register addresses for each channel. channel x base address channel0 0x4002_0000 channel1 0x4002_0020 channel2 0x4002_0040 register name (x=0 to 2) address(base+) control register 0 sbixcr0 0x0000 control register 1 sbixcr1 0x0004 data buffer register sbixdbr 0x0008 i2c bus address register sbixi2car 0x000c control register 2 sbixcr2 (writing) 0x0010 status register sbixsr (reading) baud rate register 0 sbixbr0 0x0014 TMPM333FDFG/fyfg/fwfg page 271
11.3 i2c bus mode data format figure 11-2 shows the data formats used in the i2c bus mode. figure 11-2 i2c bus mode data formats TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.3 i2c bus mode data format page 272 8 bit once repeated 1 to 8 bits 1 1 s a c k a c k a c k p slave address data data 1 to 8 bits 1 r / w 8 bit once once repeated repeated 1 to 8 bits 1 1 1 s a c k a c k a c k p slave address data data slave address 1 to 8 bits 1 r / w 8 bit a c k r / w 8 bit once repeated 1 to 8 bits 1 1 s a c k a c k a c k p s data data data 1 to 8 bits 1 (a) addressing format (b) addressing format (with repeated start condition) (c) free data format (master-transmitter to slave-receiver) note) s : start condition r/w : direction bit ack : acknowledge bit p : stop condition
11.4 control registers in the i2c bus mode the following registers control the serial bus interface in the i2c bus mode and provide its status information for monitoring. 11.4.1 sbixcr0(control register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol sbien - - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7 sbien r/w serial bus interface operation 0:disable 1:enable to use the serial bus interface, enable this bit first. since all clocks except sbixcr0 stop if this bit is disabled, power consumption can be reduced by disabling this bit. if this bit is disabled after its been enabled once, the settings of each register are retained. 6-0 - r read as 0. TMPM333FDFG/fyfg/fwfg page 273
11.4.2 sbixcr1(control register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol bc ack - sck2 sck1 sck0 / swrmon after reset 0 0 0 0 1 0 0 1(note3) bit bit symbol type function 31-8 - r read as 0. 7-5 bc[2:0] r/w select the number of bits per transfer (note 1) when = 0 when = 1 number of clock cycles data length number of clock cycles data length 000 8 8 9 8 001 1 1 2 1 010 2 2 3 2 011 3 3 4 3 100 4 4 5 4 101 5 5 6 5 110 6 6 7 6 111 7 7 8 7 4 ack r/w master mode 0: acknowledgement clock pulse is not generated. 1: acknowledgement clock pulse is generated. slave mode 0: acknowledgement clock pulse is not counted. 1: acknowledgement clock pulse is counted. 3 - r read as 1. 2-1 sck[2:1] r/w select internal scl output clock frequency (note 2). 0 sck[0] w 000 n = 5 385 khz 001 n = 6 294 khz 010 n = 7 200 khz 011 n = 8 122 khz 100 n = 9 68 khz 101 n = 10 36 khz 110 n = 11 19 khz 111 reserved swrmon r on reading : software reset status monitor 0:software reset operation is in progress. 1:software reset operation is not in progress. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.4 control registers in the i2c bus mode page 274 system clock: fsys ( = 40 mhz) clock gear : fc/1 frequency = [hz] fsys 2 n + 72
note 1: clear to "000" before switching the operation mode to the sio mode. note 2: for details on the scl line clock frequency, refer to "11.5.1 serial clock". note 3: after a reset, the bit is read as "1". however, if the sio mode is selected at the sbixcr2 register, the initial value of the bit is "0". note 4: the initial value for selecting a frequency is =000 and is independent of the read initial value. TMPM333FDFG/fyfg/fwfg page 275
11.4.3 sbixcr2(control register 2) this register serves as sbixsr register by reading it. 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol mst trx bb pin sbim swrst after reset 0 0 0 1 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7 mst w select master/slave 0: slave mode 1: master mode 6 trx w select transmit/ receive 0: receive 1: transmit 5 bb w start/stop condition generation 0: stop condition generated 1: start condition generated 4 pin w clear intsbix interrupt request 0: ? 1: clear interrupt request 3-2 sbim[1:0] w select serial bus interface operating mode (note) 00: port mode (disables a serial bus interface output) 01: sio mode 10: i2c bus mode 11: reserved 1-0 swrst[1:0] w software reset generation write "10" followed by "01" to generate a reset. note: make sure that modes are not changed during a communication session.ensure that the bus is free before switching the operating mode to the port mode. ensure that the port is at the "high" level before switching the operating mode from the port mode to the i2c bus or clock-synchro- nous 8-bit sio mode. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.4 control registers in the i2c bus mode page 276
11.4.4 sbixsr (status register) this register serves as sbixcr2 by writing to it. 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol mst trx bb pin al aas ado lrb after reset 0 0 0 1 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7 mst r master/slave selection monitor 0: slave mode 1: master mode 6 trx r transmit/receive selection monitor 0: receive 1: transmit 5 bb r i2c bus state monitor 0: free 1: busy 4 pin r intsbix interrupt request monitor 0:interrupt request generated 1: interrupt request cleared 3 al r arbitration lost detection 0: ? 1:detected 2 aas r slave address match detection 0: ? 1: detected (this bit is set when the general call is detected as well.) 1 ado r general call detection 0: ? 1:detected 0 lrb r last received bit monitor 0:last received bit "0" 1:last received bit "1" TMPM333FDFG/fyfg/fwfg page 277
11.4.5 sbixbr0(serial bus interface baud rate register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - i2sbi - - - - - - after reset 1 0 1 1 1 1 1 0 bit bit symbol type function 31-8 - r read as 0. 7 - r read as 1. 6 i2sbi r/w operation at the idle mode 0: stop 1: operate 5-1 - r read as 1. 0 - r/w be sure to write "0". 11.4.6 sbixdbr (serial bus interface data buffer register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol db after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7-0 db[7:0] r (receive)/ w (transmit) receive data / transmit data note 1: the transmission data must be written in to the register from the msb (bit 7). the received data is stored in the lsb. note 2: since sbixi2car has independent buffers for writing and reading, a written data cannot be read. thus, read- modify-write instructions, such as bit manipulation, cannot be used. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.4 control registers in the i2c bus mode page 278
11.4.7 sbixi2car (i2cbus address register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol sa als after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7-1 sa[6:0] r/w set the slave address when the sbi acts as a slave device. 0 als r/w specify address recognition mode. 0: recognize its slave address. 1: do not recognize its slave address (free-data format). note 1: please set the bit 0 of i2c bus address register sbixi2car to "0", except when you use a free data format. it operates as a free data format when setting it to "1". selecting the master fixes to transmission. selecting the slave fixes to reception. note 2: do not set sbixi2car to "0x00" in slave mode. (if sbixi2car is set to "0x00", its recognized that the slave address matches the start byte ("0x01") of the i2c standard received in slave mode.) TMPM333FDFG/fyfg/fwfg page 279
11.5 control in the i2c bus mode 11.5.1 serial clock 11.5.1.1 clock source sbixcr1 specifies the maximum frequency of the serial clock to be output from the scl pin in the master mode. figure 11-3 clock source note: the maximum speeds in the standard and high-speed modes are specified to 100khz and 400khz respectively following the communications standards. notice that the internal scl clock frequency is determined by the fsys used and the calculation formula shown above. 11.5.1.2 clock synchronization the i2c bus is driven by using the wired-and connection due to its pin structure. the first master that pulls its clock line to the "low" level overrides other masters producing the "high" level on their clock lines. this must be detected and responded by the masters producing the "high" level. clock synchronization assures correct data transfer on a bus that has two or more master. for example, the clock synchronization procedure for a bus with two masters is shown below. figure 11-4 example of clock synchronization at the point a, master a pulls its internal scl output to the "low" level, bringing the scl bus line to the "low" level. master b detects this transition, resets its "high" level period counter, and pulls its internal scl output level to the "low" level. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.5 control in the i2c bus mode page 280 wait for ?high?level period counting reset ?high?level period counting start ?high? level period counting abc internal scl output (master a) internal scl output (master b) scl line 1/fscl t low t high t low = 2 n-1 /fsys + 58/fsys t high = 2 n-1 /fsys + 14/fsys fscl = 1/(t low + t high ) = 2 n + 72 fsys sbixcr1 n 000 001 010 011 100 101 110 5 6 7 8 9 10 11
master a completes counting of its "low" level period at the point b, and brings its internal scl output to the "high" level. however, master b still keeps the scl bus line at the "low" level, and master a stops counting of its "high" level period counting.after master a detects that master b brings its internal scl output to the "high" level and brings the scl bus line to the "high" level at the point c, it starts counting of its "high" level period. after that master finishes counting the "high" level period, the master pulls the scl pin to "low" and the scl bus line becomes "low". this way, the clock on the bus is determined by the master with the shortest "high" level period and the master with the longest "low" level period among those connected to the bus. 11.5.2 setting the acknowledgement mode setting sbixcr1 to "1" selects the acknowledge mode.when operating as a master, the sbi adds one clock for acknowledgment signal. in slave mode, the clock for acknowledgement signals is counted. in transmitter mode, the sbi releases the sdax pin during clock cycle to receive acknowledgement signals from the receiver. in receiver mode, the sbi pulls the sdax pin to the "low" level during the clock cycle and generates acknowl- edgement signals. also in slave mode, if a general-call address is received, the sbi pulls the sdax pin to the "low" level during the clock cycle and generates acknowledgement signals. by setting to "0", the non-acknowledgment mode is activated. when operating as a master, the sbi does not generate clock for acknowledgement signals. in slave mode, the clock for acknowledgement signals is counted. 11.5.3 setting the number of bits per transfer sbixcr1 specifies the number of bits of the next data to be transmitted or received. under the start condition, is set to "000", causing a slave address and the direction bit to be trans- ferred in a packet of eight bits. at other times, keeps a previously programmed value. 11.5.4 slave addressing and address recognition mode setting "0" to sbixi2car and a slave address in sbixi2car sets addressing format, and then the sbi recognizes a slave address transmitted by the master device and receives data in the addressing format. if is set to "1", the sbi does not recognize a slave address and receives data in the free data format. in the case of free data format, a slave address and a direction bit are not recognized; they are recognized as data immediately after generation of the start condition. 11.5.5 operating mode the setting of sbixcr2 controls the operating mode. to operate in i2c mode, ensure that the serial bus interface pins are at "high" level before setting to "10". also, ensure that the bus is free before switching the operating mode to the port mode. TMPM333FDFG/fyfg/fwfg page 281
11.5.6 configuring the sbi as a transmitter or a receiver setting sbixcr2 to "1" configures the sbi as a transmitter. setting to "0" configures the sbi as a receiver. at the slave mode: ? ? ? 11.5.7 configuring the sbi as a master or a slave setting sbixcr2 to "1" configures the sbi to operate as a master device. setting to "0" configures the sbi as a slave device. is cleared to "0" by the hardware when it detects the stop condition on the bus or the arbitration lost. 11.5.8 generating start and stop conditions when sbixsr is "0", writing "1" to sbixcr2 causes the sbi to start a sequence for generating the start condition and to output the slave address and the direction bit prospectively written in the data buffer register. must be set to "1" in advance. figure 11-5 generating the start condition and a slave address when is "1", writing "1" to and "0" to causes the sbi to start a sequence for generating the stop condition on the bus. the contents of should not be altered until the stop condition appears on the bus. if scl bus line is pulled "low" by other devices when the stop condition is generated, the stop condition is generated after the scl line is released. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.5 control in the i2c bus mode page 282 slave address and direction bit sclx pin sdax pin start condition acknowledgement signal a6 a5 23456789 a4 a3 a2 a1 a0 r/w 1
figure 11-6 generating the stop condition sbixsr can be read to check the bus state. is set to "1" when the start condition is detected on the bus (the bus is busy), and cleared to "0" when the stop condition is detected (the bus is free). 11.5.9 interrupt service request and release in master mode, a serial bus interface request (intsbix) is generated when the transfer of the number of clock cycles set by and is completed. in slave mode, intsbix is generated under the following conditions. ? ? ? note:when arbitration is lost in master mode, is not cleared to "0" if the slave address does not match (intsbix is generated). 11.5.10 arbitration lost detection monitor the i2c bus has the multi-master capability (there are two or more masters on a bus), and requires the bus arbitration procedure to ensure correct data transfer. a master that attempts to generate the start condition while the bus is busy loses bus arbitration, with no start condition occurring on the sda and scl lines.the i2c-bus arbitration takes place on the sda line. the arbitration procedure for two masters on a bus is shown below. up until the point a, master a and master b output the same data. at the point a, master a outputs the "low" level and master b outputs the "high" level. TMPM333FDFG/fyfg/fwfg page 283 scl line sda line stop condition
then master a pulls the sda bus line to the "low" level because the line has the wired-and connection. when the scl line goes high at the point b, the slave device reads the sda line data, i.e., data transmitted by master a. at this time, data transmitted by master b becomes invalid. this condition of master b is called "arbitration lost". master b releases its sda pin, so that it does not affect the data transfer initiated by another master. if two or more masters have transmitted exactly the same first data word, the arbitration procedure continues with the second data word. figure 11-7 lost arbitration a master compares the sda bus line level and the internal sda output level at the rising of the scl line. if there is a difference between these two values, arbitration lost occurs and sbixsr is set to "1". when is set to "1", sbixsr are cleared to "0", causing the sbi to operate as a slave receiver.therefore, the serial bus interface circuit stops the clock output during data transfer after is set to "1". is cleared to "0" when data is written to or read from sbixdbr or data is written to sbixcr2. figure 11-8 example of master b lost arbitration (d7a = d7b, d6a = d6b) TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.5 control in the i2c bus mode page 284 internal scl output access to sbixdbr or sbixcr2 internal sda output internal scl output internalsda output d7a d6a d5a d4a d7b d6b d3a d2a d1a d6a' d7a' d5a' d4a' d0a 1234 1234 56789 1234 mastera masterb clock output dstops here internal sda output is fixed to "high"level . due to arbitration lost of master b. ab scl (line) internal sda output (mastera) internal sda output(master b) sda line loses arbitration and sets the internal sda output to ?1?.
11.5.11 slave address match detection monitor when the sbi operates as a slave device in the address recognition mode (sbixi2car="0"), sbixsr is set to "1" on receiving the general-call address or the slave address that matches the value specified at sbixi2car. when is "1", is set to "1" when the first data word has been received. is cleared to "0" when data is written to or read from sbixdbr. 11.5.12 general-call detection monitor when the sbi operates as a slave device, sbixsr is set to "1" when it receives the general-call address; i.e., the eight bits following the start condition are all zeros. is cleared to "0" when the start or stop condition is detected on the bus. 11.5.13 last received bit monitor sbixsr is set to the sda line value that was read at the rising of the scl line. in the acknowledgment mode, reading sbixsr immediately after generation of the intsbix interrupt request causes ack signal to be read. 11.5.14 data buffer register (sbixdbr) reading or writing sbixdbr initiates reading received data or writing transmitted data. when the sbi is acting as a master, setting a slave address and a direction bit to this register generates the start condition. 11.5.15 baud rate register (sbixbr0) the sbixbr0 register determines if the sbi operates or not when it enters the idle mode. this register must be programmed before executing an instruction to switch to the standby mode. 11.5.16 software reset if the serial bus interface circuit locks up due to external noise, it can be initialized by using a software reset. writing "10" followed by "01" to sbixcr2 generates a reset signal that initializes the serial bus interface circuit. after a reset, all control registers and status flags are initialized to their reset values. when the serial bus interface is initialized, is automatically cleared to "0". note:a software reset causes the sbi operating mode to switch from the i2c mode to the port mode. TMPM333FDFG/fyfg/fwfg page 285
11.6 data transfer procedure in the i2c bus modei2c 11.6.1 device initialization first, program sbixcr1. writing "000" to sbixcr1 at the time. next, program sbixi2car by specifying a slave address at and an address recognition mode at . ( must be cleared to "0" when using the addressing format). to configure the serial bus interface as a slave receiver, ensure that the serial bus interface pin is at "high" first. then write "0" to sbixcr2, "1" to , "10" to and "0" to the bit 1 and 0. note:initialization of the serial bus interface circuit must be completed within a period that any device does not generate start condition after all devices connected to the bus were initialized. if this rule is not followed, data may not be received correctly because other devices may start transfer before the initialization of the serial bus interface circuit is completed. 7 6 5 4 3 2 1 0 sbixcr1 0 0 0 x 0 x x x specifies ack and scl clock. sbixi2car x x x x x x x x specifies a slave address and an address recognition mode. sbixcr2 0 0 0 1 1 0 0 0 configures the sbi as a slave receiver. note:x; dont care 11.6.2 generating the start condition and a slave address 11.6.2.1 master mode in the master mode, the following steps are required to generate the start condition and a slave address. first, ensure that the bus is free ( = "0"). then, write "1" to sbixcr1 to select the acknowl- edgment mode. write to sbixdbr a slave address and a direction bit to be transmitted. when = "0", writing "1111" to sbixcr2 generates the start condition on the bus. following the start condition, the sbi generates nine clocks from the scl pin. the sbi outputs the slave address and the direction bit specified at sbixdbr with the first eight clocks, and releases the sda line in the ninth clock to receive an acknowledgment signal from the slave device. the intsbix interrupt request is generated on the falling of the ninth clock, and is cleared to "0". in the master mode, the sbi holds the scl line at the "low" level while is = "0". changes its value according to the transmitted direction bit at generation of the intsbix interrupt request, provided that an acknowledgment signal has been returned from the slave device. note:to output salve address, check with software that the bus is free before writing to sbixdbr. if this rule is not followed, data being output on the bus may get ruined. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.6 data transfer procedure in the i2c bus modei2c page 286
settings in main routine 7 6 5 4 3 2 1 0 reg. sbixsr reg. reg. e 0x20 if reg. 0x00 ensures that the bus is free. then sbixcr1 x x x 1 0 x x x selects the acknowledgement mode. sbixdr1 x x x x x x x x specifies the desired slave address and direction. sbixcr2 1 1 1 1 1 0 0 0 generates the start condition. example of intsbi0 interrupt routine clears the interrupt request. processing end of interrupt 11.6.2.2 slave mode in the slave mode, the sbi receives the start condition and a slave address. after receiving the start condition from the master device, the sbi receives a slave address and a direction bit from the master device during the first eight clocks on the scl line. if the received address matches its slave address specified at sbixi2car or is equal to the general-call address, the sbi pulls the sda line to the "low" level during the ninth clock and outputs an acknowledgment signal. the intsbix interrupt request is generated on the falling of the ninth clock, and is cleared to "0". in the slave mode, the sbi holds the scl line at the "low" level while is "0". figure 11-9 generation of the start condition and a slave address TMPM333FDFG/fyfg/fwfg page 287 sclx pin sdax pin intsbix interrupt request start condition slave address + direction bit acknowledgement from slave device master output slave output a6 a5 23456789 a4 a3 a2 a1 a0 ack r/w 1
11.6.3 transferring a data word at the end of a data word transfer, the intsbix interrupt is generated to test to determine whether the sbi is in the master or slave mode. 11.6.3.1 master mode ( = "1") test to determine whether the sbi is configured as a transmitter or a receiver. (1) transmitter mode ( = "1") test . if is "1", that means the receiver requires no further data. the master then generates the stop condition as described later to stop transmission. if is "0", that means the receiver requires further data.if the next data to be transmitted has eight bits, the data is written into sbixdbr. if the data has different length, and are programmed and the transmit data is written into sbixdbr.writing the data makes to "1", causing the scl pin to generate a serial clock for transferring a next data word, and the sda pin to transfer the data word. after the transfer is completed, the intsbix interrupt request is generated, is cleared to "0", and the scl pin is pulled to the "low" level. to transmit more data words, test again and repeat the above procedure. intsbix interrupt if mst = 0 then go to the slave-mode processing. if trx = 0 then go to the receiver-mode processing. if lrb = 0 then go to processing for generating the stop condition. sbixcr1 x x x x 0 x x x specifies the number of bits to be transmitted and specify whether ack is required. sbixdbr x x x x x x x x writes the transmit data. end of interrupt processing. note: x; dont care TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.6 data transfer procedure in the i2c bus modei2c page 288
figure 11-10 = "000",= "1" (transmitter mode) (2) receiver mode ( = "0") if the next data to be transmitted has eight bits, the transmit data is written into sbixdbr. if the data has different length, and are programmed and the received data is read from sbixdbr to release the scl line. (the data read immediately after transmission of a slave address is undefined.)on reading the data, is set to "1", and the serial clock is output to the scl pin to transfer the next data word.in the last bit, when the acknowledgment signal becomes the "low" level, "0" is output to the sda pin. after that, the intsbix interrupt request is generated, and is cleared to "0", pulling the scl pin to the "low" level.each time the received data is read from sbixdbr, one-word transfer clock and an acknowledgement signal are output. figure 11-11 = "000",= "1" (receiver mode) to terminate the data transmission from the transmitter, must be cleared to "0" immediately before reading the data word second to last. this disables generation of an acknowledgment clock for the last data word. when the transfer is completed, an interrupt request is generated. after the interrupt processing, must be set to "001" and the data must be read so that a clock is generated for 1-bit transfer. at this time, the master receiver holds the sda bus line at the "high" level, which signals the end of transfer to the transmitter as an acknowledgment signal. TMPM333FDFG/fyfg/fwfg page 289 sclx pin read the received data sdax pin intsbix interrupt request acknowledgment signal to transmitter master output slave output d7 d6 23456789 d5 d4 d3 d2 d1 ack next d7 d0 1 sclx pin write to sbixdbr sdax pin intsbix interrupt request d7 d6 23456789 d5 d4 d3 d2 d1 d0 ack 1 acknowledgement from receiver master output slave output
in the interrupt processing for terminating the reception of 1-bit data, the stop condition is generated to terminate the data transfer. figure 11-12 terminating data transmission in the master receiver mode example: when receiving n data word intsbix interrupt (after data transmission) 7 6 5 4 3 2 1 0 sbixcr1 x x x x 0 x x x sets the number of bits of data to be received and specify whether ack is required. reg. sbixdbr reads dummy data. end of interrupt intsbix interrupt (first to (n-2)th data reception) 7 6 5 4 3 2 1 0 reg. sbixdbr reads the first to (n-2)th data words. end of interrupt intsbix interrupt ((n-1)th data reception) 7 6 5 4 3 2 1 0 sbixcr1 x x x 0 0 x x x disables generation of acknowledgement clock. reg. sbixdbr reads the (n-1)th data word. end of interrupt intsbix interrupt (nth data reception) 7 6 5 4 3 2 1 0 sbixcr1 0 0 1 0 0 x x x disables generation of acknowledgement clock. reg. sbixdbr reads the nth data word. end of interrupt intsbix interrupt (after completing data reception) processing to generate the stop condition. terminates the data transmission. end of interrupt note:x; dont care TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.6 data transfer procedure in the i2c bus modei2c page 290 sclx pin sdax pin intsbix interrupt request d7 d6 2 9 3456781 d5 d4 d2 d3 d1 d0 1 read receive data aftwer clear to ?0? read receive data after set to ?001?. acknowlegment signal to transmitter ?high? master output slave output
11.6.3.2 slave mode ( = "0") in the slave mode, the sbi generates the intsbix interrupt request on four occasions: 1) when the sbi has received any slave address from the master. 2) when the sbi has received a general-call address. 3) when the received slave address matches its address. 4) when a data transfer has been completed in response to a general-call. also, if the sbi detects arbitration lost in the master mode, it switches to the slave mode. upon the completion of data word transfer in which arbitration lost is detected, the intsbix interrupt request is generated, is cleared to "0", and the scl pin is pulled to the "low" level. when data is written to or read from sbixdbr or when is set to "1", the sclx pin is released after a period of t low . in the slave mode, the normal slave mode processing or the processing as a result of arbitration lost is carried out. sbixsr, , and are tested to determine the processing required. "table 11-2 processing in slave mode"shows the slave mode states and required processing. example: when the received slave address matches the sbi's own address and the direction bit is "1" in the slave receiver mode. intsbix interrupt if trx = 0 then go to other processing. if al = 0 then go to other processing. if aas = 0 then go to other processing. sbixcr1 x x x 1 0 x x x sets the number of bits to be transmitted. sbixdbr x x x x 0 x x x sets the transmit data. note:x; dont care TMPM333FDFG/fyfg/fwfg page 291
table 11-2 processing in slave mode state processing 1 1 1 0 arbitration lost is detected while the slave address was being transmitted and the sbi received a slave address with the direction bit "1" transmitted by an- other master. set the number of bits in a data word to and write the transmit data into sbixdbr. 0 1 0 in the slave receiver mode, the sbi received a slave address with the direction bit "1" transmitted by the master. 0 0 in the slave transmitter mode, the sbi has completed a transmission of one data word. test lrb. if it has been set to "1", that means the re- ceiver does not require further data. set to 1 and reset to 0 to release the bus. if has been reset to "0", that means the receiver requires further data. set the number of bits in the data word to and write the transmit data to the sbixdbr. 0 1 1 1/0 arbitration lost is detected while a slave address is being transmitted, and the sbi receives either a slave address with the direction bit "0" or a general-call ad- dress transmitted by another master. read the sbixdbr (a dummy read) to set to 1, or write "1" to . 0 0 arbitration lost is detected while a slave address or a data word is being transmitted, and the transfer is ter- minated. 0 1 1/0 in the slave receiver mode, the sbi received either a slave address with the direction bit "0" or a general- call address transmitted by the master. 0 1/0 in the slave receiver mode, the sbi has completed a reception of a data word. set the number of bits in the data word to and read the received data from sbixdbr. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.6 data transfer procedure in the i2c bus modei2c page 292
11.6.4 generating the stop condition when sbixsr is "1", writing "1" to sbixcr2 and "0" to causes the sbi to start a sequence for generating the stop condition on the bus. do not alter the contents of until the stop condition appears on the bus. if another device is holding down the scl bus line, the sbi waits until the scl line is released. after that, the sda pin goes "high", causing the stop condition to be generated. 7 6 5 4 3 2 1 0 sbixcr2 1 1 0 1 1 0 0 0 generates the stop condition. figure 11-13 generating the stop condition 11.6.5 restart procedure restart is used when a master device changes the data transfer direction without terminating the transfer to a slave device.the procedure of generating a restart in the master mode is described below. first, write sbixcr2 to "0" and write "1" to to release the bus. at this time, the sdax pin is held at the "high" level and the sclx pin is released. because no stop condition is generated on the bus, other devices recognize that the bus is busy. then, test sbixsr and wait until it becomes "0" to ensure that the sclx pin is released. next, test and wait until it becomes "1" to ensure that no other device is pulling the sclx bus line to the "low" level. once the bus is determined to be free by following the above procedures, follow the procedures described in "11.6.2 generating the start condition and a slave address"to generate the start condition. to satisfy the setup time of restart, at least 4.7s wait period (in the standard mode) must be created by the software after the bus is determined to be free. note 1: do not write to "0" when it is "0". (restart cannot be initiated.) note 2: when the master device is acting as a receiver, data transmission from the slave device which serves as a transmitter must be completed before generating a restart. to complete data transfer, slave device must receive a "high" level acknowledge signal. for this reason, before generating a TMPM333FDFG/fyfg/fwfg page 293 sclx pin "1" "1" "0" "1" sdax pin (read) stop condition
restart becomes "1", the rising edge of the scl line is not detected even = "1" is confirmed by following the restart procedure. to check the status of the scl line, read the port. 7 6 5 4 3 2 1 0 sbixcr2 0 0 0 1 1 0 0 0 releases the bus. if sbixsr 0 checks that the scl pin is released. then if sbixsr 1 checks that no other device is pulling the scl pin to the "low". then 4.7 s wait sbixcr1 x x x 1 0 x x x selects the acknowledgment mode. sbixdbr x x x x x x x x sets the desired slave address and direction. sbixcr2 1 1 1 1 1 0 0 0 generates the start condition. note:x; dont care figure 11-14 timing chart of generating a restart TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.6 data transfer procedure in the i2c bus modei2c page 294 scl pin scl(bus) "0" "0" "0" "1" sda pin start condition "1" "1" "1" "1" 4.7 ms (min.) 9
11.7 control register of sio mode the following registers control the serial bus interface in the clock-synchronous 8-bit sio mode and provide its status information for monitoring. 11.7.1 sbixcr0(control register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol sbien - - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7 sbien r/w serial bus interface operation. 0:disable 1: enable enable this bit before using the serial bus interface. if this bit is disabled, power consumption can be reduced because all clocks except sbixcr0 stop. if the serial bus interface operation is enabled and then disabled, the settings will be maintained in each register. 6-0 - r read as 0. TMPM333FDFG/fyfg/fwfg page 295
11.7.2 sbixcr1(control register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol sios sioinh siom - sck after reset 0 0 0 0 1 0 0 0(note 1) bit bit symbol type function 31-8 - r read as 0. 7 sios r/w transfer start/stop 0: stop 1: start 6 sioinh r/w transfer 0: continue 1: forced termination 5-4 siom[1:0] r/w select transfer mode 00: transmit mode 01: reserved 10:transmit/receive mode 11:receive mode 3 - r read as 1. 2-0 sck[2:0] r/w on writing : select serial clock frequency. (note 1) 000 n = 3 2.5 mhz 001 n = 4 1.25 mhz 010 n = 5 625 khz 011 n = 6 313 khz 100 n = 7 156 khz 101 n = 8 78 khz 110 n = 9 39 khz 111 ? external clock note 1: after a reset, the bit is read as "1". however, if the sio mode is selected at the sbixcr2 register, the initial value is read as "0". in this document, the value written in the column "after reset" is the value after setting the sio mode in the initial state. the descriptions of the sbixcr2 register and the sbixsr register are the same. note 2: set to "0" and to "1" before programming the transfer mode and the serial clock. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.7 control register of sio mode page 296 system clock: fsys ( = 40 mhz) clock gear: fc/1 frequency = [hz] fsys/2 2 n
11.7.3 sbixdbr (data buffer register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol db after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 - r read as 0. 7-0 db[7:0] r receive data w transmit data note 1: the transmission data must be written in to the register from the msb (bit 7). the received data is stored in the lsb. note 2: since sbixi2car has independent buffers for writing and reading, a written data cannot be read. thus, read- modify-write instructions, such as bit manipulation, cannot be used. TMPM333FDFG/fyfg/fwfg page 297
11.7.4 sbixcr2(control register 2) this register serves as sbixsr register by writing to it. 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - sbim - - after reset 1(note 1) 1(note 1) 1(note 1) 1(note 1) 0 0 1(note 1) 1(note 1) bit bit symbol type function 31-8 - r read as "0". 7-4 - r read as 1. (note 1) 3-2 sbim[1:0] w select serial bus interface operating mode (note 2) 00: port mode 01: sio mode 10: i2cbus mode 11: reserved 1-0 - r read as 1. (note 1) note 1: in this document, the value written in the column "after reset" is the value after setting the sio mode in the initial state. note 2: make sure that modes are not changed during a communication session. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.7 control register of sio mode page 298
11.7.5 sbixsr (status register) this register serves as sbixcr2 by writing to it. 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - siof sef - - after reset 1(note 1) 1(note 1) 1(note 1) 1(note 1) 0 0 1(note 1) 1(note 1) bit bit symbol type function 31-8 - r read as 0. 7-4 - r read as 1.(note 1) 3 siof r serial transfer status monitor. 0: completed 1: in progress 2 sef r shift operation status monitor 0: completed. 1: in progress 1-0 - r read as 1. (note 1) note: in this document, the value written in the column "after reset" is the value after setting the sio mode in the initial state. TMPM333FDFG/fyfg/fwfg page 299
11.7.6 sbixbr0 (baud rate register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - i2sbi - - - - - - after reset 1 0 1 1 1 1 1 0 bit bit symbol type function 31-8 - r read as 0. 7 - r read as 1. 6 i2sbi r/w operation in idle mode. 0: stop 1: operate 5-1 - r read as 1. 0 - r/w make sure to write "0". TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.7 control register of sio mode page 300
11.8 control in sio mode 11.8.1 serial clock 11.8.1.1 clock source internal or external clocks can be selected by programming sbixcr1. (1) internal clocks in the internal clock mode, one of the seven frequencies can be selected as a serial clock, which is output to the outside through the sckx pin. at the beginning of a transfer, the sckx pin output becomes the "high" level. if the program cannot keep up with this serial clock rate in writing the transmit data or reading the received data, the sbi automatically enters a wait period. during this period, the serial clock is stopped automatically and the next shift operation is suspended until the processing is completed. figure 11-15 automatic wait (2) external clock ( = "111") the sbi uses an external clock supplied from the outside to the sckx pin as a serial clock. for proper shift operations, the serial clock at the "high" and "low" levels must have the pulse widths as shown below. figure 11-16 maximum transfer frequency of external clock input TMPM333FDFG/fyfg/fwfg page 301 f sckl sckx %56 f sckh f sckl , f sckh > 4/fsys a 0 b a c sox pin output sckx pin output :ulwhwkh wudqvplwgdwd 1 2 3 7 1 2 6 7 8 1 2 3 8 $xwrpdwlfzdlw a 1 a 2 a 5 a 6 a 7 b 0 b 1 b 5 b 6 b 7 b 4 c 0 c 1 c 2
11.8.1.2 shift edge leading-edge shift is used in transmission. trailing-edge shift is used in reception. - leading-edge shift data is shifted at the leading edge of the serial clock (or the falling edge of the sckx pin input/ output). - trailing-edge shift data is shifted at the trailing edge of the serial clock (or the rising edge of the sckx pin input/ output). figure 11-17 shift edge TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.8 control in sio mode page 302 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 * 7654321 ** 765432 76543210 *** 76543 **** 7654 ***** 765 ****** 76 ******* 7 sox pin sckx pin shift register bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 10 ****** 210 ***** 0 ******* ******** 3210 **** 43210 *** 543210 ** 6543210 * 76543210 six pin sckx pin shift register (a) leading-edge (b) trailing-edge
11.8.2 transfer modes the transmit mode, the receive mode or the transmit/receive mode can be selected by programming sbixcr1. 11.8.2.1 8-bit transmit mode set the control register to the transmit mode and write the transmit data to sbixdbr. after writing the transmit data, writing "1" to sbixcr1 starts the transmission. the transmit data is moved from sbixdbr to a shift register and output to the so pin, with the least-significant bit (lsb) first, in synchronization with the serial clock. once the transmit data is transferred to the shift register, sbixdbr becomes empty, and the intsbix (buffer-empty) interrupt is generated, requesting the next transmit data. in the internal clock mode, the serial clock will be stopped and automatically enter the wait state, if next data is not loaded after the 8-bit data has been fully transmitted. the wait state will be cleared when sbixdbr is loaded with the next transmit data. in the external clock mode, sbixdbr must be loaded with data before the next data shift operation is started. therefore, the data transfer rate varies depending on the maximum latency between when the interrupt request is generated and when sbixdbr is loaded with data in the interrupt service program. at the beginning of transmission, the same value as in the last bit of the previously transmitted data is output in a period from setting sbixsr to "1" to the falling edge of sck. transmission can be terminated by clearing to "0" or setting to "1" in the intsbix interrupt service program. if is cleared, remaining data is output before transmission ends. the program checks sbixsr to determine whether transmission has come to an end. is cleared to "0" at the end of transmission. if is set to "1", the transmission is aborted immediately and is cleared to "0". when in the external clock mode, must be cleared to "0" before next data shifting. if does not be cleared to "0" before next data shifting, sbi output dummy data and stopped. 7 6 5 4 3 2 1 0 sbixcr1 0 1 0 0 0 x x x selects the transmit mode. sbixdbr x x x x x x x x writes the transmit data. sbixcr1 1 0 0 0 0 x x x starts transmission. intsbix interrupt sbixdbr x x x x x x x x writes the transmit data. TMPM333FDFG/fyfg/fwfg page 303
figure 11-18 transmit mode example: example of programming (external clock) to terminate transmission by 7 6 5 4 3 2 1 0 if sbixsr 0 recognizes the completion of the transmission. then if sck 1 recognizes "1" is set to the sck pin by monitoring the port. then sbixcr1 0 0 0 0 0 1 1 1 completes the transmission by setting = 0. TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.8 control in sio mode page 304 a 1 a 0 * a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 sox pin sbixdbr sckx pin( rxwsxw ) intsbix lqwhuuxswuhtxhvw b a (a) internal clock is cleared  :ulwhwkhwudqvplwgdwd a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 sox pin sbixdbr sckx pin(input) intsbix lqwhuqdouhtxhvw b a (b)external clock is cleared. :ulwhwkhwudqvplwgdwd *
11.8.2.2 8-bit receive mode set the control register to the receive mode. then writing "1" to sbixcr1 enables reception.data is taken into the shift register from the si pin, with the least-significant bit (lsb) first, in synchronization with the serial clock. once the shift register is loaded with the 8-bit data, it transfers the received data to sbixdbr and the intsbix (buffer-full) interrupt request is generated to request reading the received data. the interrupt service program then reads the received data from sbixdbr. in the internal clock mode, the serial clock will be stopped and automatically be in the wait state until the received data is read from sbixdbr. in the external clock mode, shift operations are executed in synchronization with the external clock. the maximum data transfer rate varies, depending on the maximum latency between generating the interrupt request and reading the received data reception can be terminated by clearing to "0" or setting to "1" in the intsbix interrupt service program. if is cleared, reception continues until all the bits of received data are written to sbixdbr. the program checks sbixsr to determine whether reception has come to an end. is cleared to "0" at the end of reception. after confirming the completion of the reception, last received data is read. if is set to "1", the reception is aborted immediately and is cleared to "0". (the received data becomes invalid, and there is no need to read it out.) note: the contents of sbixdbr will not be retained after the transfer mode is changed. the ongoing reception must be completed by clearing to "0" and the last received data must be read before the transfer mode is changed. 7 6 5 4 3 2 1 0 sbixcr1 0 1 1 1 0 x x x selects the receive mode. sbixcr1 1 0 1 1 0 x x x starts reception. intsbix interrupt reg. sbixdbr reads the received data. figure 11-19 receive mode (example: internal clock) TMPM333FDFG/fyfg/fwfg page 305 a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 six pin sbixdbr sckx pin(output) intsbix interrupt request b a clear read receive data read receive data
11.8.2.3 8-bit transmit/receive mode set the control register to the transfer/receive mode. then writing the transmit data to sbixdbr and setting sbixcr1 to "1" enables transmission and reception.the transmit data is output through the sox pin at the falling of the serial clock, and the received data is taken in through the si pin at the rising of the serial clock, with the least-significant bit (lsb) first. once the shift register is loaded with the 8-bit data, it transfers the received data to sbixdbr and the intsbix interrupt request is generated.the interrupt service program reads the received data from the data buffer register and writes the next transmit data. because sbixdbr is shared between transmit and receive operations, the received data must be read before the next transmit data is written. in the internal clock operation, the serial clock will be automatically in the wait state until the received data is read and the next transmit data is written. in the external clock mode, shift operations are executed in synchronization with the external serial clock. therefore, the received data must be read and the next transmit data must be written before the next shift operation is started.the maximum data transfer rate for the external clock operation varies depending on the maximum latency between when the interrupt request is generated and when the transmit data is written. at the beginning of transmission, the same value as in the last bit of the previously transmitted data is output in a period from setting to "1" to the falling edge of sck. transmission and reception can be terminated by clearing to "0" or setting sbixcr1 to "1" in the intsbix interrupt service program. if is cleared, transmission and reception continue until the received data is fully transferred to sbixdbr. the program checks sbixsr to determine whether transmission and reception have come to an end. is cleared to "0" at the end of transmission and reception.if is set to "1", the transmission and reception is aborted immediately and is cleared to "0". note: the contents of sbixdbr will not be retained after the transfer mode is changed. the ongoing transmission and reception must be completed by clearing to "0" and the last received data must be read before the transfer mode is changed. figure 11-20 transmit/receive mode (example: internal clock) TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.8 control in sio mode page 306 a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 sox pin c 1 c 0 c 2 c 3 c 4 c 5 cb c 6 c 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 six pin sckx pin (output) is cleard. sbixdbr intsbix interrupt request d a read the received data(c) write the transmitted data(a) read the received data(d) write the transmitted data(b) *
7 6 5 4 3 2 1 0 sbixcr1 0 1 1 0 0 x x x selects the transmit mode. sbixdbr x x x x x x x x writes the transmit data. sbixcr1 1 0 1 0 0 x x x starts reception/transmission. intsbix interrupt reg. sbixdbr reads the received data. sbixdbr x x x x x x x x writes the transmit data. 11.8.2.4 data retention time of the last bit at the end of transmission under the condition sbixcr1= "0", the last bit of the transmitted data retains the data of sck rising edge as shown below. transmit mode and transmit/receive mode are the same. figure 11-21 data retention time of the last bit at the end of transmission TMPM333FDFG/fyfg/fwfg page 307 bit 7 of end of transmitted word sox pin sckx pin t sodh = min. 4/fsys [s] bit 6
TMPM333FDFG/fyfg/fwfg 11. serial bus interface (i2c/sio) 11.8 control in sio mode page 308
12. analog/digital converter (adc) 12.1 outline a 10-bit, sequential-conversion analog/digital converter (ad converter) is built into the TMPM333FDFG/fyfg/ fwfg. this ad converter is equipped with 12 analog input channels. these 12 analog input channels (pins ain0 through ain11) are also used as input/output ports. note 1: to assure conversion accuracy, the specified value must be set to the adcbas register. note 2: if it is necessary to reduce a power current by operating the TMPM333FDFG/fyfg/fwfg in idle or stop mode and if either case shown below is applicable, you must first stop the ad converter and then execute the instruction to put the TMPM333FDFG/fyfg/fwfg into standby mode. 1. the TMPM333FDFG/fyfg/fwfg must be put into idle mode when admod1 is "0". 2.the TMPM333FDFG/fyfg/fwfg must be put into stop mode. TMPM333FDFG/fyfg/fwfg page 309
12.2 configuration figure 12-1 shows the block diagram of this ad converter. figure 12-1 ad converter block diagram TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.2 configuration page 310    admod1 channel select control circuit admod0 admod2 admod4 end busy adscn high priority ad conversion control end ad start control internal data bud internal data bus ads scan repeat interrupt interval tbxrg0 adtrg ad conversion end interrupt high priority ad conversion end interrupt intad ad conversion result register adreg08-7f ad conversion result register adregsp sample hold da converter comparator admod3, 5 ad monitor function control hpadce intadm0, 1 ad monitor function interrupt vref vrefh vrefl (avss) ain11 start busy intadhp ad conversion result register adcmp0,1 adclk 1/1 1/2 1/4 1/8 1/16 adclk fc multiplexer normal ad conversion control circuit high priority ad conversion completion interrupt ain0
12.3 registers 12.3.1 register list the control registers and addresses of the ad converter are as follows. the ad converter is controlled by the ad mode control registers (admod0 through admod5). the result of ad conversion is stored in the eight ad conversion result registers, adreg08 through adreg7f. the highest-priority conversion result is stored in the register adregsp. to assure conversion accuracy, the specified value must be set to the adcbas register. base address = 0x4003_0000 register name address (base+) conversion clock setting register adclk 0x0000 mode control register 0 admod0 0x0004 mode control register 1 admod1 0x0008 mode control register 2 admod2 0x000c mode control register 3 admod3 0x0010 mode control register 4 admod4 0x0014 mode control register 5 admod5 0x0018 conversion accuracy setting register adcbas 0x0020 reserved - 0x0024 reserved - 0x0028 conversion result register 08 adreg08 0x0030 conversion result register 19 adreg19 0x0034 conversion result register 2a adreg2a 0x0038 conversion result register 3b adreg3b 0x003c conversion result register 4c adreg4c 0x0040 conversion result register 5d adreg5d 0x0044 conversion result register 6e adreg6e 0x0048 conversion result register 7f adreg7f 0x004c conversion result register sp adregsp 0x0050 conversion result comparison register 0 adcmp0 0x0054 conversion result comparison register 1 adcmp1 0x0058 note: access to the "reserved" address is prohibited. TMPM333FDFG/fyfg/fwfg page 311
12.3.2 adcbas (conversion accuracy setting register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adcbas after reset 0 0 1 1 1 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-0 adcbas[7:0] r/w write "0x58". note:to assure conversion accuracy, the specified value (0x0000_0058) must be set to the adcbas register. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 312
12.3.3 adclk (conversion clock setting register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol tsh - adclk after reset 1 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7-4 tsh[3:0] r/w select the ad sample hold time. 1000: 8 conversion clock 1001: 16 conversion clock 1010: 24 conversion clock 1011: 32 conversion clock 0011: 64 conversion clock 1100: 128 conversion clock 1101: 512 conversion clock the setup other than those above: reserved 3 ? r read as 0. 2-0 adclk[2:0] r/w select the ad conversion clock. 000: fc 001: fc/2 010: fc/4 011: fc/8 100: fc/16 111: reserved a clock count required for conversion is 46 clocks at the minimum. examples of sample hold time and conversion time as shown as below. (example: if fc = 40mhz) sample hold time conversion time( setting) 000 (fc) 001 (fc/2) 010 (fc/4) 011 (fc/8) 100 (fc/16) 1000 (8 conversion clock) 0.2 s 1.15 s 2.3 s 4.6 s 9.2s 18.4s 1001 (16 conversion clock) 0.4 s 1.35 s 2.7s 5.4s 10.8s 21.6s 1010 (24 conversion clock) 0.6 s 1.55 s 3.1s 6.2s 12.4s 24.8s 1011 (32 conversion clock) 0.8 s 1.75 s 3.5s 7.0s 14.0s 28.0s 0011 (64 conversion clock) 1.6 s 2.55 s 5.1s 10.2s 20.4s 40.8s 1100 (128 conversion clock) 3.2 s 4.15 s 8.3s 16.6s 33.2s 66.4s 1101 (512 conversion clock) 12.8 s 13.75 s 27.5s 55.0s 110.0s 220.0s note:do not change the setting of the ad conversion clock during ad conversion. TMPM333FDFG/fyfg/fwfg page 313
12.3.4 admod0 (mode control register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol eocfn adbfn - itm repeat scan ads after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 eocfn r normal ad conversion completion flag (note1) 0: before or during conversion 1: completion 6 adbfn r normal ad conversion busy flag 0: conversion stop 1: during conversion 5 ? r read as 0. 4-3 itm[1:0] r/w specify interrupt in fixed channel repeat conversion mode (refer to the table below and note 2) 2 repeat r/w specify repeat mode 0: single conversion mode 1: repeat conversion mode 1 scan r/w specify scan mode 0: fixed channel mode 1: channel scan mode 0 ads r/w start ad conversion start (note 3) 0: don't care 1: start conversion "0" is always read. specify ad conversion interrupt in fixed channel repeat conversion mode fixed channel repeat conversion mode = "0", = "1" 00 generate in interrupt once every single conversion. 01 generate interrupt once every 4 conversions. 10 generate interrupt once every 8 conversions. 11 setting prohibited. note 1: this flag is "0" cleared by reading the admod0 register. note 2: it is valid only when its specified in the fixed channel repeat mode ( ="1", = "0") note 3: conversion must be started after setting the mode. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 314
12.3.5 admod1 (mode control register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol vrefon i2ad adscn - adch after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 vrefon r/w vref application control(note1 and note2) 0: off 1: on 6 i2ad r/w specify operation mode in idle mode 0: stop 1: operation 5 adscn r/w specify operation mode in channel scan mode 0: 4-channel scan 1: 8-channel scan 4 ? r/w write "0". 3-0 adch[3:0] r/w select analog input channel (refer to the below table.) select analog input channel admod0 0 fixed channel 1 channel scan ( = 0) 1 channel scan ( = 1) admod1 0000 ain0 ain0 ain0 0001 ain1 ain0 to ain1 ain0 to ain1 0010 ain2 ain0 to ain2 ain0 to ain2 0011 ain3 ain0 to ain3 ain0 to ain3 0100 ain4 ain4 ain0 to ain4 0101 ain5 ain4 to ain5 ain0 to ain5 0110 ain6 ain4 to ain6 ain0 to ain6 0111 ain7 ain4 to ain7 ain0 to ain7 1000 ain8 ain8 ain8 1001 ain9 ain8 to ain9 ain8 to ain9 1010 ain10 ain8 to ain10 ain8 to ain10 1011 ain11 ain8 to ain11 ain8 to ain11 1100 setting prohibited 1101 1110 1111 TMPM333FDFG/fyfg/fwfg page 315
note 1: before starting ad conversion, write "1" to the bit, wait for 3s during which time the internal reference voltage should stabilize, and then write "1" to the admod0. note 2: set to "0" to go into standby mode upon completion of ad conversion. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 316
12.3.6 admod2 (mode control register 2) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol eocfhp adbfhp hpadce - hpadch after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 eocfhp r top-priority ad conversion completion flag (note1) 0: before or during conversion 1: completion 6 adbfhp r top-priority ad conversion busy flag 0: during conversion halts 1: during conversion 5 hpadce r/w activate top-priority conversion 0: don't care 1: start conversion "0" is always read. 4 ? r/w write "0". 3-0 hpadch[3:0] r/w select analog input channel when activating top-priority conversion. (see the table below) analog input channel whene xecuting top-priority conversion 0000 ain0 0001 ain1 0010 ain2 0011 ain3 0100 ain4 0101 ain5 0110 ain6 0111 ain7 1000 ain8 1001 ain9 1010 ain10 1011 ain11 1100 setting prohibited 1101 1110 1111 TMPM333FDFG/fyfg/fwfg page 317
note 1: this flag is "0" cleared by reading the admod2 register. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 318
12.3.7 admod4 (mode control register 4) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol hadhs hadhtg adhs adhtg - - adrst after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 hadhs r/w h/w source for activating top-priority ad conversion 0: external trigger 1: match with timer register 0 (tb5rg0) 6 hadhtg r/w h/w for activating top-priority ad conversion 0: disable 1: enable 5 adhs r/w h/w source for activating normal ad conversion (note1) 0: external trigger 1: match with timer register 0 (tb6rg0) 4 adhtg r/w hw for activating normal ad conversion 0: disable 1: enable 3-2 ? r read as 0. 1-0 adrst[1:0] w overwriting 10 with 01 allows adc to be software reset.(note 2) note 1: the external trigger cannot be used for h/w activation of ad conversion when it is used for h/w activation of top priority ad conversion. note 2: a software reset initializes all the registers except for adclk. note: the tx03 disables the external trigger used for h/w activation. therefore "0" cannot be set to and . TMPM333FDFG/fyfg/fwfg page 319
12.3.8 admod3 (mode control register 3) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - adobic0 adregs0 adobsv0 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-8 ? r read as 0. 7 ? r/w write "0". 6 ? r read as 0. 5 adobic0 r/w set the ad monitor function interrupt 0 0: if the value of the conversion result is smaller than the comparison register 0, an interrupt is generated. 1: if the value of the conversion result is bigger than the comparison register 0, an interrupt is generated. 4-1 adregs0[3:0] r/w select a target conversion result register when using the ad monitor function 0 (see the below table). 0 adobsv0 r/w ad monitor function 0 0: disable 1: enable conversion result register to be com- pared conversion result register to be com- pared 0000 adreg08 0100 adreg4c 0001 adreg19 0101 adreg5d 0010 adreg2a 0110 adreg6e 0011 adreg3b 0111 adreg7f - - 1xxx adregsp TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 320
12.3.9 admod5 (mode control register 5) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - adobic1 adregs1 adobsv1 after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-6 ? r read as 0. 5 adobic1 r/w set the ad monitor function interrupt 1. 0: if the value of the conversion result is smaller than the comparison register 1, an interrupt is generated. 1: if the value of the conversion result is bigger than the comparison register 1, an interrupt is generated. 4-1 adregs1[3:0] r/w select a target conversion result register when using the ad monitor function 1 (see the below table). 0 adobsv1 r/w ad monitor function 1 0: disable 1: enable conversion result register to be com- pared conversion result register to be com- pared 0000 adreg08 0100 adreg4c 0001 adreg19 0101 adreg5d 0010 adreg2a 0110 adreg6e 0011 adreg3b 0111 adreg7f ? ? 1xxx adregsp TMPM333FDFG/fyfg/fwfg page 321
12.3.10 adreg08 (conversion result register 08) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr0 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr0 - - - - ovr0 adr0rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr0[9:0] r ad conversion result conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr0 r overrun flag 0: not generated 1: generated if the conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr0rf r ad conversion result storage flag 0: conversion result is not stored 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 322
12.3.11 adreg19 (ad conversion result register 19) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr1 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr1 - - - - ovr1 adr1rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr1[9:0] r ad conversion result conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr1 r overrun flag 0: not generated 1: generated if the conversion result is overwritten before , "1" is set. this bit is "0" cleared when it is read. 0 adr1rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg page 323
12.3.12 adreg2a (ad conversion result register 2a) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr2 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr2 - - - - ovr2 adr2rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr2[9:0] r ad conversion result conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr2 r overrun flag 0: not generated. 1: generated. if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr2rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 324
12.3.13 adreg3b (ad conversion result register 3b) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr3 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr3 - - - - ovr3 adr3rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr3[9:0] r ad conversion result. conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr3 r overrun flag 0: not generated. 1: generated. if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr3rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg page 325
12.3.14 adreg4c (ad conversion result register 4c) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr4 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr4 - - - - ovr4 adr4rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr4[9:0] r ad conversion result. conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr4 r overrun flag 0: not generated. 1: generated if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr4rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a halfword or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 326
12.3.15 adreg5d (ad conversion result register 5d) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr5 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr5 - - - - ovr5 adr5rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr5[9:0] r ad conversion result. conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr5 r overrun flag 0: not generated. 1: generated if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr5rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg page 327
12.3.16 adreg6e (ad conversion result register 6e) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr6 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr6 - - - - ovr6 adr6rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr6[9:0] r ad conversion result. conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter12.4.5.7. 5-2 ? r read as 0. 1 ovr6 r overrun flag 0: not generated. 1: generated. if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr6rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 328
12.3.17 adreg7f (ad conversion result register 7f) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adr7 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adr7 - - - - ovr7 adr7rf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adr7[9:0] r ad conversion result. conversion result is stored. for information about the correlation between the conversion channel and the conversion result register, refer to the table 12-2 , chapter 12.4.5.7. 5-2 ? r read as 0. 1 ovr7 r overrun flag 0: not generated 1: generated if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adr7rf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg page 329
12.3.18 adregsp (ad conversion result register sp) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adrsp after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adrsp - - - - ovrsp adrsprf after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adrsp[9:0] r ad conversion result. top-priority ad conversion result is stored 5-2 ? r read as 0 1 ovrsp r overrun flag 0: not generated 1: generated if a conversion result is overwritten before reading , "1" is set. this bit is "0" cleared when it is read. 0 adrsprf r ad conversion result storage flag 0: conversion result is not stored. 1: conversion result is stored. if a conversion result is stored, "1" is set. this bit is "0" cleared when the conversion result is read. note: access to this register must be a half word or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.3 registers page 330
12.3.19 adcmp0 (ad conversion result comparison register 0) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adcom0 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adcom0 - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adcom0[9:0] r/w when ad monitor function 0 is enabled, it sets a value to be compared with the value of the conversion result register specified by admod3. 5-0 ? r read as 0. note: to write values into this register, the ad monitor function 0 must be disabled (ad- mod3 ="0"). 12.3.20 adcmp1 (ad conversion result comparison register 1) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol adcom1 after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol adcom1 - - - - - - after reset 0 0 0 0 0 0 0 0 bit bit symbol type function 31-16 ? r read as 0. 15-6 adcom1[9:0] r/w when ad monitor function 1 is enabled, it sets a value to be compared with the value of the conversion result register specified by admodt. 5-0 ? r read as 0. note: to write values into this register, the ad monitor function 1 must be disabled (ad- mod5="0"). TMPM333FDFG/fyfg/fwfg page 331
12.4 description of operations 12.4.1 analog reference voltage the "high" level of the analog reference voltage shall be applied to the vrfeh pin, and the "low" shall be applied to the vrefl pin. to start ad conversion, make sure that you first write "1" to the bit, wait for 3 s during which time the internal reference voltage should stabilize, and then write "1" to the admod0 bit. by writing "0" to the admod1 bit, a switched-on state of vrefh ? vrefl can be turned into a switched -off state. to switch to the power-consumption mode, set "0" to the bit after conversion. note: vrefl and avss are shared by TMPM333FDFG/fyfg/fwfg. 12.4.2 ad conversion mode two types of ad conversion are supported: normal ad conversion and top-priority ad conversion. for normal ad conversion, the following four operation modes are supported. 12.4.2.1 normal ad conversion for normal ad conversion, the following four operation modes are supported and the operation mode is selected with the admod0. ? ? ? ? (1) fixed channel single conversion mode if admod0 is set to "00", "ad conversion is performed in the fixed channel single conversion mode. in this mode, ad conversion is performed once for one channel selected. after ad conversion is completed, admod0 is set to "1", admod0 is cleared to "0", and the ad conversion completion interrupt request (intad) is generated. is cleared to "0" upon read. (2) channel scan single conversion mode if admod0 is set to "01," ad conversion is performed in the channel scan single conversion mode. in this mode, ad conversion is performed once for each scan channel selected. after ad scan con- version is completed, admod0 is set to "1", admod0 is cleared to "0", and the conversion completion interrupt request (intad) is generated. is cleared to "0". TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.4 description of operations page 332
(3) fixed channel repeat conversion mode if admod0 is set to "10", ad conversion is performed in fixed channel repeat conversation mode. in this mode, ad conversion is performed repeatedly for one channel selected. after ad conversion is completed, admod0 is set to "1". admod0 is not cleared to "0". it remains at "1". the timing with which the conversion completion interrupt request (intad) is generated can be selected by setting admod0 to an appropriate setting. is set with the same timing as this interrupt intad is generated. by reading , it is cleared to "0". (4) channel scan repeat conversion mode if admod0 is set to "11", ad conversion is performed in the channel scan repeat conversion mode. in this mode, ad conversion is performed repeatedly for a scan channel selected. each time one ad scan conversion is completed, admod0 is set to "1", and the conversion completion inter- rupt request (intad) is generated. admod0 is not cleared to "0". it remains at "1". is cleared to "0" upon read. 12.4.2.2 top-priority ad conversion by interrupting ongoing normal ad conversion, top-priority ad conversion can be performed. the fixed-channel single conversion is automatically selected, irrespective of the admod0 setting. when conditions to start operation are met, a conversion is performed just once for a channel designated by admod2. when conversion is completed, the top-priority ad conversion com- pletion interrupt (intadhp) is generated, and admod2 showing the completion of ad conversion is set to "1". returns to "0". eocfhp flag is cleared to "0" upon read. top-priority ad conversion activated while top-priority ad conversion is under way is ignored. 12.4.3 ad monitor function there are two channels of ad monitor function. if admod3 and admod5 are set to "1", the ad monitor function is enabled. if the value of the conversion result register specified by admod3 and admod5 becomes larger or smaller ("larger" or "smaller" to be designated by admod3 and ad- mod5) than the value of a comparison register, the ad monitor function interrupt (intadm0,in- tadm1) is generated. this comparison operation is performed each time a result is stored in a corresponding conversion result register. if the conversion result register assigned to perform the ad monitor function is continuously used without reading the conversion result, the conversion result is overwritten. the conversion result storage flag and the overrun flag remain being set. TMPM333FDFG/fyfg/fwfg page 333
12.4.4 selecting the input channel after reset, admod0 is initialized to "00" and admod1 is initialized to "0000". the channels to be converted are selected according to the operation mode of the ad converter as shown below. 1. normal ad conversion mode ? ? 12.4.5 ad conversion details 12.4.5.1 starting ad conversion normal ad conversion is activated by setting admod0 to "1". top-priority ad conversion is activated by setting admod2 to "1". four operation modes are made available to normal ad conversion. in performing normal ad conversion, one of these operation modes must be selected by setting admod0 to an appropriate setting. for top-priority ad conversion, only one operation mode can be used: fixed channel single conversion mode. normal ad conversion can be activated using the h/w activation source selected by admod4, and top-priority ad conversion can be activated using the hw activation source selected by ad- mod4. if bits of and are "0", normal and top-priority ad conversions are activated in response to the input of a falling edge through the adtrg pin. if these bits are "1", normal ad conversion is activated in response to tb6rg0 generated by the 16-bit timer 6, and top-priority ad conversion is activated in response to tb5rg0 generated by the 16-bit timer 5. to permit h/w activation, set admod4 to "1" for normal ad conversion and set ad- mod4 to "1" for top-priority ad conversion. software activation is still valid even after h/w activation has been permitted. note: when an external trigger is used for the hw activation source of a top-priority ad conversion, an external trigger cannot be set for activating normal ad conversion h/w. note: the TMPM333FDFG/fyfg/fwfg disables the external trigger used for h/w activation. there- fore "0" cannot be set to and . TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.4 description of operations page 334
12.4.5.2 ad conversion when normal ad conversion starts, the ad conversion busy flag (admod0) showing that ad conversion is under way is set to "1". when top-priority ad conversion starts, the top-priority ad conversion busy flag (ad- mod2) showing that ad conversion is underway is set to "1". at that time, the value of the busy flag admod0 for normal ad conversion before the start of top-priority ad conversions are retained. the value of the conversion completion flag admod0 for normal ad conversion before the start of top-priority ad conversion is retained. note: normal ad conversion must not be activated when top-priority ad conversion is under way. 12.4.5.3 top-priority ad conversion during normal ad conversion if top-priority ad conversion has been activated during normal ad conversion, ongoing normal ad con- version is suspended, and restarts normal ad conversion after top-priority ad conversion is completed. if admod2 is set to "1" during normal ad conversion, ongoing normal ad conversion is suspended, and the top-priority ad conversion starts; specifically, ad conversion (fixed-channel single con- version) is executed for a channel designated by admod2. after the result of this top-priority ad conversion is stored in the storage register adregsp, normal ad conversion is resumed. if h/w activation of top-priority ad conversion is authorized during normal ad conversion, ongoing ad conversion is discontinued when requirements for activation using a h/w activation resource are met, and top-priority ad conversion (fixed-channel single conversion) starts for a channel designated by ad- mod2. after the result of this top-priority ad conversion is stored in the storage register adregsp, normal ad conversion is resumed. for example, if channel repeat conversion is activated for channels ain0 through ain3 and if is set to "1" during ain2 conversion, ain2 conversion is suspended, and conversion is performed for a channel designated by (ain11 in the case shown below). after the result of conversion is stored in adregsp, channel repeat conversion is resumed, starting from ain2. 12.4.5.4 stopping repeat conversion mode to stop the ad conversion operation in the repeat conversion mode (fixed-channel repeat conversion mode or channel scan conversion mode), write "0" to admod0. when ongoing ad conversion is completed, the repeat conversion mode terminates, and admod0 is set to "0". TMPM333FDFG/fyfg/fwfg page 335 ch0 ch1 ch2 ch11 ch2 ch3 ch0 top-priority ad has been activated conversion ch
12.4.5.5 reactivating normal ad conversion to reactivate normal ad conversion while the conversion is underway, a software reset (ad- mod3) must be performed before starting ad conversion. the h/w activation method must not be used to reactivate normal ad conversion. 12.4.5.6 conversion completion (1) normal ad conversion completion when normal ad conversion is completed, the ad conversion completion interrupt (intad) is generated. the result of ad conversion is stored in the storage register, and two registers change: the register admod0 which indicates the completion of ad conversion and the register ad- mod0. interrupt request, conversion register storage register and change with a dif- ferent timing according to a mode selected. in mode other than fixed-channel repeat conversion mode, conversion results are stored in ad con- version result registers (adreg08 through adrg7f) corresponding to a channel. in fixed-channel repeat conversion mode, the conversion results are sequentially stored in storage registers adreg08 through adreg7f. however, if interrupt setting on is set to be generated each time one ad conversion is completed, the conversion result is stored only in adreg08. if interrupt setting on is set to be generated each time four ad conversions are completed, the conversion results are sequentially stored in adreg08h through adreg3b. interrupt requests, flag changes and conversion result registers in each mode are as shown below. ? ? ? TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.4 description of operations page 336
c. 8 conversions with set to "10", an interrupt request is generated each time eight ad con- versions are completed. in this case, the conversion results are sequentially stored in the storage register adreg08 through adreg7f. after the conversion result is stored in adreg7f, is set to "1", and the storage of subsequent conversion results starts from adreg08. channel scan repeat conversion mode each time one ad conversion is completed, admod0 is set to "1" and interrupt request intad is generated. admod0 is not cleared to "0". it remains at "1". ad conversion results are stored in a ad conversion result register corresponding to a channel. (2) top-priority ad conversion completion after the ad conversion is completed, the top-priority ad conversion completion interrupt (in- tadhp) is generated, and admod2 which indicates the completion of top-priority ad conversion is set to "1". ad conversion results are stored in the ad conversion result register sp. (3) data polling to confirm the completion of ad conversion without using interrupts, data polling can be used. when ad conversion is completed, admod0 is set to "1". to confirm the completion of ad conversion and to obtain the results, poll this bit. ad conversion result storage register must be read by half word or word access. if = 0 and = 1, a correct conversion result has been obtained. TMPM333FDFG/fyfg/fwfg page 337
12.4.5.7 interrupt generation timings and ad conversion result storage register table 12-1 shows a relation in the following three items: ad conversion modes, interrupt generation timings and flag operations. table 12-2 shows a relation between analog channel inputs and ad conversion result registers. table 12-1 relations in conversion modes, interrupt generation timings and flag operations conversion mode scan/repeat mode setting (admod0) interrupt generation timing / set timing (see note) admod0 admod2 (after the interrupt is generated) normal conversion fixed-channel single conversion 0 0 ? after generation is completed. after conversion is completed. 0 ? fixed-channel repeat conversion 1 0 00 each time one conversion is completed. after one conver- sion is completed. 1 ? 01 each time four conversion is completed. after four conver- sions are comple- ted. 1 ? 10 each time eight conversion is completed. after eight conver- sions are comple- ted. 1 ? channel scan single conversion 0 1 ? after scan con- version is completed. after scan conver- sion is completed. 0 ? channel scan repeat conversion 1 1 ? after one scan conversion is completed. after one scan con- version is comple- ted. 1 ? top-priority conversion ? ? ? after completion is completed. conversion com- pletion ? 0 note: admod0 and admod2 are cleared upon read. table 12-2 relation between analog channels input and ad conversion result registers analog input channels normal ad conversion top-priority ad conver- sion other conversion mode than those shown on the right side fixed channel repeat conversion mode (every one conversion) fixed channel repeat conversion mode (every four conver- sions) fixed channel repeat conversion mode (every eight conver- sions) ain0 adreg08 adreg08 fixed adregsp ain1 adreg19 ain2 adreg2a ain3 adreg3b ain4 adreg4c ain5 adreg5d ain6 adreg6e ain7 adreg7f ain8 adreg08 ain9 adreg19 ain10 adreg2a ain11 adreg3b note: to access the conversion result register, use a half-word or a word access. TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.4 description of operations page 338 adreg08 a dreg7f adreg08 a dreg3b
cautions the result value of ad conversion may vary depending on the fluctuation of the supply voltage, or may be affected by noise. when using analog input pins and ports alternately, do not read and write ports during conversion because the conversion accuracy may be reduced. also the conversion accuracy may be reduced if the output ports current fluctuate during ad conversion. please take counteractive measures with the program such as averaging the ad conversion results. TMPM333FDFG/fyfg/fwfg page 339
TMPM333FDFG/fyfg/fwfg 12. analog/digital converter (adc) 12.4 description of operations page 340
13. watchdog timer(wdt) the watchdog timer (wdt) is for detecting malfunctions (runaways) of the cpu caused by noises or other distur- bances and remedying them to return the cpu to normal operation. if the watchdog timer detects a runaway, it generates a intwdt interrupt or reset. note:intwdt interrupt is a factor of the non-maskable interrupts (nmi). also, the watchdog timer notifies of the detecting malfunction to the external peripheral devices from the watchdog timer pin ( wdtout) by outputting "low". note: this product does not have the watchdog timer out pin ( wdtout). 13.1 configuration figure 13-1shows the block diagram of the watchdog timer. figure 13-1 block diagram of the watchdog timer TMPM333FDFG/fyfg/fwfg page 341 wdmod to internal reset reset pin watchdog timer out control wdtout q rs selector binary counter 2 15 /fsys 2 17 /fsys 2 19 /fsys 2 21 /fsys 2 23 /fsys 2 25 /fsys wdmod fsys wdmod watch dog timer control register wdcr reset write ?0xb1? write ?0x4e? internal data bus internal reset watchdog timer interrupt intwdt
13.2 register the followings are the watchdog timer control registers and addresses. base address = 0x4004_0000 register name address(base+) watchdog timer mode register wdmod 0x0000 watchdog timer control register wdcr 0x0004 13.2.1 wdmod(watchdog timer mode register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol wdte wdtp - i2wdt rescr - after reset 1 0 0 0 0 0 1 0 bit bit symbol type function 31-8 ? r read as 0. 7 wdte r/w enable/disable control 0:disable 1:enable 6-4 wdtp[2:0] r/w selects wdt detection time(refer totable 13-1) 000: 2 15 /fsys 001: 2 17 /fsys 010: 2 19 /fsys 011: 2 21 /fsys 100: 2 23 /fsys 101: 2 25 /fsys 110:setting prohibited. 111:setting prohibited. 3 ? r read as 0. 2 i2wdt r/w operation when idle mode 0: stop 1:in operation 1 rescr r/w operation after detecting malfunction 0: intwdt interrupt request generates. (note) 1: reset 0 ? r/w write 0. note:intwdt interrupt is a factor of the non-maskable interrupts (nmi). TMPM333FDFG/fyfg/fwfg 13. watchdog timer(wdt) 13.2 register page 342
table 13-1 detection time of watchdog timer (fc = 40 mhz) clock gear value cgsyscr wdmod 000 001 010 011 100 101 000 (fc) 0.82 ms 3.28 ms 13.11 ms 52.43 ms 209.72 ms 838.86 ms 100 (fc/2) 1.63 ms 6.55 ms 26.21 ms 104.86 ms 419.43 ms 1.68 s 101 (fc/4) 3.28 ms 13.11 ms 52.43 ms 209.72 ms 838.86 ms 3.36 s 110 (fc/8) 6.55 ms 26.21 ms 104.86 ms 419.43 ms 1.68 s 6.71 s 13.2.2 wdcr (watchdog timer control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol wdcr after reset - - - - - - - - bit bit symbol type function 31-8 ? r read as 0. 7-0 wdcr w disable/clear code 0xb1:disable code 0x4e: clear code others:reserved TMPM333FDFG/fyfg/fwfg page 343
13.3 operations 13.3.1 basic operation the watchdog timer is consists of the binary counters that work using the system clock (fsys) as an input. detecting time can be selected between 2 15 , 2 17 , 2 19 , 2 21 , 2 23 and 2 25 by the wdmod. the detecting time as specified is elapsed, the watchdog timer interrupt (intwdt) generates, and the watchdog timer out pin ( wdtout) output "low". to detect malfunctions (runaways) of the cpu caused by noise or other disturbances, the binary counter of the watchdog timer should be cleared by software instruction before intwdt interrupt generates. if the binary counter is not cleared, the non-maskable interrupt generates by intwdt. thus cpu detects malfunction (run- way), malfunction countermeasure program is performed to return to the normal operation. additionally, it is possible to resolve the problem of a malfunction (runaway) of the cpu by connecting the watchdog timer out pin to reset pins of peripheral devices. note:this product does not include a watchdog timer out pin ( wdtout). 13.3.2 operation mode and status the watchdog timer begins operation immediately after a reset is cleared. if not using the watchdog timer, it should be disabled. the watchdog timer cannot be used in the stop mode, sleep mode and slow mode where high-speed frequency clock is stopped. before transition to these modes, the watchdog timer should be disabled. in idle mode, its operation depends on the wdmod setting. also, the binary counter is automatically stopped during debug mode. TMPM333FDFG/fyfg/fwfg 13. watchdog timer(wdt) 13.3 operations page 344
13.4 operation when malfunction (runaway) is detected 13.4.1 intwdt interrupt generation in the figure 13-2 shows the case that intwdt interrupt generates (wdmod="0"). when an overflow of the binary counter occurs, intwdt interrupt generates. it is a factor of non-maskable interrupt (nmi). thus cpu detects non-maskable interrupt and performs the countermeasure program. the factor of non-maskable interrupt is the plural. cgnmiflg identifies the factor of non-maskable interrupts. in the case of intwdt interrupt, cgnmiflg is set. when intwdt interrupt generates, simultaneously the watchdog timer out ( wdtout) output "low". wdtout becomes "high" by the watchdog timer clearing that is writing clear code 0x4e to the wdcr register. note: this product does not have the watchdog timer output pin( wdtout). figure 13-2 intwdt interrupt generation TMPM333FDFG/fyfg/fwfg page 345 n overflow 0 wdt counter wdt clear intwdt write of a clear code wdtout
13.4.2 internal reset generation figure 13-3 shows the internal reset generation (wdmod="1"). mcu is reset by the overflow of the binary counter. in this case, reset status continues for 32 states. a clock is initialized so that input clock (fsys) is the same as a high-speed frequency clock (fosc). this means fsys = fosc. figure 13-3 internal reset generation TMPM333FDFG/fyfg/fwfg 13. watchdog timer(wdt) 13.4 operation when malfunction (runaway) is detected page 346 n overflow wdt counter internal reset intwdt 32-state (3.2 ? s @fosc = fsys = 10 mhz) wdtout
13.5 control register the watchdog timer (wdt) is controlled by two control registers wdmod and wdcr. 13.5.1 watchdog timer mode register (wdmod) 1. specifying the detection time of the watchdog timer . set the watchdog timer detecting time to wdmod. after reset, it is initialized to wdmod = "000". 2. enabling/disabling the watchdog timer . when resetting, wdmod is initialized to "1" and the watchdog timer is enabled. to disable the watchdog timer to protect from the error writing by the malfunction, first bit is set to "0", and then the disable code (0xb1) must be written to wdcr register. to change the status of the watchdog timer from "disable" to "enable," set the bit to "1". 3. watchdog timer out reset connection this register specifies whether wdtout is used for internal reset or interrupt. after reset, wdmod is initialized to "1", the internal reset is generated by the overflow of binary coun- ter. 13.5.2 watchdog timer control register(wdcr) this is a register for disabling the watchdog timer function and controlling the clearing function of the binary counter. TMPM333FDFG/fyfg/fwfg page 347
13.5.3 setting example 13.5.3.1 disabling control by writing the disable code (0xb1) to this wdcr register after setting wdmod to "0," the watchdog timer can be disabled and the binary counter can be cleared. 7 6 5 4 3 2 1 0 wdmod 0 ? ? ? ? ? ? ? set to "0". wdcr 1 0 1 1 0 0 0 1 writes the disable code (0xb1). 13.5.3.2 enabling control set wdmod to "1". 7 6 5 4 3 2 1 0 wdmod 1 ? ? ? ? ? ? ? set to "1". 13.5.3.3 watchdog timer clearing control writing the clear code (0x4e) to the wdcr register clears the binary counter and it restarts counting. 7 6 5 4 3 2 1 0 wdcr 0 1 0 0 1 1 1 0 writes the clear code (0x4e). 13.5.3.4 detection time of watchdog timer in the case that 2 21 /fsys is used, set "011" to wdmod. 7 6 5 4 3 2 1 0 wdmod 1 0 1 1 ? ? ? ? TMPM333FDFG/fyfg/fwfg 13. watchdog timer(wdt) 13.5 control register page 348
14. real time clock (rtc) 14.1 function 1. clock (hour, minute and second) 2. calendar (month, week, date and leap year) 3. selectable 12 (am/ pm) and 24 hour display 4. time adjustment + or ? 30 seconds (by software) 5. alarm (alarm output) 6. alarm interrupt 14.2 block diagram figure 14-1 block diagram note 1: western calendar year column:this product uses only the final two digits of the year. the year following 99 is 00 years. please take into account the first two digits when handling years in the western calendar. note 2: leap year:a leap year is divisible by 4 excluding a year divisible by 100; the year divisible by 100 is not considered to be a leap year. any year divisible by 400 is a leap year. this product is considered the year divisible by 4 to be a leap year and does not take into account the above exceptions. it needs adjustments for the exceptions. TMPM333FDFG/fyfg/fwfg page 349 internal address bus internal data bus 16 hz clock 1 hz clock sec.counter clock (fs) alarm selector alarm intrtc alarm register comparator clock r/w control rd wr data address adjust
14.3 detailed description register 14.3.1 register list the registers and the addresses related to rtc are shown as below. rtc has two functions, page0 (clock) and page1 (alarm), which share some parts of registers. the page can be selected by setting rtcpager. base address = 0x4004_0100 register name address(base+) second column register (only page0) rtcsecr 0x0000 minute column register rtcminr 0x0001 hour column register rtchourr 0x0002 - (note 1) - 0x0003 day of the week column register rtcdayr 0x0004 day column register rtcdater 0x0005 month column register (page0) rtcmonthr 0x0006 selection register of 24-hour,12-hour (page1) year column register (page0) rtcyearr 0x0007 leap year register (page1) page register rtcpager 0x0008 - (note 1) - 0x0009 - (note 1) - 0x000a - (note 1) - 0x000b reset register rtcrestr 0x000c reserved - 0x000d - (note 1) - 0x000e - (note 1) - 0x000f note 1: "0" is read by reading the address. writing is disregarded. note 2: access to the "reserved" areas is prohibited. 14.3.2 control register reset operation initializes the following registers. ? ? TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.3 detailed description register page 350
table 14-1 page0 (clock function) register symbol bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 function rtcsecr ? 40sec. 20sec. 10sec. 8sec. 4sec. 2sec. 1sec. second column rtcminr ? 40min. 20min. 10min. 8min. 4min. 2min. 1min. minute column rtchourr ? ? 20hours pm/am 10hour 8hour 4hour 2hour 1hours hour column rtcdayr ? ? ? ? ? day of the week day of the week column rtcdater ? ? day20 day10 day8 day4 day2 day1 day column rtcmonthr ? ? ? oct. aug. apr. feb. jan. month column rtcyearr year 80 year 40 year20 year 10 year 8 year 4 year 2 year 1 year column (lower two columns) rtcpager interrupt enable ? ? adjustment function clock ena- ble alarm en- able ? page setting page register rtcrestr 1 hz enable 16 hz enable clock reset alarm reset ? (fd/fy) ? (fw) always write "1" reset register note:reading rtcsecr, rtcminr, rtchourr, rtcdayr, rtcmonthr, rtcyearr of page0 captures the current state. table 14-2 page1 (alarm function) registers symbol bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 function rtcsecr ? ? ? ? ? ? ? ? ? rtcminr ? 40min. 20min. 10min. 8min. 4min. 2min. 1min. minute column rtchourr ? ? 20hours pm/am 10hour 8hour 4hour 2hour 1hour hour column rtcdayr ? ? ? ? ? day of the week day of the week column rtcdater ? ? day20 day10 day8 day4 day2 day1 day column rtcmonthr ? ? ? ? ? ? ? 24/12 24-hour clock mode rtcyearr ? ? ? ? ? ? leap-year setting leap-year mode rtcpager interrupt enable ? ? adjustment function clock ena- ble alarm en- able ? page setting page register rtcrestr 1 hz enable 16 hz enable clock reset alarm reset ? (fd/fy) ? (fw) always write "1" reset register note 1: reading rtcminr, rtchourr, rtcdayr, rtcmonthr, rtcyearr of page1 captures the current state. note 2: rtcsecr, rtcminr, rtchourr, rtcdayr, rtcdater, rtcmonthr, rtcyearr of page0 and rtcyearr of page1 (for leap year) must be read twice and compare the data captured. note: regarding the table 14-1 and the table 14-2 ,"fd" indicates TMPM333FDFG, "fy" indicates tmpm333fyfg and "fw" indicates tmpm333fwfg. TMPM333FDFG/fyfg/fwfg page 351
14.3.3 detailed description of control register 14.3.3.1 rtcsecr (second column register (for page0 only)) 7 6 5 4 3 2 1 0 bit symbol - se after reset 0 undefined undefined undefined undefined undefined undefined undefined bit bit symbol type functon 7 ? r read as 0. 6-0 se r/w setting digit register of second 000_0000 : 00sec. 000_0001 : 01sec. 000_0010 : 02sec. 000_0011 : 03sec. 000_0100 : 04sec. 000_0101 : 05sec. 000_0110 : 06sec. 000_0111 : 07sec. 000_1000 : 08sec. 000_1001 : 09sec. 001_0000 : 10sec. 001_0001 : 11sec. 001_0010 : 12sec. 001_0011 : 13sec. 001_0100 : 14sec. 001_0101 : 15sec. 001_0110 : 16sec. 001_0111 : 17sec. 001_1000 : 18sec. 001_1001 : 19sec. 010_0000 : 20sec. 011_0000 : 30sec. 100_0000 : 40sec. 101_0000 : 50sec. 101_1001 : 59sec. note: the setting other than listed above is prohibited. 14.3.3.2 rtcminr (minute column register (page0/1)) 7 6 5 4 3 2 1 0 bit symbol - mi after reset 0 undefined undefined undefined undefined undefined undefined undefined bit bit symbol type functon 7 ? r read as 0. 6-0 mi r/w setting digit register of minutes. 000_0000 : 00min. 000_0001 : 01min. 000_0010 : 02min. 000_0011 : 03min. 000_0100 : 04min. 000_0101 : 05min. 000_0110 : 06min. 000_0111 : 07min. 000_1000 : 08min. 000_1001 : 09min. 001_0000 : 10min. 001_0001 : 11min. 001_0010 : 12min. 001_0011 : 13min. 001_0100 : 14min. 001_0101 : 15min. 001_0110 : 16min. 001_0111 : 17min. 001_1000 : 18min. 001_1001 : 19min. 010_0000 : 20min. 011_0000 : 30min. 100_0000 : 40min. 101_0000 : 50min. 101_1001 : 59min. note: the setting other than listed above is prohibited. TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.3 detailed description register page 352
14.3.3.3 rtchourr (hour column register(page0/1)) (1) 24-hour clock mode (rtcmonthr= "1") 7 6 5 4 3 2 1 0 bit symbol - - ho after reset 0 0 undefined undefined undefined undefined undefined undefined bit bit symbol type functon 7-6 ? r read as 0. 5-0 ho r/w setting digit register of hour. 00_0000 : 0 oclock 00_0001 : 1 oclock 00_0010 : 2 oclock 00_0011 : 3 oclock 00_0100 : 4 oclock 00_0101 : 5 oclock 00_0110 : 6 oclock 00_0111 : 7 oclock 00_1000 : 8 oclock 00_1001 : 9 oclock 01_0000 : 10 oclock 01_0001 : 11 oclock 01_0010 : 12 oclock 01_0011 : 13 oclock 01_0100 : 14 oclock 01_0101 : 15 oclock 01_0110 : 16 oclock 01_0111 : 17 oclock 01_1000 : 18 oclock 01_1001 : 19 oclock 10_0000 : 20 oclock 10_0001 : 21 oclock 10_0010 : 22 oclock 10_0011 : 23 oclock note: the setting other than listed above is prohibited. (2) 12-hour clock mode (rtcmonthr = "0") 7 6 5 4 3 2 1 0 bit symbol - - ho after reset 0 0 undefined undefined undefined undefined undefined undefined bit bit symbol type functon 7-6 ? r read as 0. 5-0 ho r/w setting digit register of hour. (am) (pm) 00_0000 : 0 oclock 00_0001 : 1 oclock 00_0010 : 2 oclock 00_0011 : 3 oclock 00_0100 : 4 oclock 00_0101 : 5 oclock 00_0110 : 6 oclock 00_0111 : 7 oclock 00_1000 : 8 oclock 00_1001 : 9 oclock 01_0000 : 10 oclock 01_0001 : 11 oclock 10_0000 : 0 oclock 10_0001 : 1 oclock 10_0010 : 2 oclock 10_0011 : 3 oclock 10_0100 : 4 oclock 10_0101 : 5 oclock 10_0110 : 6 oclock 10_0111 : 7 oclock 10_1000 : 8 oclock 10_1001 : 9 oclock 11_0000 : 10 oclock 11_0001 : 11 oclock note: the setting other than listed above is prohibited. TMPM333FDFG/fyfg/fwfg page 353
14.3.3.4 rtcdayr (day of the week column register(page0/1)) 7 6 5 4 3 2 1 0 bit symbol - - - - - we after reset 0 0 0 0 0 undefined undefined undefined bit bit symbol type function 7-3 ? r read as 0. 2-0 we r/w setting digit register of day of the week. 000: sunday 001: monday 010: tuesday 011: wednesday 100: thursday 101: friday 110: saturday note: the setting other than listed above is prohibited. 14.3.3.5 rtcdater (day column register (for page0/1 only)) 7 6 5 4 3 2 1 0 bit symbol - - da after reset 0 0 undefined undefined undefined undefined undefined undefined bit bit symbol type functon 7-6 ? r read as 0. 5-0 da r/w setting digit register of day. 00_0001 : 1st day 00_0010 : 2nd day 00_0011 : 3rd day 00_0100 : 4th day 00_0101 : 5th day 00_0110 : 6th day 00_0111 : 7th day 00_1000 : 8th day 00_1001 : 9th day 01_0000 : 10th day 01_0001 : 11th day 01_0010 : 12th day 01_0011 : 13th day 01_0100 : 14th day 01_0101 : 15th day 01_0110 : 16th day 01_0111 : 17th day 01_1000 : 18th day 01_1001 : 19th day 10_0000 : 20th day 10_0001 : 21th day 10_0010 : 22th day 10_0011 : 23th day 10_0100 : 24th day 10_0101 : 25th day 10_0110 : 26th day 10_0111 : 27th day 10_1000 : 28th day 10_1001 : 29th day 11_0000 : 30th day 11_0001 : 31th day note 1: the setting other than listed above is prohibited. note 2: do not set for non-existent days (e.g.: 30th feb.). TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.3 detailed description register page 354
14.3.3.6 rtcmonthr (month column register (for page0 only)) 7 6 5 4 3 2 1 0 bit symbol - - - mo after reset 0 0 0 undefined undefined undefined undefined undefined bit bit symbol type functon 7-5 ? r read as 0. 4-0 mo r/w setting digit register of month. 0_0001 : 0_0010 : 0_0011 : 0_0100 : 0_0101 : 0_0110 : january february march april may june 0_0111 : 0_1000 : 0_1001 : 1_0000 : 1_0001 : 1_0010 : july august september october november december note: the setting other than listed above is prohibited. 14.3.3.7 rtcmonthr (selection of 24-hour clock or 12-hour clock24(for page1 only)) 7 6 5 4 3 2 1 0 bit symbol - - - - - - - mo0 after reset 0 0 0 0 0 0 0 undefined bit bit symbol type function 7-1 ? r read as 0. 0 mo0 r/w 0: 12-hour 1: 24-hour note: do not change the rtcmonthr while the rtc is in operation. TMPM333FDFG/fyfg/fwfg page 355
14.3.3.8 rtcyearr (year column register (for page0 only)) 7 6 5 4 3 2 1 0 bit symbol ye after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 7-0 ye r/w setting digit register of year. 0000_0000 : 00 years 0000_0001 : 01 years 0000_0010 : 02 years 0000_0011 : 03 years 0000_0100 : 04 years 0000_0101 : 05 years 0000_0110 : 06 years 0000_0111 : 07 years 0000_1000 : 08 years 0000_1001 : 09 years 0001_0000 : 10 years 0010_0000 : 20 years 0011_0000 : 30 years 0100_0000 : 40 years 01001_0000 : 50 years 0110_0000 : 60 years 0111_0000 : 70 years 1000_0000 : 80 years 1001_0000 : 90 years 1001_1001 : 99 years note: the setting other than listed above is prohibited. 14.3.3.9 rtcyearr (leap year register (for page1 only)) 7 6 5 4 3 2 1 0 bit symbol - - - - - - leap after reset 0 0 0 0 0 0 undefined undefined bit bit symbol type functon 7-2 ? r read as 0. 1-0 leap r/w 00 : leap year 01 : one year after leap year 10 : two years after leap year 11 : three years after leap year TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.3 detailed description register page 356
14.3.3.10 rtcpager(page register(page0/1)) 7 6 5 4 3 2 1 0 bit symbol intena - - adjust enatmr enaalm - page after reset 0 0 0 0 undefined undefined 0 0 bit bit symbol type function 7 intena r/w intrtc 0:disable 1:enable 6-5 ? r read as 0. 4 adjust r/w [write] 0: don't care 1: sets adjust request adjusts seconds. the request is sampled when the sec. counter counts up. if the time elapsed is between 0 and 29 seconds, the sec. counter is cleared to "0". if the time elapsed is between 30 and 59 seconds, the min. counter is carried and sec. counter is cleared to "0". [read] 0: adjust no request 1: adjust requested if "1" is read, it indicates that adjust is being executed. if "0" is read, it indicates that the execution is finished. 3 enatmr r/w clock 0: disable 1: enable 2 enaalm r/w alarm 0: disable 1: enable 1 ? r read as 0. 0 page r/w page selection 0:selects page0 1:selects page1 note 1: a read-modify-write operation cannot be porfomed. note 2: to set interrupt enable bits to , and , you must follow the order specified here. make sure not to set them at the same time (make sure that there is time lag between interrupt enable and clock/ alarm enable).to change the setting of and , must be disabled first. example: clock setting/alarm setting 7 6 5 4 3 2 1 0 rtcpager 0 0 0 0 1 1 0 0 enables clock and alarm rtcpager 1 0 0 0 1 1 0 0 enables interrupt TMPM333FDFG/fyfg/fwfg page 357
14.3.3.11 rtcrestr (reset register (for page0/1)) 7 6 5 4 3 2 1 0 bit symbol dis1hz dis16hz rsttmr rstalm - - - - after reset 1 1 0 0 0 0(fd/fy) 1(fw) 0(fd/fy) 1(fw) 0(fd/fy) 1(fw) bit bit symbol type function 7 dis1hz r/w 1 hz 0:enable 1: disable 6 dis16hz r/w 16 hz 0: enable 1: disable 5 rsttmr r/w [write] 0: don't care 1: sec.counter reset resets the sec counter. the equest is sampled using low-speed clock. [read] 0: no reset request 1: reset requested if "1" is read, it indicates that reset is being executed. if "0" is read, it indicates that the execution is finished. 4 rstalm r/w 0:don't care 1: alarm reset initializes alarm registers (minute column, hour column, day column and day of the week column) as follows. minute:00, hour:00, day:01, day of the week:sunday 3 ? r read as 0. 2-0 ? r fd/fy(note2) : read as 0. r/w fw(note2) : write "1". note 1: a read-modify-write operation cannot be performed. note 2: "fd" indicates TMPM333FDFG, "fy" indicates tmpm333fyfg and "fw" indicates tmpm333fwfg. the setting of and ,rtcpager used for alarm, 1hz interrupt and 16hz interrupt is shown as below. rtcpager interrupt source signal 1 1 1 alarm 0 1 0 1 hz 1 0 0 16 hz others interrupt not generated. TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.3 detailed description register page 358
14.4 operational description the rtc incorporates a second counter that generates a 1hz signal from a 32.768 khz signal. the second counter operation must be taken into account when using the rtc. 14.4.1 reading clock data 1. using 1hz interrupt the 1hz interrupt is generated being synchronized with counting up of the second counter. data can be read correctly if reading data after 1hz interrupt occurred. 2. using pair reading there is a possibility that the clock data may be read incorrectly if the internal counter operates carry during reading. to ensure correct data reading, read the clock data twice as shown below. a pair of data read successively needs to match. figure 14-2 flowchart of the clock data reading 14.4.2 writing clock data a carry during writing ruins correct data writing. the following procedure ensures the correct data writing. 1. using 1 hz interrupt the 1hz interrupt is generated by being synchronized with counting up of the second counter. if data is written in the time between 1hz interrupt and subsequent one second count, it completes correctly. 2. resetting counter write data after resetting the second counter. the 1hz-interrupt is generated one second after enabling the interrupt subsequent to counter reset. the time must be set within one second after the interrupt. TMPM333FDFG/fyfg/fwfg page 359 start rtcpager = "0", then select page0 clock data reading (1st) clock data reading (2nd) 1st data = 2nd data end no yes
figure 14-3 flowchart of the clock data writing 3. disabling the clock writing "0" to rtcpager disables clock operation including a carry. stop the clock after the 1hz-interrupt. the second counter keeps counting. set the clock again and enable the clock within one second before next 1hz-interrupt figure 14-4 flowchart of the disabling clock TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.4 operational description page 360 start disabling clock end writing the clock data enabling the clock strat rtcpager = "0" then select page0 timer setting first interrupt (after 1s) end rtcrestr = "1" then reset counter rtcrestr = "0" then enable 1hz interrupt no yes
14.4.3 entering the low power consumption mode to enter sleep mode, in which the system clock stops, after changing clock data, adjusting seconds or resetting the clock, be sure to observe one of the following procedures 1. after changing the clock setting registers, setting the rtcpager bit or setting the rtcrestr bit, wait for one second for an interrupt to be generated. 2. after changing the clock setting registers, setting the rtcpager bit or setting the rtcrestr bit, read the corresponding clock register values, or to make sure that the setting you have made is reflected. TMPM333FDFG/fyfg/fwfg page 361
14.5 alarm function by writing "1" to rtcpager, the alarm function of the page1 registers is enabled. one of the following three signals is output to the alarm pin. 1. "low" pulse (when the alarm register corresponds with the clock) 2. 1hz cycle "low" pulse 3. 16hz cycle "low" pulse in any cases shown above, the intrtc outputs one cycle pulse of low-speed clock. it outputs the intrtc interrupt request simultaneously. the intrtc interrupt signal is falling edge triggered.specify the falling edge as the active state in the cg interrupt mode control register 14.5.1 "low" pulse (when the alarm register corresponds with the clock) "low" pulse is output to the alarm pin when the values of the page0 clock register and the page1 alarm register correspond. the intrtc interrupt is generated and the alarm is triggered. the alarm settings initialize the alarm with alarm prohibited. write "1" to rtcrestr. it makes the alarm setting to be 00 minute, 00 hour, 01 day and sunday. setting alarm for min., hour, date and day is done by writing data to the relevant page1 register. enable the alarm with the rtcpager bit. enable the interrupt with the rtcpager bit. the following is an example program for outputting an alarm from the alarm pin at noon (12:00) on monday 5th. 7 6 5 4 3 2 1 0 rtcpager 0 0 0 0 1 0 0 1 disables alarm,sets page1 rtcrestr 1 1 0 1 0 0 0 0 initializes alarm rtcdayr 0 0 0 0 0 0 0 1 monday rtcdater 0 0 0 0 0 1 0 1 5th day rtchourr 0 0 0 1 0 0 1 0 sets 12 oclock rtcminr 0 0 0 0 0 0 0 0 sets 00 min rtcpager 0 0 0 0 1 1 0 0 enables alarm rtcpager 1 0 0 0 1 1 0 0 enables interrupts the above alarm works in synchronization with the low-speed clock. when the cpu is operating at high frequency oscillation, a maximum of one clock delay at fs (about 30s) may occur for the time register setting to become valid. note: to make the alarm work repeatedly (e.g. every wednesday at 12:00), next alarm must be set during the intrtc interrupt routine that is generated when the time set for the alarm matches the rtc count. TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.5 alarm function page 362
14.5.2 1hz cycle "low" pulse1 hz the rtc outputs a "low" pulse cycle of low-speed 1hz clock to the alarm pin by setting rtcpag- er="1" after setting rtcpager= "0", rtcrestr= "0" and = "1". it generates an intrtc interrupt simultaneously. 14.5.3 16hz cycle "low" pulse16 hz the rtc outputs a "low" pulse cycle of low-speed 16hz clock to the alarm pin by setting rtcpag- er="1" after setting rtcpager= "0", rtcrestr= "1" and = "0". it generates an intrtc interrupt simultaneously. TMPM333FDFG/fyfg/fwfg page 363
TMPM333FDFG/fyfg/fwfg 14. real time clock (rtc) 14.5 alarm function page 364
15. flash memory operation this section describes the hardware configuration and operation of the flash memory. 15.1 flash memory 15.1.1 features 1. memory capacity the TMPM333FDFG/fyfg/fwfg devices contain flash memory. the memory sizes and config- urations of each device are shown in the table below. independent write access to each block is available. when the cpu is to access the internal flash memory, 32-bit data bus width is used. 2. write/erase time writing is executed per page. the TMPM333FDFG/tmpm333fyfg contain 128 words and the tmpm333fwfg contains 64 words in a page. page writing requires 1.25ms (typical) regardless of number of words. a block erase requires 0.1 sec. (typical). the following table shows write and erase time per chip. product name memory size block configuration # of words write time erase time 128 kb 64 kb 32 kb 16 kb TMPM333FDFG 512 kb 3 1 2 ? 128 1.28 sec 0.4 sec tmpm333fyfg 256 kb 1 1 2 ? 128 0.64 sec 0.4 sec tmpm333fwfg 128 kb ? 1 1 2 64 0.64 sec 0.2 sec note: the above values are theoretical values not including data transfer time. the write time per chip depends on the write method to be used by the user. 3. programming method there are two types of the onboard programming mode for the user to program (rewrite) the device while it is mounted on the user's board: ? TMPM333FDFG/fyfg/fwfg page 365
device, it is easy to implement the functions into this device. furthermore, the user is not required to build his/her own programs to realize complicated write and erase functions because such functions are automatically performed using the circuits already built-in the flash memory chip. jedec compliant functions modified, added, or deleted functions ? ? ? ? 5. protect/ security function this device is also implemented with a read-protect function to inhibit reading flash memory data from any external writer device. on the other hand, rewrite protection is available only through com- mand-based software programming; any hardware setting method to apply +12vdc is not supported. see the chapter "rom protection" for details of rom protection and security function. note: if a password is set to 0xff (erased data), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.1 flash memory page 366
15.1.2 block diagram of the flash memory section figure 15-1 block diagram of the flash memory section TMPM333FDFG/fyfg/fwfg page 367 internal address bus internal data bus internal control bus control address data flash memory rom controller control circuit (includes automatic sequence control) command register address latch data latch column decoder/sense amplifier flash memory cell row decoder erase block decoder
15.2 operation mode this device has three operation modes including the mode not to use the internal flash memory. table 15-1 operation modes operation mode operation details single chip mode after reset is cleared, it starts up from the internal flash memory. normal mode in this operation mode, two different modes, i.e., the mode to execute user application programs and the mode to rewrite the flash memory onboard the users card, are defined. the former is referred to as "normal mode" and the latter "user boot mode. user boot mode the user can uniquely configure the system to switch between these two modes. for ex- ample, the user can freely design the system such that the normal mode is selected when the port "a0" is set to "1" and the user boot mode is selected when it is set to "0." the user should prepare a routine as part of the application program to make the decision on the selection of the modes. single boot mode after reset is cleared, it starts up from the internal boot rom (mask rom). in the boot rom, an algorithm to enable flash memory rewriting on the users set through the serial port of this device is programmed. by connecting to an external host computer through the serial port, the internal flash memory can be programmed by transferring data in accordance with predefined protocols. among the flash memory operation modes listed in the above table, the user boot mode and the single boot mode are the programmable modes. these two modes, the user boot mode and the single boot mode, are referred to as "onboard programming" modes where onboard rewriting of internal flash memory can be made on the user's card. either the single chip or single boot operation mode can be selected by externally setting the level of the boot (ph0) pin while the device is in reset status. table 15-2 operation mode setting operation mode pin reset boot (ph0) single chip mode 0 1 1 single boot mode 0 1 0 figure 15-2 mode transition diagram TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 368 user to set the switch method normal mode user boot mode reset state single boot mode onboard programming mode single chip mode
15.2.1 reset operation to reset the device, ensure that the power supply voltage is within the operating voltage range, that the internal oscillator has been stabilized, and that the reset input is held at "0" for a minimum duration of 12 system clocks (0.3 s with 40mhz operation; the "1/1" clock gear mode is applied after reset). note 1: regarding power-on reset of devices with internal flash memory; for devices with internal flash memory, it is necessary to apply "0" to the reset inputs upon power on for a minimum duration of 700 microseconds regardless of the operating frequency. note 2: while flash auto programming or deletion is in progress, at least 0.5 microseconds of reset period is required regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. TMPM333FDFG/fyfg/fwfg page 369
15.2.2 user boot mode (single chip mode) user boot mode is to use flash memory programming routine defined by users. it is used when the data transfer buses for flash memory program code on the old application and for serial i/o are different. it operates at the single chip mode; therefore, a switch from normal mode in which user application is activated at the single chip mode to user boot mode for programming flash is required. specifically, add a mode judgment routine to a reset program in the old application. the condition to switch the modes needs to be set by using the i/o of TMPM333FDFG/fyfg/fwfg in conformity with the users system setup condition. also, flash memory programming routine that the user uniquely makes up needs to be set in the new application. this routine is used for programming after being switched to user boot mode. the execution of the programming routine must take place while it is stored in the area other than the flash memory since the data in the internal flash memory cannot be read out during delete/ writing mode. once re-programming is complete, it is recommended to protect relevant flash blocks from acci- dental corruption during subsequent single-chip (normal mode) operations. be sure not to cause any exceptions including a non-maskable while user boot mode. (1-a) and (1-b) are the examples of programming with routines in the internal flash memory and in the external memory. for a detailed description of the erase and program sequence, refer to "15.3 on-board programming of flash memory (rewrite/erase)". 15.2.2.1 (1-a) method 1: storing a programming routine in the flash memory (1) step-1 determine the conditions (e.g., pin states) required for the flash memory to enter user boot mode and the i/o bus to be used to transfer new program code. create hardware and software accordingly. before installing the TMPM333FDFG/fyfg/fwfg on a printed circuit board, write the following program routines into an arbitrary flash block using programming equipment. (a) mode judgment routine: code to determine whether or not to switch to user boot mode (b) programming routine: code to download new program code from a host controller and re-program the flash memory (c) copy routine: code to copy the data described in (b) from the TMPM333FDFG/fyfg/fwfg flash memory to either the TMPM333FDFG/fyfg/fwfg on-chip ram or external mem- ory device. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 370 new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine TMPM333FDFG/fyfg/fwfg
(2) step-2 after reset is released, the reset procedure determines whether to put the TMPM333FDFG/fyfg/ fwfg flash memory in user boot mode. if mode switching conditions are met, the flash memory enters user boot mode. (all interrupts including nmi must be disabled while in user boot mode.) (3) step-3 once transition to user boot mode is occurred, execute the copy routine (c) to copy the flash pro- gramming routine (b) to the TMPM333FDFG/fyfg/fwfg on-chip ram. TMPM333FDFG/fyfg/fwfg page 371 new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine (b) programming routine TMPM333FDFG/fyfg/fwfg new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine 0 1 reset conditions for entering user boot mode (defined by the user) TMPM333FDFG/fyfg/fwfg
(4) step-4 jump program execution to the flash programming routine in the on-chip ram to erase a flash block containing the old application program code. (5) step-5 continue executing the flash programming routine to download new program code from the host controller and program it into the erased flash block. when the programming is completed, the writing or erase protection of that flash block in the users program area must be set. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 372 new application program code new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine (b) programming ? routine TMPM333FDFG/fyfg/fwfg new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine (b) programming routine (erased) TMPM333FDFG/fyfg/fwfg
(6) step-6 set reset to "0" to reset the TMPM333FDFG/fyfg/fwfg. upon reset, the on-chip flash memory is put in normal mode. after reset is released, the cpu will start executing the new application program code. TMPM333FDFG/fyfg/fwfg page 373 new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) programming routine (c) copy routine 0 1 reset set to normal mode TMPM333FDFG/fyfg/fwfg
15.2.2.2 (1-b) method 2: transferring a programming routine from an external host (1) step-1 determine the conditions (e.g., pin states) required for the flash memory to enter user boot mode and the i/o bus to be used to transfer new program code. create hardware and software accordingly. before installing the TMPM333FDFG/fyfg/fwfg on a printed circuit board, write the following program routines into an arbitrary flash block using programming equipment. (a) mode judgment routine: code to determine whether or not to switch to user boot mode (b) transfer routine: code to download new program code from a host controller also, prepare a programming routine shown below on the host controller: (c) programming routine: code to download new program code from an external host controller and re-program the flash memory TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 374 new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine old application program code (c) programming routine TMPM333FDFG/fyfg/fwfg
(2) step-2 after reset is released, the reset procedure determines whether to put the TMPM333FDFG/fyfg/ fwfg flash memory in user boot mode. if mode switching conditions are met, the flash memory enters user boot mode. (all interrupts including nmi must be disabled while in user boot mode). (3) step-3 once user boot mode is entered, execute the transfer routine (b) to download the flash programming routine (c) from the host controller to the TMPM333FDFG/fyfg/fwfg on-chip ram. TMPM333FDFG/fyfg/fwfg page 375 new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine old application program code (c) programming routine (c) programming routine TMPM333FDFG/fyfg/fwfg new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine old application program code (c) programming routine 0 1 reset conditions for entering user boot mode (defined by the user) TMPM333FDFG/fyfg/fwfg
(4) step-4 jump program execution to the flash programming routine in the on-chip ram to erase a flash block containing the old application program code. (5) step-5 continue executing the flash programming routine to download new program code from the host controller and program it into the erased flash block. when the programming is completed, the writing or erase protection of that flash block in the user program area must be set. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 376 new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine new application program code (c) programming routine (c) programming routine TMPM333FDFG/fyfg/fwfg new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine (c) programming routine (c) programming routine (erased) TMPM333FDFG/fyfg/fwfg
(6) step-6 set reset to "0" low to reset the TMPM333FDFG/fyfg/fwfg. upon reset, the on-chip flash memory is put in normal mode. after reset is released, the cpu will start executing the new appli- cation program code. TMPM333FDFG/fyfg/fwfg page 377 flash memory (host) (i/o) ram [reset procedure] (a) mode judgment routine (b) transfer routine new application program code 0 1 reset set to normal mode TMPM333FDFG/fyfg/fwfg
15.2.3 single boot mode in single boot mode, the flash memory can be re-programmed by using a program contained in the TMPM333FDFG/fyfg/fwfg on-chip boot rom. this boot rom is a masked rom. when single boot mode is selected upon reset, the boot rom is mapped to the address region including the interrupt vector table while the flash memory is mapped to an address region different from it. single boot mode allows for serial programming of the flash memory. channel 0 of the sio (sio0) of the TMPM333FDFG/fyfg/fwfg is connected to an external host controller. via this serial link, a programming routine is downloaded from the host controller to the TMPM333FDFG/fyfg/fwfg on-chip ram. then, the flash memory is re-programmed by executing the programming routine. the host sends out both commands and programming data to re-program the flash memory. communications between the sio0 and the host must follow the protocol described later. to secure the contents of the flash memory, the validity of the applications password is verified before a programming routine is downloaded into the on-chip ram. if password matching fails, the transfer of a programming routine itself is aborted. as in the case of user boot mode, all interrupts including the non-maskable interrupt (nmi) must be disabled in single boot mode while the flash memory is being erased or programmed. in single boot mode, the boot-rom programs are executed in normal mode. once re-programming is complete, it is recommended to protect relevant flash blocks from accidental corruption during subsequent single-chip (normal mode) operations. 15.2.3.1 (2-a) using the program in the on-chip boot rom (1) step-1 the flash block containing the older version of the program code need not be erased before executing the programming routine. since a programming routine and programming data are transferred via the sio (sio0), the sio0 must be connected to a host controller. prepare a programming routine (a) on the host controller. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 378 new application program code flash memory (host) (i/o) ram boot rom old application program code (or erased state) sio0 (a) programming routine TMPM333FDFG/fyfg/fwfg
(2) step-2 set the reset pin to "1" to cancel the reset of the TMPM333FDFG/fyfg/fwfg when the boot pin has already been set to "0". after reset, cpu reboots from the on-chip boot rom. the 12- byte password transferred from the host controller via sio0 is first compared to the contents of the special flash memory locations. (if the flash block has already been erased, the password is 0xff). (3) step-3 if the password was correct, the boot program downloads, via the sio0, the programming routine (a) from the host controller into the on-chip ram of the TMPM333FDFG/fyfg/fwfg. the program- ming routine must be stored in the range from 0x2000_0400 to the end address of ram. TMPM333FDFG/fyfg/fwfg page 379 new application program code flash memory (host) (i/o) ram boot rom old application program code (or erased state) sio0 (a) programming routine (a) programming routine TMPM333FDFG/fyfg/fwfg new application program code flash memory (host) (i/o) ram (a) programming routine boot rom old application program code (or erased state) sio0 0 1 reset 0 boot TMPM333FDFG/fyfg/fwfg
(4) step-4 the cpu jumps to the programming routine (a) in the on-chip ram to erase the flash block containing the old application program code. the block erase or chip erase command may be used. (5) step-5 next, the programming routine (a) downloads new application program code from the host controller and programs it into the erased flash block. when the programming is completed, the writing or erase protection of that flash block in the users program area must be set. in the example below, new program code comes from the same host controller via the same sio0 channel as for the programming routine. however, once the programming routine has begun to execute, it is free to change the transfer path and the source of the transfer. create board hardware and a pro- gramming routine to suit your particular needs. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 380 new application program code flash memory (host) (i/o) ram boot rom sio0 (a) programming routine (a) programming routine new application program code TMPM333FDFG/fyfg/fwfg new application program code flash memory (host) (i/o) ram boot rom sio0 (a) programming routine (a) programming routine erased TMPM333FDFG/fyfg/fwfg
(6) step-6 when programming of the flash memory is complete, power off the board and disconnect the cable leading from the host to the target board. turn on the power again so that the TMPM333FDFG/fyfg/ fwfg re-boots in single-chip (normal) mode to execute the new program. 15.2.4 configuration for single boot mode to execute the on-board programming, boot the TMPM333FDFG/fyfg/fwfg with single boot mode fol- lowing the configuration shown below. boot(ph0) = 0 reset = 0 1 set the reset input to "0", and set the each boot (ph0) pins to values shown above, and then release reset (high). TMPM333FDFG/fyfg/fwfg page 381 flash memory (host) (i/o) ram boot rom new application program code sio0 0 1 reset set to single-chip normal) mode (boot=1) TMPM333FDFG/fyfg/fwfg
15.2.5 memory map figure 15-3 shows a comparison of the memory maps in normal and single boot modes. in single boot mode, the internal flash memory is mapped to 0x3f80_0000 and later addresses, and the internal boot rom (mask rom) is mapped to 0x0000_0000 through 0x0000_1fff. the internal flash memory and ram addresses of each device are shown below. product name flash size ram size flash address (single chip/ single boot mode) ram address TMPM333FDFG 512 kb 32 kb 0x0000_0000 to 0x0007_ffff 0x3f80_0000 to 0x3f87_ffff 0x2000_0000 to 0x2000_7fff tmpm333fyfg 256 kb 16 kb 0x0000_0000 to 0x0003_ffff (0x0007_fe00 to 0x0007_ffff) (note) 0x3f80_0000 to 0x3f83_ffff (0x3f87_fe00 to 0x3f87_ffff) (note) 0x2000_0000 to 0x2000_3fff tmpm333fwfg 128 kb 8 kb 0x0000_0000 to 0x0001_ffff 0x3f80_0000 to 0x3f81_ffff 0x2000_0000 to 0x2000_1fff note:in addition to 256kb flash area, the tmpm333fyfg provides 128-word data/password area (1 page) for show product information command. figure 15-3 memory maps for TMPM333FDFG TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 382 0xffff_ffff single chip mode internal ram (32 kb) internal flash rom (512 kb) 0x2000_7fff 0x2000_0000 0x0007_ffff 0x0000_0000 internal i/o 0x4000_7fff 0x4000_0000 0xffff_ffff single boot mode internal ram (32 kb) internal boot rom (4 kb) 0x2000_7fff 0x2000_0000 0x0000_0fff 0x0000_0000 internal i/o 0x4000_7fff 0x4000_0000 internal flash rom (512 kb) 0x3f87_ffff 0x3f80_0000 0x3f7f_ffff 0x3f7f_f000 reserved
15.2.6 interface specification in single boot mode, an sio channel is used for communications with a programming controller. the same configuration is applied to a communication format on a programming controller to execute the on-board pro- gramming. both uart (asynchronous) and i/o interface (synchronous) modes are supported. the communi- cation formats are shown below. ? ? table 15-3 required pin connections pins interface uart i/o interface mode power supply pins rvdd3 avdd dvdd3 rvss avss dvss3 mode-setting pin boot (ph0) reset pin reset communication pins txd0 (pe0) rxd0 (pe1) sclk0 (pe2) (input mode) pe4 (output mode) TMPM333FDFG/fyfg/fwfg page 383
15.2.7 data transfer format table 15-4 and table 15-6 to table 15-9 illustrate the operation commands and data transfer formats at each operation mode. in conjunction with this section, refer to "15.2.10 operation of boot program". table 15-4 single boot mode commands code command 0x10 ram transfer 0x20 show flash memory sum 0x30 show product information 0x40 chip and protection bit erase 15.2.8 restrictions on internal memories single boot mode places restrictions on the internal ram and rom as shown in table 15-5. table 15-5 restrictions in single boot mode memory details internal ram a program contained in the boot rom uses the area, through 0x2000_0000 to 0x2000_03ff as a work area. store the ram transfer program from 0x2000_0400 through the end address of ram. internal rom the following addresses are assigned for storing software id information and passwords. storing program in these addresses is not recommendable. TMPM333FDFG: 0x3f87_ff00 to 0x3f87_ff0f tmpm333fyfg: 0x3f87_ff00 to 0x3f87_ff0f tmpm333fwfg: 0x3f81_ff00 to 0x3f81_ff0f 15.2.9 transfer format for single boot mode commands the following tables shows the transfer format for each single boot mode command. use this section in conjunction with chapter "15.2.10 operation of boot program". TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 384
15.2.9.1 ram transfer table 15-6 transfer format for the ram transfer command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/ fyfg/fwfg to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode : 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte for uart mode -normal acknowledge : 0x86 (the boot program aborts if the baud rate can not be set correctly.) for i/o interface mode -normal acknowledge :0x30 3 byte command code (0x10) ? 4 byte ? ack for the command code byte (note 2) -normal acknowledge : 0x10 -negative acknowledge : 0xx1 -communication error : 0xx8 5 byte to 16 byte password sequence (12 bytes) 0x3f87_ff04 to 0x3f87_ff0f (fd/fy) 0x3f81_ff04 to 0x3f81_ff0f (fw) ? 17 byte check sum value for bytes 5 - 16 ? 18 byte ? ack for the checksum byte (note 2) -normal acknowledge : 0x10 -negative acknowledge : 0xx1 -communication error : 0xx8 19 byte ram storage start address 31 to 24 ? 20 byte ram storage start address 23 to 16 ? 21 byte ram storage start address 15 to 8 ? 22 byte ram storage start address 7 to 0 ? 23 byte ram storage byte count 15 to 8 ? 24 byte ram storage byte count 7 to 0 ? 25 byte check sum value for bytes 19 to 24 ? 26 byte ? ack for the checksum byte (note 2) -normal acknowledge : 0x10 -negative acknowledge : 0xx1 -communication error : 0xx8 27 byte to m byte ram storage data ? m + 1 byte checksum value for bytes 27 ~ m ? m + 2 byte ? ack for the checksum byte (note 2) -normal acknowledge : 0x10 -negative acknowledge : 0xx1 -communication error : 0xx8 ram m + 3 byte ? jump to ram storage start address note 1: in i/o interface mode, the baud rate for the transfers of the first and second bytes must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. note 3: the 19th to 25th bytes must be within the ram address range from 0x2000_0400 through the end address of ram. note 4: fd/ fy/ fw in the above table denotes the TMPM333FDFG, tmpm333fyfg and tmpm333fwfg respectively. TMPM333FDFG/fyfg/fwfg page 385
15.2.9.2 show flash memory sum table 15-7 transfer format for the show flash memory sum command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/ fyfg/fwfg to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode: 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte for uart mode -normal acknowledge : 0x86 (the boot program aborts if the baud rate can not be set correctly.) for i/o interface mode -normal acknowledge : 0x30 3 byte command code (0x20) ? 4 byte ? ack for the command code byte (note 2) -normal acknowledge : 0x20 -negative acknowledge : 0xx1 -communication error : 0xx8 5 byte ? sum (upper byte) 6 byte ? sum (lower byte) 7 byte ? checksum value for bytes 5 and 6 8 byte (wait for the next command code.) ? note 1: in i/o interface mode, the baud rate for the transfers of the first and second bytes must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 386
15.2.9.3 transfer format for the show product information table 15-8 transfer format for the show product information command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/fyfg/ fwfg to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode: 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte for uart mode -normal acknowledge : 0x86 (the boot program aborts if the baud rate can not be set correctly.) for i/o interface mode -normal acknowledge : 0x30 3 byte command code (0x30) ? 4 byte ? ack for the command code byte (note 2) -normal acknowledge : 0x30 -negative acknowledge : 0xx1 -communication error : 0xx8 5 byte ? flash memory data at address 0x3f87_ff00 (fd/ fy) 0x3f81_ff00 (fw) 6 byte ? flash memory data at address 0x3f87_ff01 (fd/ fy) 0x3f81_ff01 (fw) 7 byte ? flash memory data at address 0x3f87_ff02 (fd/ fy) 0x3f81_ff02 (fw) 8 byte ? flash memory data at address 0x3f87_ff03 (fd/ fy) 0x3f81_ff03 (fw) 9 byte to 20 byte ? product name (12-byte ascii code) from the 9th byte: tmpm330fd_ _ (fd/ fy) tmpm330fw_ _ (fw) 21 byte to 24 byte ? password comparison start address (4 bytes) from the 21st byte: 0x04 , 0xff, 0x87, 0x3f (fd/fy) 0x04 , 0xff, 0x81, 0x3f (fw) 25 byte to 28 byte ? ram start address (4 bytes) from the 25th byte: 0x00, 0x00, 0x00, 0x20 (fd/fy/fw) 29 byte to 32 byte ? dummy data (4 bytes) from the 29th byte: 0x00, 0x00, 0x00, 0x00 (fd/fy/fw) 33 byte to 36 byte ? ram end address (4 bytes) from the 33rd byte: 0xff, 0x7f, 0x00, 0x20 (fd/fy) (note 4) 0xff, 0x1f, 0x00, 0x20 (fw) 37 byte to 40 byte ? dummy data (4 bytes) from the 37th byte: 0x00, 0x00, 0x00, 0x00 (fd/fy/fw) 41 byte to 44 byte ? dummy data (4 bytes) from the 41st byte: 0x00, 0x00, 0x00, 0x00 (fd/fy/fw) TMPM333FDFG/fyfg/fwfg page 387
table 15-8 transfer format for the show product information command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/fyfg/ fwfg to the controller 45 byte to 46 byte ? dummy data or fuse information (2 bytes) from the 45th byte: 0x00, 0x00 (fd/fy/fw) 47 byte to 50 byte ? flash memory start address (4 bytes) from the 47th byte: 0x00, 0x00, 0x80, 0x3f (fd/fy/fw) 51 byte to 54 byte ? flash memory end address (4 bytes) from the 51st byte: 0xff, 0xff, 0x87, 0x3f (fd/fy) (note 5) 0xff, 0xff, 0x81, 0x3f (fw) 55 byte to 56 byte ? flash memory block count (2 bytes) from the 55th byte: 0x06, 0x00 (fd/fy) 0x04, 0x00 (fw) 57 byte to 60 byte ? start address of a group of the same-size (16k) flash blocks (4 bytes) from 57th byte: 0x00, 0x00, 0x00, 0x00 (fd/fy) 0x00, 0x00, 0x80, 0x3f (fw) 61 byte to 64 byte ? size (in halfwords) of the same-size (16k) flash blocks (4 bytes) from 61st byte: 0x00, 0x20, 0x00, 0x00 (fd/fy/fw) 65 byte ? number of flash blocks of the same size (16k) (1 byte) 0x00 (fd/fy) 0x02 (fw) 66 byte to 69 byte ? start address of a group of the same-size (32k) flash blocks (4 bytes) from 66th byte: 0x00, 0x00, 0x80, 0x3f (fd/fy) 0x00, 0x80, 0x80, 0x3f (fw) 70 byte to 73 byte ? size (in halfwords) of the same-size (32k) flash blocks (4 bytes) from 70th byte: 0x00, 0x40, 0x00, 0x00 (fd/fy/fw) 74 byte ? number of flash blocks of the same size (32k) (1 byte) 0x02 (fd/fy) 0x01 (fw) 75 byte to 78 byte ? start address of a group of the same-size (64k) flash blocks (4 bytes) from 75th byte: 0x00, 0x00, 0x81, 0x3f (fd/fy/fw) 79 byte to 82 byte ? size (in halfwords) of the same-size (64k) flash blocks (4 bytes) from 79th byte: 0x00, 0x80, 0x00, 0x00 (fd/fy/fw) TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 388
table 15-8 transfer format for the show product information command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/fyfg/ fwfg to the controller 83 byte ? number of flash blocks of the same size (64k) (1 byte) 0x01 (fd/fy/fw) 84 byte to 87 byte ? start address of a group of the same-size (128k) flash blocks (4 bytes) from 84th byte: 0x00, 0x00, 0x82, 0x3f (fd/fy) 0x00, 0x00, 0x00, 0x00 (fw) 88 byte to 91 byte ? size (in halfwords) of the same-size (128k) flash blocks (4 bytes) from 88th byte: 0x00, 0x00, 0x01, 0x00 (fd/fy/fw) 92 byte ? number of flash blocks of the same size (128k) (1 byte) 0x03 (fd/fy) (note 6) 0x00 (fw) 93 byte ? checksum value for bytes 5 ~ 92 94 byte (wait for the next command code.) ? note 1: in i/o interface mode, the baud rate for the transfers of the first and second bytes must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. note 3: fd/ fy/ fw in the above table denotes the TMPM333FDFG, tmpm333fyfg and tmpm333fwfg respectively. note 4: the ram actual end address of the tmpm333fyfg is 0x2000_3fff. note 5: the flash memory actual end address of the tmpm333fyfg is 0x3f83_ffff. in addition to 256kb flash area, the tmpm333fyfg provides 128-word data/ password area (0x3f87_ff00 to 0x3f87_ff80, 1 page) for show product information command. note 6: the actual number of the tmpm333fyfg flash blocks is one. TMPM333FDFG/fyfg/fwfg page 389
15.2.9.4 chip erase and protect bit erase table 15-9 transfer format for the chip and protection bit erase command byte data transferred from the controller to the TMPM333FDFG/fyfg/fwfg baud rate data transferred from the TMPM333FDFG/ fyfg/fwfg to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode : 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte for uart mode -normal acknowledge : 0x86 for i/o interface mode -normal acknowledge : 0x30 (the boot program aborts if the baud rate can not be set correctly.) 3 byte command code (0x40) ? 4 byte ? ack for the command code byte (note 2) -normal acknowledge : 0x40 -negative acknowledge : 0xx1 -communication error : 0xx8 5 byte chip erase command code (0x54) ? 6 byte ? ack for the command code byte (note 2) -normal acknowledge : 0x54 -negative acknowledge : 0xx1 -communication error : 0xx8 7 byte ? ack for the chip erase command code byte -normal acknowledge : 0x4f -negative acknowledge : 0x4c 8 byte (wait for the next command code.) ? note 1: in i/o interface mode, the baud rate for the transfers of the first and second bytes must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 390
15.2.10 operation of boot program when single boot mode is selected, the boot program is automatically executed on startup. the boot program offers these four commands, of which the details are provided on the following subsections. 1. ram transfer command the ram transfer command stores program code transferred from a host controller to the on-chip ram and executes the program once the transfer is successfully completed. the user program ram space can be assigned to the range from 0x2000_0400 to the end address of ram, whereas the boot program area (0x2000_0000 ~ 0x2000_03ff) is unavailable. the user program starts at the assigned ram address. the ram transfer command can be used to download a flash programming routine of your own; this provides the ability to control on-board programming of the flash memory in a unique manner. the programming routine must utilize the flash memory command sequences described in section 15.3. before initiating a transfer, the ram transfer command verifies a password sequence coming from the controller against that stored in the flash memory. note: if a password is set to 0xff (erased data), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. 2. show flash memory sum command the show flash memory sum command adds the entire contents of the flash memory together. the boot program does not provide a command to read out the contents of the flash memory. instead, the flash memory sum command can be used for software revision management. 3. show product information command the show product information command provides the product name, on-chip memory configuration and the like. this command also reads out the contents of the flash memory locations at addresses shown below. in addition to the show flash memory sum command, these locations can be used for software revision management. product name area TMPM333FDFG tmpm333fyfg 0x3f87_ff00 to 0x3f87_ff03 tmpm333fwfg 0x3f81_ff00 to 0x3f81_ff03 4. chip and protection bit erase command this command erases the entire area of the flash memory automatically without verifying a password. all the blocks in the memory cell and their protection conditions are erased even when any of the blocks are prohibited from writing and erasing. when the command is completed, the fcsecbit bit is set to "1". this command serves to recover boot programming operation when a user forgets the password. therefore password verification is not executed. TMPM333FDFG/fyfg/fwfg page 391
15.2.10.1 ram transfer command see table 15-6 for the transfer format of this command. 1. the 1st byte specifies which one of the two serial operation modes is used. for a detailed de- scription of how the serial operation mode is determined, see "15.2.10.6 determination of a serial operation mode" described later. if it is determined as uart mode, the boot program then checks if the sio0 is programmable to the baud rate at which the 1st byte was transferred. during the first-byte interval, the rxe bit in the sc0mod register is cleared. ? ? ? ? TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 392
in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. when the sio0 is configured for i/o interface mode, the boot pro- gram does not check for a receive error. if the 3rd byte is equal to any of the command codes listed in table 15-4, the boot program echoes it back to the controller. when the ram transfer command was received, the boot program echoes back a value of 0x10 and then branches to the ram transfer routine. once this branch is taken, password verification is done. password verification is detailed in a later section "pass- word". if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 5. the 5th to 16th bytes transmitted from the controller to the target board, are a 12-byte password. each byte is compared to the contents of following addresses in the flash memory. the verification is started with the 5th byte and the smallest address in the designated area. if the password veri- fication fails, the ram transfer routine sets the password error flag. product name area TMPM333FDFG tmpm333fyfg 0x3f87_ff04 to 0x3f87_ff0f tmpm333fwfg 0x3f81_ff04 to 0x3f81_ff0f 6. the 17th byte is a checksum value for the password sequence (5th to 16th bytes). to calculate the checksum value for the 12-byte password, add the 12 bytes together, drop the carries and take the twos complement of the total sum. transmit this checksum value from the controller to the target board. the checksum calculation is described in details in a later section "checksum calculation". 7. the 18th byte, transmitted from the target board to the controller, is an acknowledge response to the 5th to 17th bytes. first, the ram transfer routine checks for a receive error in the 5th to 17th bytes. if there was a receive error, the boot program sends back 0x18 (bit 3) and returns to the state in which it waits for a command (i.e., the 3rd byte) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is configured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum operation to ensure data integrity. adding the series of the 5th to 16th bytes must result in 0x00 (with the carry dropped). if it is not 0x00, one or more bytes of data has been corrupted. in case of a checksum error, the ram transfer routine sends back 0x11 to the controller and returns to the state in which it waits for a command (i.e., the 3rd byte) again. finally, the ram transfer routine examines the result of the password verification. the fol- lowing two cases are treated as a password error. in these cases, the ram transfer routine sends back 0x11 (bit 0) to the controller and returns to the state in which it waits for a command (i.e., the 3rd byte) again. ? irrespective of the result of the password comparison, all the 12 bytes of a password in the flash memory are the same value other than 0xff. ? not the entire password bytes transmitted from the controller matched those contained in the flash memory. when all the above verification has been successful, the ram transfer routine returns a normal acknowledge response (0x10) to the controller. 8. the 19th to 22nd bytes, transmitted from the controller the target board, indicate the start address of the ram region where subsequent data (e.g., a flash programming routine) should be stored. the 19th byte corresponds to bits 31.24 of the address and the 22nd byte corresponds to bits 7.0 of the address. TMPM333FDFG/fyfg/fwfg page 393
9. the 23rd and 24th bytes, transmitted from the controller to the target board, indicate the number of bytes that will be transferred from the controller to be stored in the ram. the 23rd byte cor- responds to bits 15.8 of the number of bytes to be transferred, and the 24th byte corresponds to bits 7.0 of the number of bytes. 10. the 25th byte is a checksum value for the 19th to 24th bytes. to calculate the checksum value, add all these bytes together, drop the carries and take the twos complement of the total sum. transmit this checksum value from the controller to the target board. the checksum calculation is described in details in a later section "checksum calculation". 11. the 26th byte, transmitted from the target board to the controller, is an acknowledge response to the 19th to 25th bytes of data. first, the ram transfer routine checks for a receive error in the 19th to 25th bytes. if there was a receive error, the ram transfer routine sends back 0x18 and returns to the command wait state (i.e., the 3rd byte) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is configured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum operation to ensure data integrity. adding the series of the 19th to 25th bytes must result in 0x00 (with the carry dropped). if it is not 0x00, one or more bytes of data has been corrupted. in case of a checksum error, the ram transfer routine sends back 0x11 to the controller and returns to the state in which it waits for a command (i.e., the 3rd byte) again. the ram storage start address must be within the range of 0x2000_0400 to the end address of ram. when the above checks have been successful, the ram transfer routine returns a normal ac- knowledge response (0x10) to the controller. 12. the 27th to mth bytes from the controller are stored in the on-chip ram of the TMPM333FDFG/ fyfg/fwfg. storage begins at the address specified by the 19th.22nd bytes and continues for the number of bytes specified by the 23rd.24th bytes. 13. the (m+1) th byte is a checksum value. to calculate the checksum value, add the 27th to mth bytes together, drop the carries and take the twos complement of the total sum. transmit this checksum value from the controller to the target board. the checksum calculation is described in details in a later section "checksum calculation". 14. the (m+2) th byte is a acknowledge response to the 27th to (m+1) th bytes. first, the ram transfer routine checks for a receive error in the 27th to (m+1) th bytes. if there was a receive error, the ram transfer routine sends back 0x18 (bit 3) and returns to the state in which it waits for a command (i.e., the 3rd byte) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is configured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum operation to ensure data integrity. adding the series of the 27th to (m+1) th bytes must result in 0x00 (with the carry dropped). if it is not 0x00, one or more bytes of data has been corrupted. in case of a checksum error, the ram transfer routine sends back 0x11 (bit 0) to the controller and returns to the command wait state (i.e., the 3rd byte) again. when the above checks have been successful, the ram transfer routine returns a normal acknowledge response (0x10) to the controller. 15. if the (m+2) th byte was a normal acknowledge response, a branch is made to the address specified by the 19th to 22nd bytes. 15.2.10.2 show flash memory sum command see table 15-7 for the transfer format of this command. 1. the processing of the 1st and 2nd bytes are the same as for the ram transfer command. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 394
2. the 3rd byte, which the target board receives from the controller, is a command. the code for the show flash memory sum command is 0x20. 3. the 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. before sending back the acknowledge response, the boot program checks for a receive error. if there was a receive error, the boot program transmits 0xx8 (bit 3) and returns to the command wait state again. in this case, the upper four bits of the acknowledge response are un- defined - they hold the same values as the upper four bits of the previously issued command. when the sio0 is configured for i/o interface mode, the boot program does not check for a receive error. if the 3rd byte is equal to any of the command codes listed in table 15-4, the boot program echoes it back to the controller. when the show flash memory sum command was received, the boot program echoes back a value of 0x20 and then branches to the show flash memory sum routine. if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the command wait state (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 4. the show flash memory sum routine adds all the bytes of the flash memory together. the 5th and 6th bytes, transmitted from the target board to the controller, indicate the upper and lower bytes of this total sum, respectively. for details on sum calculation, see a later section "15.2.10.8 calculation of the show flash memory sum command". 5. the 7th byte is a checksum value for the 5th and 6th bytes. to calculate the checksum value, add the 5th and 6th bytes together, drop the carry and take the twos complement of the sum. transmit this checksum value from the controller to the target board. 6. the 8th byte is the next command code. 15.2.10.3 show product information command see table 15-8 for the transfer format of this command. 1. the processing of the 1st and 2nd bytes are the same as for the ram transfer command. 2. the 3rd byte, which the target board receives from the controller, is a command. the code for the show product information command is 0x30. 3. the 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. before sending back the acknowledge response, the boot program checks for a receive error. if there was a receive error, the boot program transmits 0xx8 (bit 3) and returns to the command wait state again. in this case, the upper four bits of the acknowledge response are un- defined - they hold the same values as the upper four bits of the previously issued command. when the sio0 is configured for i/o interface mode, the boot program does not check for a receive error. if the 3rd byte is equal to any of the command codes listed in table 15-4, the boot program echoes it back to the controller. when the show flash memory sum command was received, the boot program echoes back a value of 0x30 and then branches to the show flash memory sum routine. if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 4. the 5th to 8th bytes, transmitted from the target board to the controller, are the data read from addresses shown below in the flash memory. software version management is possible by storing a software id in these locations. product name area TMPM333FDFG tmpm333fyfg 0x3f87_ff00 to 0x3f87_ff03 tmpm333fwfg 0x3f81_ff00 to 0x3f81_ff03 TMPM333FDFG/fyfg/fwfg page 395
5. the 9th to 20th bytes, transmitted from the target board to the controller, indicate the product name as shown below (where [ ] is a space) in ascii code. product name code TMPM333FDFG tmpm333fyfg t, m, p, m, 3, 3, 0, f, d, _, [ ], _ tmpm333fwfg t, m, p, m, 3, 3, 0, f, w, _, [ ], _ 6. the 21st to 24th bytes, transmitted from the target board to the controller, indicate the start address of the flash memory area containing the password. each product has own start address shown below. product name address TMPM333FDFG tmpm333fyfg 0x04, 0xff,0x 87, 0x3f tmpm333fwfg 0x04, 0xff,0x 81, 0x3f 7. the 25th to 28th bytes, transmitted from the target board to the controller, indicate the start address of the on-chip ram, i.e., 0x00, 0x00, 0x00, 0x20. 8. the 29th to 32nd bytes, transmitted from the target board to the controller, are dummy data (0x00, 0x00, 0x00 and 0x00). 9. the 33rd to 36th bytes, transmitted from the target board to the controller, indicate the end address of the on-chip ram. each product has own end address shown below. product name address TMPM333FDFG tmpm333fyfg 0xff, 0x7f, 0x00, 0x20 tmpm333fwfg 0xff, 0x1f, 0x00, 0x20 note: the ram actual end address of the tmpm333fyfg is 0x2000_3fff. 10. the 37th to 40th bytes, transmitted from the target board to the controller, are 0x00, 0x00, 0x00 and 0x00. the 41st to 44th bytes, transmitted from the target board to the controller, are 0x00, 0x00, 0x00 and 0x00. 11. the 45th and 46th bytes transmitted are 0x00, 0x00. 12. the 47th to 50th bytes, transmitted from the target board to the controller, indicate the start address of the on-chip flash memory, are 0x00, 0x00, 0x80, and 0x3f. 13. the 51st to 54th bytes, transmitted from the target board to the controller, indicate the end address of the on-chip flash memory. each product has own end address shown below. product name address TMPM333FDFG tmpm333fyfg 0xff, 0xff, 0x87, 0x3f tmpm333fwfg 0xff, 0xff, 0x81, 0x3f note: the flash memory actual end address of the tmpm333fyfg is 0x3f83_ffff. in addition to 256kb flash area, the tmpm333fyfg provides 128-word data area (0x3f87_ff00 . 0x3f87_ff80, 1 page) for show product information command and the password area. 14. the 55th to 56th bytes, transmitted from the target board to the controller, indicate the TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 396
number of flash blocks available. each product transmits own number shown below. product name number of flash blocks TMPM333FDFG 0x06, 0x00 tmpm333fyfg 0x06, 0x00 tmpm333fwfg 0x04, 0x00 15. the 57th to 83rd bytes, transmitted from the target board to the controller, contain information about the flash blocks. flash blocks of the same size are treated as a group. information about the flash blocks indicate the start address of a group, the size of the blocks in that group (in halfwords) and the number of the blocks in that group. the 57th to 65th bytes are the information about the 16-kbyte blocks. the 66th to 74th bytes are the information about the 32-kbyte blocks. the 75th to 83rd bytes are the information about the 64-kbyte blocks. the 84th to 92nd bytes are the in- formation about the 128-kbyte blocks. see table 15-8 for the values of bytes transmitted. 16. the 66th byte, transmitted from the target board to the controller, is a checksum value for the 5th to 92nd bytes. the checksum value is calculated by adding all these bytes together, dropping the carry and taking the twos complement of the total sum. 17. the 94th byte is the next command code. TMPM333FDFG/fyfg/fwfg page 397
15.2.10.4 chip and protection bit erase command see table 15-9 for the transfer format of this command. 1. the processing of the 1st and 2nd bytes are the same as for the ram transfer command. 2. from the controller to the TMPM333FDFG/fyfg/fwfg the 3rd byte, which the target board receives from the controller, is a command. the code for the show product information command is 0x40. 3. from the TMPM333FDFG/fyfg/fwfg to the controller the 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. before sending back the acknowledge response, the boot program checks for a receive error. if there was a receive error, the boot program transmits 0xx8 (bit 3) and returns to the command wait state again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. if the 3rd byte is equal to any of the command codes listed in table 15-4, the boot program echoes it back to the controller. when the show flash memory sum command was received, the boot program echoes back a value of 0x40. if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 4. from the controller to the TMPM333FDFG/fyfg/fwfg the 5th byte, transmitted from the target board to the controller, is the chip erase enable command code (0x54). 5. from the TMPM333FDFG/fyfg/fwfg to the controller the 6th byte, transmitted from the target board to the controller, is an acknowledge response to the 5th byte. before sending back the acknowledge response, the boot program checks for a receive error. if there was a receive error, the boot program transmits 0xx8 (bit 3) and returns to the command wait state again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. if the 5th byte is equal to any of the command codes to enable erasing, the boot program echoes it back to the controller. when the chip and protection erase command was received, the boot program echoes back a value of 0x54 and then branches to the chip erase routine. if the 5th byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 6. from the TMPM333FDFG/fyfg/fwfg to the controller the 7th byte indicates whether the chip erase command is normally completed or not. at normal completion, completion code (0x4f) is sent. when an error was detected, error code (0x4c) is sent. 7. the 9th byte is the next command code. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 398
15.2.10.5 acknowledge responses the boot program represents processing states with specific codes. table 15-10 to table 15-13 show the values of possible acknowledge responses to the received data. the upper four bits of the acknowledge re- sponse are equal to those of the command being executed. bit 3 of the code indicates a receive error. bit 0 indicates an invalid command error, a checksum error or a password error. bit 1 and bit 2 are always "0". receive error checking is not done in i/o interface mode. table 15-10 ack response to the serial operation mode byte return value meaning 0x86 the sio can be configured to operate in uart mode. (see note) 0x30 the sio can be configured to operate in i/o interface mode. note: if the serial operation mode is determined as uart, the boot program checks if the sio can be program- med to the baud rate at which the operation mode byte was transferred. if that baud rate is not possible, the boot program aborts, without sending back any response. table 15-11 ack response to the command byte return value meaning 0x?8 (see note) a receive error occurred while getting a command code. 0x?1 (see note) an undefined command code was received. (reception was completed normally.) 0x10 the ram transfer command was received. 0x20 the show flash memory sum command was received. 0x30 the show product information command was received. 0x40 the chip erase command was received. note: the upper four bits of the ack response are the same as those of the previous command code. table 15-12 ack response to the checksum byte return value meaning 0xn8 (see note) a receive error occurred. 0xn1 (see note) a checksum or password error occurred. 0xn0 (see note) the checksum was correct. note:the upper four bits of the ack response are the same as those of the operation command code. it is 1 (n ; ram transfer command data [7:4] ) when password error occurs. table 15-13 ack response to chip and protection bit erase byte return value meaning 0x54 the chip erase enabling command was received. 0x4f the chip erase command was completed. 0x4c the chip erase command was abnormally completed. TMPM333FDFG/fyfg/fwfg page 399
15.2.10.6 determination of a serial operation mode the first byte from the controller determines the serial operation mode. to use uart mode for commu- nications between the controller and the target board, the controller must first send a value of 0x86 at a desired baud rate to the target board. to use i/o interface mode, the controller must send a value of 0x30 at 1/16 the desired baud rate. figure 15-4 shows the waveforms for the first byte. figure 15-4 serial operation mode byte after reset is released, the boot program monitors the first serial byte from the controller, with the sio reception disabled, and calculates the intervals of tab, tac and tad. figure 15-5 shows a flowchart describing the steps to determine the intervals of tab, tac and tad. as shown in the flowchart, the boot program captures timer counts each time a logic transition occurs in the first serial byte. consequently,the calculated tab, tac and tad intervals are bound to have slight errors. if the transfer goes at a high baud rate, the cpu might not be able to keep up with the speed of logic transitions at the serial receive pin. in particular, i/o interface mode is more prone to this problem since its baud rate is generally much higher than that for uart mode. to avoid such a situation, the controller should send the first serial byte at 1/16 the desired baud rate. the flowchart in figure 15-5 shows how the boot program distinguishes between uart and i/o interface modes. if the length of tab is equal to or less than the length of tcd, the serial operation mode is determined as uart mode. if the length of tab is greater than the length of tcd, the serial operation mode is determined as i/o interface mode. bear in mind that if the baud rate is too high or the timer operating frequency is too low, the timer resolution will be coarse, relative to the intervals between logic transitions. this becomes a problem due to inherent errors caused by the way in which timer counts are captured by software; consequently the boot program might not be able to determine the serial operation mode correctly. to prevent this problem, reset uart mode within the programming routine. for example, the serial operation mode may be determined to be i/o interface mode when the intended mode is uart mode. to avoid such a situation, when uart mode is utilized, the controller should allow for a time-out period within which it expects to receive an echo-back (0x86) from the target board. the controller should give up the communication if it fails to get that echo-back within the allowed time. when i/o interface mode is utilized, once the first serial byte has been transmitted, the controller should send the sclk clock after a certain idle time to get an acknowledge response. if the received acknowledge response is not 0x30, the controller should give up further communications. when the intended mode is i/o interface mode, the first byte does not have to be 0x30 as long as tab is greater than tcd as shown above. 0x91, 0xa1 or 0xb1 can be sent as the first byte code to determine the falling edges of point a and point c and the rising edges of point b and point d. if tab is greater than tcd and sio is selected by the resolution of the operation mode determination, the second byte code is 0x30 even though the transmitted code on the first byte is not 0x30 (the first byte code to determine i/o interface mode is described as 0x30). TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 400 uart (0x86) tab point a start bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 stop point b point c point d tcd i/o interface (0x30) tab point a bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 point b point c point d tcd
figure 15-5 serial operation mode byte reception flowchart TMPM333FDFG/fyfg/fwfg page 401 start initialize tmrb0 prescaler is on.(source clock: t0) high-to-low transition on serial receive pin? tmrb0 starts counting up low-to-high transition on serial receive pin? software-capture and save timer value (tab) yes yes high-to-low transition on serial receive pin? software-capture and save timer value (tac) yes low-to-high transition on serial receive pin? software-capture and save timer value (tad) yes 16-bit timer 0 stops counting w ac  tad? make backup copy of tad value point a point b point c point d done stop operation (infinite loop waiting for reset) yes
figure 15-6 serial operation mode determination flowchart 15.2.10.7 password the ram transfer command (0x10) causes the boot program to perform password verification. following an echo-back of the command code, the boot program verifies the contents of the 12-byte password area within the flash memory. the following table shows the password area of each product. product name area TMPM333FDFG tmpm333fyfg 0x3f87_ff04 to 0x3f87_ff0f tmpm333fwfg 0x3f81_ff04 to 0x3f81_ff0f note: if a password is set to 0xff (erased data area), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. if all these address locations contain the same bytes of data other than 0xff, a password area error occurs as shown in figure 15-7. in this case, the boot program returns an error acknowledge (0x11) in response to the checksum byte (the 17th byte), regardless of whether the password sequence sent from the controller is all 0xffs. the password sequence received from the controller (5th to 16th bytes) is compared to the password stored in the flash memory. all of the 12 bytes must match to pass the password verification. otherwise, a password error occurs, which causes the boot program to reply an error acknowledge in response to the checksum byte (the 17th byte). the password verification is performed even if the security function is enabled. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 402 start tcd  tad  tac w ab > tcd? uart mode yes i/o interface mode
figure 15-7 password area verification flowchart TMPM333FDFG/fyfg/fwfg page 403 start are all bytes the same? yes are all bytes equal to ffh? password area error password area is normal. yes
15.2.10.8 calculation of the show flash memory sum command the result of the sum calculation "byte + byte + byte + ??? note: in the tmp333fyfg, the range from 256kb through the password area and from the password area through 0x007_ffff area are calculated as "0xff". 15.2.10.9 checksum calculation the checksum byte for a series of bytes of data is calculated by adding the bytes together, dropping the carries, and taking the twos complement of the total sum. the show flash memory sum command and the show product information command perform the checksum calculation. the controller must perform the same checksum operation in transmitting checksum bytes. example) assume the show flash memory sum command provides the upper and lower bytes of the sum as 0xe5 and 0xf6. to calculate the checksum for a series of 0xe5 and 0xf6: add the bytes together 0xe5 + 0xf6 = 0x1db take the twos complement of the sum, and that is the checksum byte. 0 ? 0xdb = 0x25 TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.2 operation mode page 404 for the interest of simplicity, assume the depth of the flash memory is four locations. then the sum of the four bytes is calculated as: 0xa1 + 0xb2 + 0xc3 + 0xd4 = 0x02ea hence, 0x02 is first sent to the controller, followed by 0xea. 0xa1 0xb2 0xc3 0xd4 example)
15.2.11 general boot program flowchart figure 15-8 shows an overall flowchart of the boot program. figure 15-8 overall boot program flowchart TMPM333FDFG/fyfg/fwfg page 405 single boot program starts initialize get sio operation mode  sio operation mode? set i/o interface mode ack data received data (0x30) i/o interface (send 0x30) normal response prepare to get a command ack data ack data & 0xf0 receive routine get a command  receive error ?  ram transfer? ack data received data (0x10) transmission routine (send 0x10: normal response) ram transfer processing  sum? ack data received data (0x20) transmission routine (send 0x20: normal response) show flash memory sum processing no normally yes (0x10)  show product information? ack data received data (0x30) transmission routine (send 0x30: normal response) show product information processing yes (0x20) yes (0x30)  chip erase? ack data received data (0x40) transmission routine (send 0x40: normal response) chip erase processing yes (0x40) ack data ack data 0x08 transmission routine (send 0xx8:receive error yes ack data received data (0x01) command error transmission routine (send 0xx1: command error)  processed normally? jump to ram yes normally  baud rate setting ? ack data received data (0x86@uart) can be set (send 0x86) normal response stop operation uart cannot be set program uart mode and baud rate
15.3 on-board programming of flash memory (rewrite/erase) in on-board programming, the cpu is to execute software commands for rewriting or erasing the flash memory. the rewrite/erase control program should be prepared by the user beforehand. because the flash memory content cannot be read while it is being written or erased, it is necessary to run the rewrite/erase program from the internal ram after shifting to the user boot mode. 15.3.1 flash memory except for some functions, writing and erasing flash memory data are in accordance with the standard jedec commands. in writing or erasing, use 32-bit data transfer command of the cpu to enter commands to the flash memory. once the command is entered, the actual write or erase operation is automatically performed internally. table 15-14 flash memory functions major functions description automatic page program writes data automatically per page. automatic chip erase erases the entire area of the flash memory automatically. automatic block erase erases a selected block automatically. protect function the write or erase operation can be individually inhibited for each block. 15.3.1.1 block configuration (1) TMPM333FDFG figure 15-9 block configuration of flash memory (TMPM333FDFG) TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 406 128k bytes (block0) 0x3f87_ffff 128k bytes (block1) 128k bytes (block2) 64k bytes (block3) 32k bytes (block5) 32k bytes (block4) 0x3f86_0000 0x3f84_0000 0x3f82_0000 0x3f81_0000 0x3f80_8000 0x3f80_0000 single boot mode 0x0007_ffff 0x0006_0000 0x0004_0000 0x0002_0000 0x0001_0000 0x0000_8000 0x0000_0000 user boot mode 128 zrugv? 256 page configuration 128 zrugv? 256 128 zrugv? 256 128 zrugv? 128 128 zrugv? 64 128 zrugv? 64
(2) tmpm333fyfg figure 15-10 block configuration of flash memory (tmpm333fyfg) note: in addition to 256kb flash area, the tmpm 333 fyfg provides 128-word data/password area (0x3f87_fe00 . 0x3f87_ffff, 1 page) for show product information command. to erase the content, execute the automatic chip erase command or assign block 0 with the automatic block erase command. (3) tmpm333fwfg figure 15-11 block configuration of flash memory (tmpm333fwfg) TMPM333FDFG/fyfg/fwfg page 407 64k bytes (block0) 32k bytes (block1) 16k bytes (block3) 16k bytes (block2) 0x3f81_ffff 0x3f81_0000 0x3f80_8000 0x3f80_4000 0x3f80_0000 single boot mode 0x0001_ffff 0x0001_0000 0x0000_8000 0x0000_4000 0x0000_0000 user boot mode page configuration 64 zrugv? 256 64 zrugv? 128 64 zrugv? 64 64 zrugv? 64 128k bytes (block0) 0x3f87_ffff 128k bytes (block1) 128k bytes (block2) 64k bytes (block3) 32k bytes (block5) 32k bytes (block4) 0x3f86_0000 0x3f84_0000 0x3f82_0000 0x3f81_0000 0x3f80_8000 0x3f80_0000 single boot mode 0x0007_ffff 0x0006_0000 0x0004_0000 0x0002_0000 0x0001_0000 0x0000_8000 0x0000_0000 user boot mode 128 zrugv? 1 page configuration 128 zrugv? 256 128 zrugv? 128 128 zrugv? 64 128 zrugv? 64 0x3f83_ffff 0x0003_ffff 0x0007_fe00 0x3f87_fe00
15.3.1.2 basic operation this flash memory device has the following two operation modes: ? ? (1) read when data is to be read, the flash memory must be set to the read mode. the flash memory will be set to the read mode immediately after power is applied, when cpu reset is removed, or when an automatic operation is normally terminated. in order to return to the read mode from other modes or after an automatic operation has been abnormally terminated, either the read/reset command (a software command to be described later) or a hardware reset is used. the device must also be in the read mode when any command written on the flash memory is to be executed. ? ? (2) command write this flash memory uses the command control method. commands are executed by executing a com- mand sequence to the flash memory. the flash memory executes automatic operation commands according to the address and data combinations applied (refer to command sequence). if it is desired to cancel a command write operation already in progress or when any incorrect com- mand sequence has been entered, the read/reset command is to be executed. then, the flash memory will terminate the command execution and return to the read. while commands are generally comprised of several bus cycles, the operation to apply 32-bit data transmit command to the flash memory is called "bus write cycle." the bus write cycles are to be in a specific sequential order and the flash memory will perform an automatic operation when the sequence of the bus write cycle data and address of a command write operation is in accordance with a predefined specific sequence. if any bus write cycle does not follow a predefined command write sequence, the flash memory will terminate the command execution and return to the read mode. note 1: command sequences are executed from outside the flash memory area. note 2: each bus write cycle must be sequentially executed by 32-bit data transmit command. while a command sequence is being executed, access to the flash memory is prohibited. also, don't generate any interrupt (except debug exceptions when a debug port is connected).if such an operation is made, it can result in an unexpected read access to the flash memory and the command sequencer may not be able to correctly recognize the command. while it could cause an abnormal termination of the command sequence, it is also possible that the written command is incorrectly recognized. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 408
note 3: for the command sequencer to recognize a command, the device must be in the read mode prior to executing the command. be sure to check before the first bus write cycle that fcflcs is set to "1." it is recommended to subsequently execute a read com- mand. note 4: upon issuing a command, if any address or data is incorrectly written, be sure to perform a software reset to return to the read mode again. 15.3.1.3 reset(hardware reset) a hardware reset is used to cancel the operational mode set by the command write operation when forcibly termination during auto programming/ erasing or abnormal termination during automatic operation. the flash memory has a reset input as the memory block and it is connected to the cpu reset signal. therefore, when the reset input pin of this device is set to vil or when the cpu is reset due to any overflow of the watch dog timer, the flash memory will return to the read mode terminating any automatic operation that may be in progress. it should also be noted that applying a hardware reset during an automatic operation can result in incorrect rewriting of data. in such a case, be sure to perform the rewriting again. refer to section "15.2.1 reset operation" for cpu reset operations. after a given reset input, the cpu will read the reset vector data from the flash memory and starts operation after the reset is removed. 15.3.1.4 commands (1) automatic page programming writing to a flash memory device is to make "1" data cells to "0" data cells. any "0" data cell cannot be changed to a "1" data cell. for making "0" data cells to "1" data cells, it is necessary to perform an erase operation. the automatic page programming function of this device writes data of each page. the TMPM333FDFG/ tmpm333fyfg contain 128 words and the tmpm333fwfg contains 64 words in a page. a 128 word block is defined by a same [31:9] address and it starts from the address [8:0] = 0x00 and ends at the address [8:0] = 0x1ff. a 64 word block is defined by a same [31:8] address and it starts from the address [7:0] = 0x00 and ends at the address [7:0] = 0xff. this programming unit is hereafter referred to as a "page". writing to data cells is automatically performed by an internal sequencer and no external control by the cpu is required. the state of automatic page programming (whether it is in writing operation or not) can be checked by fcflcs [0] . also, any new command sequence is not accepted while it is in the automatic page programming mode. if it is desired to interrupt the automatic page programming, use the hardware reset function. if the operation is stopped by a hardware reset operation, it is necessary to once erase the page and then perform the automatic page programming again because writing to the page has not been normally terminated. the automatic page programming operation is allowed only once for a page already erased. no pro- gramming can be performed twice or more times irrespective of the data cell value whether it is "1" or "0." note that rewriting to a page that has been once written requires execution of the automatic block erase or automatic chip erase command before executing the automatic page programming command again. note that an attempt to rewrite a page two or more times without erasing the content can cause damages to the device. no automatic verify operation is performed internally to the device. so, be sure to read the data programmed to confirm that it has been correctly written. the automatic page programming operation starts when the third bus write cycle of the command cycle is completed. on and after the fifth bus write cycle, data will be written sequentially starting from TMPM333FDFG/fyfg/fwfg page 409
the next address of the address specified in the fourth bus write cycle (in the fourth bus write cycle, the page top address will be command written) (32 bits of data is input at a time). be sure to use the 32-bit data transfer command in writing commands on and after the fourth bus cycle. in this, any 32-bit data transfer commands shall not be placed across word boundary. on and after the fifth bus write cycle, data is command written to the same page area. even if it is desired to write the page only partially, it is required to perform the automatic page programming for the entire page. in this case, the address input for the fourth bus write cycle shall be set to the top address of the page. be sure to perform command write operation with the input data set to "1" for the data cells not to be set to "0." for example, if the top address of a page is not to be written, set the input data of the fourth bus write cycle to 0xffffffff to command write the data. once the third bus cycle is executed, the automatic page programming is in operation. this condition can be checked by monitoring fcflcs. any new command sequence is not accepted while it is in automatic page programming mode. if it is desired to stop operation, use the hardware reset function. be careful in doing so because data cannot be written normally if the operation is interrupted. when a single page has been command written normally terminating the automatic page writing process, fcflcs is set to "1" and it returns to the read mode. when multiple pages are to be written, it is necessary to execute the page programming command for each page because the number of pages to be written by a single execution of the automatic page program command is limited to only one page. it is not allowed for automatic page programming to process input data across pages. data cannot be written to a protected block. when automatic programming is finished, it automatically returns to the read mode. this condition can be checked by monitoring fcflcs . if au- tomatic programming has failed, the flash memory is locked in the mode and will not return to the read mode. for returning to the read mode, it is necessary to execute hardware reset to reset the flash memory or the device. in this case, while writing to the address has failed, it is recommended not to use the device or not to use the block that includes the failed address. note: software reset becomes ineffective in bus write cycles on and after the fourth bus write cycle of the automatic page programming command. (2) automatic chip erase the automatic chip erase operation starts when the sixth bus write cycle of the command cycle is completed. this condition can be checked by monitoring fcflcs . while no automatic verify operation is performed internally to the device, be sure to read the data to confirm that data has been correctly erased. any new command sequence is not accepted while it is in an automatic chip erase operation. if it is desired to stop operation, use the hardware reset function. if the operation is forced to stop, it is necessary to perform the automatic chip erase operation again because the data erasing oper- ation has not been normally terminated. also, any protected blocks cannot be erased. if all the blocks are protected, the automatic chip erase operation will not be performed and it returns to the read mode after completing the sixth bus read cycle of the command sequence. when an automatic chip erase operation is normally terminated, it automat- ically returns to the read mode. if an automatic chip erase operation has failed, the flash memory is locked in the mode and will not return to the read mode. for returning to the read mode, it is necessary to execute hardware reset to reset the device. in this case, the failed block cannot be detected. it is recommended not to use the device anymore or to identify the failed block by using the block erase function for not to use the identified block anymore. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 410
(3) automatic block erase (for each block) the automatic block erase operation starts when the sixth bus write cycle of the command cycle is completed. this status of the automatic block erase operation can be checked by monitoring fcflcs . while no automatic verify operation is performed internally to the device, be sure to read the data to confirm that data has been correctly erased. any new command sequence is not accepted while it is in an automatic block erase operation. if it is desired to stop operation, use the hardware reset function. in this case, it is necessary to perform the automatic block erase operation again because the data erasing operation has not been normally terminated. also, any protected blocks cannot be erased. if an automatic block erase operation has failed, the flash memory is locked in the mode and will not return to the read mode. in this case, execute hardware reset to reset the device. (4) automatic programming of protection bits (for each block) this device is implemented with protection bits. this protection can be set for each block. see table 15-18 for table of protection bit addresses. this device assigns 1 bit to 1 block as a protection bit. the applicable protection bit is specified by pba in the seventh bus write cycle. by automatically program- ming the protection bits, write and/or erase functions can be inhibited (for protection) individually for each block. the protection status of each block can be checked by fcflcs to be described later. this status of the automatic programming operation to set protection bits can be checked by monitoring fcflcs . any new command sequence is not accepted while automatic programming is in progress to program the protection bits. if it is desired to stop the programming operation, use the hardware reset function. in this case, it is necessary to perform the programming operation again because the protection bits may not have been correctly programmed. if all the protection bits have been programmed, all fcflcs are set to "1" indicating that it is in the protected state. this disables subsequent writing and erasing of all blocks. note: software reset is ineffective in the seventh bus write cycle of the automatic protection bit programming command. fcflcs turns to "0" after entering the seventh bus write cycle. (5) automatic erasing of protection bits different results will be obtained when the automatic protection bit erase command is executed de- pending on the status of the protection bits and the security bits. it depends on the status of fcflcs whether all are set to "1" or not if fcsecbit is 0x1. be sure to check the value of fcflcs before executing the automatic protection bit erase command. see the chapter "rom protection" for details. note: the tmpm333fyfg is configured with block 2 through 5. block 0 and 1 require a pro- gramming of protection bits when using security function. ? TMPM333FDFG/fyfg/fwfg page 411
protection bits by fcflcs after retuning to the read mode and perform either the automatic protection bit erase, automatic chip erase, or automatic block erase operation, as appropriate. when fcflcs include "0" (not all the protection bits are programmed): if the automatic protection bit is cleared to "0", the protection condition is canceled. with this device, protection bits can be programmed to an individual block and performed bit-erase operation in the four bits unit as shown in table 15-19. the target bits are specified in the seventh bus write cycle.the protection status of each block can be checked by fcflcs to be described later. this status of the programming operation for automatic pro- tection bits can be checked by monitoring fcflcs . when the automatic operation to erase protection bits is normally terminated, the protection bits of fcflcs selected for erasure are set to "0". in any case, any new command sequence is not accepted while it is in an automatic operation to erase protection bits. if it is desired to stop the operation, use the hardware reset function. when the automatic operation to erase protection bits is normally terminated, it returns to the read mode. note: the fcflcs bit is "0" while in automatic operation and it turns to "1" when the automatic operation is terminated. (6) id-read using the id-read command, you can obtain the type and other information on the flash memory contained in the device. the data to be loaded will be different depending on the address [15:14] of the fourth and subsequent bus write cycles (recommended input data is 0x00). on and after the fourth bus write cycle, when an arbitrary flash memory area is read, the id value will be loaded. once the fourth bus write cycle of an id-read command has passed, the device will not automatically return to the read mode. in this condition, the set of the fourth bus write cycle and id-read commands can be repetitively executed. for returning to the read mode, use the read/reset command or hardware reset command. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 412
15.3.1.5 flash control/ status register base address = 0x4004_0500 register name address(base+) security bit register fcsecbit 0x0000 reserved - 0x0004 flash control register fcflcs 0x0020 reserved - 0x0024 reserved - 0x0028 note: access to the "reserved" areas is prohibited. (1) fcflcs (flash control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - blpro5 blpro4 blpro3 blpro2 blpro1 blpro0 after reset 0 0 (note2) (note2) (note2) (note2) (note2) (note2) 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - rdy/bsy after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-22 ? r read as 0. 21-16 blpro5 to blpro0 r protection for block5 to 0 (note 3) 0: disabled 1: enabled protection status bits each of the protection bits represents the protection status of the corresponding block. when a bit is set to "1," it indicates that the block corresponding to the bit is protected. when the block is protected, data cannot be written to it. 15-1 ? r read as 0. 0 rdy/bsy r ready/busy (note 1) 0: auto operating 1:auto operation terminated ready/busy flag bit the rdy/bsy output is provided as a means to monitor the status of automatic operation. this bit is a function bit for the cpu to monitor the function. when the flash memory is in automatic operation, it outputs "0" to indicate that it is busy. when the automatic operation is terminated, it returns to the ready state and outputs "1" to accept the next command. if the automatic operation has failed, this bit maintains the "0" output. by applying a hardware reset, it returns to "1." note 1: this command must be issued in the ready state. issuing the command in the busy state may disable both correct command transmission and further command input. to exit from the condition, execute system reset. system reset requires at least 0.5 s regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. note 2: the value varies depending on protection applied. note 3: the fcflcs[21:20] of tmpm333fwfg have no function. they are read as "0". TMPM333FDFG/fyfg/fwfg page 413
(2) fcsecbit (security bit register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - secbit after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-1 ? r read as 0. 0 secbit r/w security bits 0:disabled 1:enabled note: this register is initialized by cold reset. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 414
15.3.1.6 list of command sequences table 15-15 shows the addresses and the data of each command of flash memory. bus cycles are "bus write cycles" except for the second bus cycle of the read command, the fourth bus cycle of the read/reset command, and the fifth bus cycle of the id-read command. bus write cycles are executed by 32-bit (word) data transfer commands. (in the following table, only lower 8 bits data are shown.) see table 15-16 for the detail of the address bit configuration. use a value of "addr." in the table 15-15 for the address [15:8] of the normal command in the table 15-16. note: always set "0" to the address bits [1:0] in the entire bus cycle. table 15-15 flash memory access from the internal cpu command sequence first bus cy- cle second bus cycle third bus cy- cle fourth bus cycle fifth bus cy- cle sixth bus cy- cle seventh bus cycle addr. addr. addr. addr. addr. addr. addr. data data data data data data data read 0xxx ? ? ? ? ? ? 0xf0 ? ? ? ? ? ? read/reset 0x54xx 0xaaxx 0x54xx ra ? ? ? 0xaa 0x55 0xf0 rd ? ? ? id-read 0x54xx 0xaaxx 0x54xx ia 0xxx ? ? 0xaa 0x55 0x90 0x00 id ? ? automatic page program- ming 0x54xx 0xaaxx 0x54xx pa pa pa pa 0xaa 0x55 0xa0 pd0 pd1 pd2 pd3 automatic chip erase 0x54xx 0xaaxx 0x54xx 0x54xx 0xaaxx 0x54xx ? 0xaa 0x55 0x80 0xaa 0x55 0x10 ? auto block erase 0x54xx 0xaaxx 0x54xx 0x54xx 0xaaxx ba ? 0xaa 0x55 0x80 0xaa 0x55 0x30 ? protection bit program- ming 0x54xx 0xaaxx 0x54xx 0x54xx 0xaaxx 0x54xx pba 0xaa 0x55 0x9a 0xaa 0x55 0x9a 0x9a protection bit erase 0x54xx 0xaaxx 0x54xx 0x54xx 0xaaxx 0x54xx pba 0xaa 0x55 0x6a 0xaa 0x55 0x6a 0x6a supplementary explanation ? ? ? ? ? ? ? TMPM333FDFG/fyfg/fwfg page 415
15.3.1.7 address bit configuration for bus write cycles table 15-16 is used in conjunction with table 15-15 "flash memory access from the internal cpu." address setting can be performed according to the normal bus write cycle address configuration from the first bus cycle. "0" is recommended" in the table 15-16 address bit configuration for bus write cycles can be changed as necessary. table 15-16 address bit configuration for bus write cycles address addr [31:19] addr [18] addr [17] addr [16] addr [15] addr [14] addr [13:11] addr [10] addr [9] addr [8] addr [7:0] [TMPM333FDFG/fyfg/fwfg] normal com- mands normal bus write cycle address configuration flash area "0" is recommended. command addr[1:0]="0" (fixed) others:0 (recommended) id-read ia: id address (set the fourth bus write cycle address for id-read operation) flash area "0" is recommended. id address addr[1:0]="0" (fixed) , others:0 (recommended) [TMPM333FDFG/fyfg] block erase ba: block address (set the sixth bus write cycle address for block erase operation) block selection (table 15-17) addr[1:0]="0" (fixed) , others:0 (recommended) auto page program- ming pa: program page address (set the fourth bus write cycle address for page programming operation) page selection addr[1:0]="0" (fixed) others:0 (recommended) protection bit program- ming pba: protection bit address (set the seventh bus erase cycle address for protection bit erasure) flash area protection bit selection (table 15-18) fixed to "0". protection bit selection (table 15-18) addr[1:0]="0" (fixed) others:0 (recommended) protection bit erase pba: protection bit address (set the seventh bus erase cycle address for protection bit erasure) flash area protection bit selection (table 15-19) "0" is recommended. addr[1:0]="0" (fixed) others:0 (recommended) [tmpm333fwfg] block erase ba: block address (set the sixth bus write cycle address for block erase operation) block selection (table 15-17) addr[1:0]="0" (fixed) , others:0 (recommended) auto page program- ming pa: program page address (set the fourth bus write cycle address for page programming operation) page selection addr[1:0]="0" (fixed) others:0 (recommended) protection bit program- ming pba: protection bit address (set the seventh bus write cycle address for protection bit programming flash area protection bit selection (table 15-18) fixed to "0". protection bit selection (table 15-18) addr[1:0]="0" (fixed) others:0 (recommen- ded) protection bit erase pba: protection bit address (set the seventh bus erase cycle address for protection bit erasure) flash area protection bit selection (table 15-19) fixed to "0". addr[1:0]="0" (fixed) others:0 (recommended) TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 416
as block address, specify any address in the block to be erased. table 15-17 block address table block address (user boot mode) address (single boot mode) size (kbyte) [TMPM333FDFG/fyfg] 4 0x0000_0000 ~ 0x0000_7fff 0x3f80_0000 ~ 0x3f80_7fff 32 5 0x0000_8000 ~ 0x0000_ffff 0x3f80_0000 ~ 0x3f80_ffff 32 3 0x0001_0000 ~ 0x0001_ffff 0x3f81_0000 ~ 0x3f81_ffff 64 2 0x0002_0000 ~ 0x0003_ffff 0x3f82_0000 ~ 0x3f83_ffff 128 1 0x0004_0000 ~ 0x0005_ffff 0x3f84_0000 ~ 0x3f85_ffff 128 0 0x0006_0000 ~ 0x0007_ffff 0x3f86_8000 ~ 0x3f87_ffff 128 [tmpm333fwfg] 2 0x0000_0000 ~ 0x0000_3fff 0x3f80_0000 ~ 0x3f80_3fff 16 3 0x0000_4000 ~ 0x0000_7fff 0x3f80_4000 ~ 0x3f80_7fff 16 1 0x0000_8000 ~ 0x0000_ffff 0x3f80_8000 ~ 0x3f80_ffff 32 0 0x0001_0000 ~ 0x0001_ffff 0x3f81_0000 ~ 0x3f81_ffff 64 note: as for the addresses from the first to the fifth bus cycles, specify the upper addresses of the blocks to be erased. table 15-18 protection bit programming address table block protection bit the seventh bus write cycle address address [18] address [17] address [16] address [15:11] address [10] address [9] address [8] [TMPM333FDFG/fyfg] block0 0 0 1 fixed to "0". 0 0 "0" is rec- ommen- ded. block1 0 0 1 0 1 block2 0 0 1 1 0 block3 0 0 1 1 1 block4 0 1 0 0 0 block5 0 1 0 0 1 [tmpm333fwfg] block0 0 0 fixed to "0". 0 0 block1 0 0 0 1 block2 0 0 1 0 block3 0 0 1 1 TMPM333FDFG/fyfg/fwfg page 417
table 15-19 protection bit erase address table block protection bit the seventh bus write cycle address [18:17] address[18] address[17] block0 to 3 0 0 block4 to 5 0 1 note: the protection bit erase command cannot erase by individual block. table 15-20 the id-read command's fourth bus write cycle id address (ia) and the data to be read by the following 32-bit data transfer command (id) ia[15:14] id[7:0] code 00b 0x98 manufacturer code 01b 0x5a device code 10b reserved ? 11b 0x12 (TMPM333FDFG) 0x12 (tmpm333fyfg) 0x11 (tmpm333fwfg) macro code TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 418
15.3.1.8 flowchart figure 15-12 automatic programming note: command sequence is executed by 0x54xx or 0x55xx. TMPM333FDFG/fyfg/fwfg page 419 start automatic page programming command sequence (see the flowchart shown below) the address of the last page? yes automatic page programming address = address + 0x200 (set by a page) no automatic page programming command sequence (address/ command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0xa0 programming address (page address)/ programming data (32 bit data)
figure 15-13 automatic erase note: command sequence is executed by 0x54xx or 0x55xx. TMPM333FDFG/fyfg/fwfg 15. flash memory operation 15.3 on-board programming of flash memory (rewrite/erase) page 420 start automatic chip erase command sequence (see the flowchart shown below) automatic chip erase completed a utomatic chip erase command sequence (address/ command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x80 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x10 automatic block/ multi-block erase command sequence (address/ command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x80 0x54xx/0xaa 0xaaxx/0x55 block address/0x30
16. rom protection 16.1 outline the TMPM333FDFG/fyfg/fwfg offers two kinds of rom protection/ security functions. one is a write/ erase-protection function for the internal flash rom data. the other is a security function that restricts internal flash rom data readout and debugging. 16.2 future 16.2.1 write/ erase-protection function the write/ erase-protection function enables the internal flash to prohibit the writing and erasing operation for each block. to activate the function, write "1" to the corresponding bits to a block to protect. writing "0" to the bits cancels the protection. the protection settings of the bits can be monitored by the fcflcs bit. see the chapter "flash" for programming details. 16.2.2 security function the security function restricts flash rom data readout and debugging. this function is available under the conditions shown below. 1. the fcsecbit bit is set to"1". 2. all the protection bits (the fcflcs bits) used for the write/erase-protection function are set to "1". note: the fcsecbit bit is set to "1" at a power-on reset right after power-on. note: the tmpm333fyfg is configured with block 2 through 5. block 0 and 1 require a programming of protection bits when using security function. table 16-1 shows details of the restrictions by the security function. table 16-1 restrictions by the security function item details 1) rom data readout data can be read from cpu. 2) debug port communication of jtag/sw and trace are prohibited 3) command for flash memory writing a command to the flash memory is prohibited. an attempt to erase the contents in the bits used for the write/erase- protection erases all the protection bits. TMPM333FDFG/fyfg/fwfg page 421
16.3 register base address = 0x4004_0500 register name address(base+) security bit register fcsecbit 0x0000 reserved - 0x0004 flash control register fcflcs 0x0020 reserved - 0x0024 reserved - 0x0028 note: access to the "reserved" areas is prohibited. TMPM333FDFG/fyfg/fwfg 16. rom protection 16.3 register page 422
16.3.1 fcflcs (flash control register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - blpro5 blpro4 blpro3 blpro2 blpro1 blpro0 after reset 0 0 (note2) (note2) (note2) (note2) (note2) (note2) 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - rdy/bsy after reset 0 0 0 0 0 0 0 1 bit bit symbol type function 31-22 ? r read as 0. 21-16 blpro5 to blpro0 r protection for block5 to 0 (note 3) 0: disabled 1: enabled protection status bits each of the protection bits represents the protection status of the corresponding block. when a bit is set to "1," it indicates that the block corresponding to the bit is protected. when the block is protected, data cannot be written to it. 15-1 ? r read as 0. 0 rdy/bsy r ready/busy (note 1) 0: auto operating 1:auto operation terminated ready/busy flag bit the rdy/bsy output is provided as a means to monitor the status of automatic operation. this bit is a function bit for the cpu to monitor the function. when the flash memory is in automatic operation, it outputs "0" to indicate that it is busy. when the automatic operation is terminated, it returns to the ready state and outputs "1" to accept the next command. if the automatic operation has failed, this bit maintains the "0" output. by applying a hardware reset, it returns to "1." note 1: this command must be issued in the ready state. issuing the command in the busy state may disable both correct command transmission and further command input. to exit from the condition, execute system reset. system reset requires at least 0.5 ms regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. note 2: the value varies depending on protection applied. note 3: the fcflcs[21:20] of tmpm333fwfg have no function. they are read as "0". TMPM333FDFG/fyfg/fwfg page 423
16.3.2 fcsecbit(security bit register) 31 30 29 28 27 26 25 24 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 23 22 21 20 19 18 17 16 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 bit symbol - - - - - - - - after reset 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 bit symbol - - - - - - - secbit after reset 0 0 0 0 0 0 0 1 bit bit symbol type ?@?\ 31-1 ? r read as 0. 0 secbit r/w security bit 0: disabled 1: enabled note:this register is initialized only by power-on reset. TMPM333FDFG/fyfg/fwfg 16. rom protection 16.3 register page 424
16.4 writing and erasing 16.4.1 protection bits writing and erasing protection bits are available with a single chip mode, single boot mode and writer mode. writing to the protection bits is done on block-by-block basis. erasing of the protection bits is done by two groups of the blocks: block 0 through 3 and block 4 through 5. when the settings for all the blocks are "1", erasing must be done after setting the fcsecbit bit to "0". setting "1" at that situation erases all the protection bits. to write and erase the protection bits, command sequence is used. see the capter "flash" for details 16.4.2 security bit the fcsecbit bit that activates security function is set to "1" at a power-on reset right after power-on. the bit is rewritten by the following procedure. 1. write the code 0xa74a9d23 to fcsecbit register. 2. write data within 16 clocks from the above.1. note:the above procedure is enabled only when using 32-bit data transfer command. TMPM333FDFG/fyfg/fwfg page 425
TMPM333FDFG/fyfg/fwfg 16. rom protection 16.4 writing and erasing page 426
17. electrical characteristics 17.1 absolute maximum ratings parameter symbol rating unit supply voltage dvdd3 ?0.3 to 3.9 v avdd3 ?0.3 to 3.9 rvdd3 ?0.3 to 3.9 input voltage v in ?0.3 to vdd + 0.3 v low-level output current per pin i ol 5 ma total i ol 50 high-level output current per pin i oh ?5 total i oh -50 power consumption (ta = 85 c) pd 600 mw soldering temperature(10 s) t solder 260 c storage temperature t stg ?40 to 125 c operating tempera- ture except during flash w/e t opr ?20 to 85 c during flash w/e 0 to 70 note: absolute maximum ratings are limiting values of operating and environmental conditions which should not be exceeded under the worst possible conditions. the equipment manufacturer should design so that no absolute maximum rating value is exceeded with respect to current, voltage, power consumption, temperature, etc. exposure to conditions beyond those listed above may cause permanent damage to the device or affect device reliability, which could increase potential risks of personal injury due to ic blowup and/or burning. TMPM333FDFG/fyfg/fwfg page 427
17.2 dc electrical characteristics (1/3) ta = ?20 to 85 c parameter symbol condition min typ. (note 1) max unit supply volt- age dvdd3 = avdd3 = rvdd3 (note2) dvss = avss = 0v dvdd3 avdd3 rvdd3 f osc = 8 to 10 mhz fsys = 1 to 40 mhz fs = 30 to 34 khz 2.7 ? 3.6 v low-level input volt- age pc0 to 3, pd4 to 7 v il1 2.7 v avdd3 3.6 v ?0.3 ? 0.3 avdd3 v pd0 to 3 v il2 0.2 avdd3 pa2 to 7, pb0, pb3 to 7, pe0, pe4, pf0, pg7, pi0 to 5, pj4 to 5,pk1 to 2 v il3 2.7 v dvdd3 3.6 v 0.3 dvdd3 pa0 to 1, pb1 to 2, pe1 to 3, pe5 to 6, pf1 to 7, pg0 to 6, ph0 to 7, pi6 to 7, pj0 to 3, pj6 to 7 reset, nmi, mode v il4 0.2 dvdd3 pk0 v il5 x1 v il6 0.1 dvdd3 high-level input volt- age pc0 to 3, pd4 to 7 v ih1 2.7 v avdd3 3.6 v 0.7 avdd3 ? avdd3 + 0.3 v pd0 to 3 v ih2 0.8 avdd3 pa2 to 7, pb0, pb3 to 7, pe0, pe4, pf0, pg7, pi0 to 5, pj4 to 5,pk1 to 2 v ih3 2.7 v dvdd3 3.6 v 0.7 dvdd3 dvdd3 + 0.3 pa0 to 1, pb1 to 2, pe1 to 3, pe5 to 6, pf1 to 7, pg0 to 6, ph0 to 7, pi6 to 7, pj0 to 3, pj6 to 7 reset, nmi, mode v ih4 0.8 dvdd3 pk0 v ih5 3.6 x1 v ih6 0.9 dvdd3 dvdd3 + 0.3 low-level output voltage v ol i ol = 2 ma dvdd3 2.7 v ? ? 0.4 v high-level output voltage v oh i oh = ?2 ma dvdd3 2.7 v 2.4 ? ? v input leak- age current except pk0 i li1 0.0 v in dvdd3 0.0 v in avdd3 ? 0.02 5 a pk0 i li2 0.0 v v in 3.6 v output leakage current except pk0 i lo1 0.2 v in dvdd3 ? 0.2 0.2 v in avdd3 ? 0.2 ? 0.05 10 pk0 i lo2 0.2 v v in 3.4 v pull-up resister at reset rrst dvdd3 = 2.7 v to 3.6 v 30 50 1 50 k hysteresis voltage vth 2.7 v dvdd3 3.6 v 0.3 0.6 ? v programmable pull-up/pull-down resistor pkh dvdd3 = 2.7 v to 3.6 v ? 50 150 k pin capacitance (except power supply pins) c io fc = 1 mhz ? ? 10 pf note 1: ta = 25 c, dvdd3 = rvdd3 = avdd3 = 3.3 v, unless otherwise noted. note 2: the same voltage must be supplied to dvdd3, avdd3, and rvdd3. TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.2 dc electrical characteristics (1/3) page 428
17.3 dc electrical characteristics (2/3) dvdd3 = avdd3 = rvdd3 = 2.7 v to 3.6 v, ta = ?20 to 85 c parameter symbol condition min typ. max unit low-level output current i ol per pin ? ? 2 ma i ol1 per group grl1 = 6 to 12,89pin grl2 = 15 to 37pin grl3 = 15=61pin grl4 = 15 to 37pin ? ? 18 ma i ol2 total ? ? 35 ma high-level output current i oh per pin ? ? -2 ma i oh1 per group grl1 = 6 to 12,89pin grl2 = 15 to 37pin grl3 = 15=61pin grl4 = 15 to 37pin ? ? -18 ma i oh2 total ? ? -35 ma note: the same voltage must be supplied to dvdd3, avdd3, and rvdd3. TMPM333FDFG/fyfg/fwfg page 429
17.4 dc electrical characteristics (3/3) 17.4.1 TMPM333FDFG/tmpm333fyfg dvdd3 = avdd3 = rvdd3 = 2.7 v to 3.6 v, ta = ?20 to 85 c parameter symbol condition min typ. (note1) max unit normal (note2) gear 1/1 i dd fsys = 40 mhz (f osc = 10 mhz) ? 32 42 ma idle (note3) ? 8 13 slow fs = 32.768 khz ? 2.5 6 sleep ? 55 950 a stop ? ? 55 900 note 1: ta = 25 c, dvdd3 = avdd3 = rvdd3 = 3.3 v, unless otherwise noted. note 2: i dd normal: measured with the dhrystone ver. 2.1 operated in flash. all functions operates excluding a/d . note 3: i dd idle: measured with all functions stopped.the currents flow through dvdd3, avdd3 and rvdd3 are inclu- ded. 17.4.2 tmpm333fwfg dvdd3 = avdd3 = rvdd3 = 2.7 v to 3.6 v, ta = ?20 to 85 c parameter symbol condition min typ. (note1) max unit normal (note2) gear 1/1 i dd fsys = 40 mhz (f osc = 10 mhz) ? 26 32 ma idle (note3) ? 8 12.5 slow fs = 32.768 khz ? 2.5 5.5 sleep ? 55 900 a stop ? ? 45 850 note 1: ta = 25 c, dvdd3 = avdd3 = rvdd3 = 3.3 v, unless otherwise noted. note 2: i dd normal: measured with the dhrystone ver. 2.1 operated in flash. all functions operates excluding a/d note 3: i dd idle: measured with all functions stopped.the currents flow through dvdd3, avdd3 and rvdd3 are inclu- ded. TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.4 dc electrical characteristics (3/3) page 430
17.5 10-bit adc electrical characteristics dvdd3 = avdd3 = rvdd3 = vrefh = 2.7 v to 3.6 v avss = dvss, ta = ?20 to 85 c parameter symbol condition min typ. max unit analog reference voltage(+) vrefh ? 2.7 3.3 3.6 v analog input voltage vain ? avss ? vrefh v power supply current of ana- log reference voltage ad conversion iref dvss = avss ? 2.5 5.5 ma non-ad con- version ? 0.02 5 a supply current ad conversion ? except iref ? ? 3 ma inl error ? ain resistance 600 ain load capacitance 30 pf conversion time 1.15 s ? 2 3 lsb dnl error ? 1 2 offset error ? 2 4 full-scale error ? 2 4 inl error ? ain resistance 600 ain load capacitance 0.1 f conversion time 1.15 s ? 2 3 dnl error ? 1 2 offset error ? 2 4 full-scale error ? 2 4 inl error ? ain resistance 10 k ain load capacitance 0.1 f conversion time 2.30 s ? 2 3 dnl error ? 1 2 offset error ? 2 4 full-scale error ? 2 4 note: 1lsb = (vrefh ? avss)/1024 [v] note: peripheral functions are disable. TMPM333FDFG/fyfg/fwfg page 431
17.6 ac electrical characteristics 17.6.1 ac measurement condition the ac characteristics data of this chapter is measured under the following conditions unless otherwise noted ? ? ? 17.6.2 serial channel (sio/uart) 17.6.2.1 i/o interface mode in the table below, the letter x represents the sio operation clock cycle time which is identical to the fsys cycle time. it varies depending on the programming of the clock gear function. (1) sclk input mode parameter symbol equation 40 mhz unit min max min max sclk clock high width (input) t sch 3x ? 75 ? ns sclk clock low width (input) t scl 3x ? 75 ? sclk cycle t scy t sch + t scl ? 150 ? output data sclk rise or fall (note 1) t oss t scy /2 ? 3x? 45 ? ?45 (note2) ? sclk rise output data hold or fall(note1) t ohs t scy /2 ? 75 ? valid data input sclk rise or fall(note1) t srd 30 ? 30 ? sclk rise input data hold or fall(note1) t hsr x + 30 ? 55 ? note 1: sclk rise or fall measured relative to the programmed active edge of sclk. note 2: keep this value positive by adjusting sclk cycle. TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.6 ac electrical characteristics page 432
(2) sclk output mode parameter symbol equation 40 mhz unit min max min max sclk cycle (programmable) t scy 4x ? 100 ? ns output data sclk rise t oss t scy /2 ? 20 ? 30 ? sclk rise output hold data hold t ohs t scy /2 ? 20 ? 30 ? valid data input sclk rise t srd 45 ? 45 ? sclk rise input data hold t hsr 0 ? 0 ? TMPM333FDFG/fyfg/fwfg page 433 012 3 1 valid output data txd input data rxd sclk (output mode/ input high mode) sclk (input low mode) t oss t scy t sch t scl t ohs 0 t srd 23 t hsr valid valid valid
17.6.3 serial bus interface(i2c/sio) 17.6.3.1 i2c mode in the table below, the letter x represents the i2c operation clock cycle time which is identical to the fsys cycle time. it varies depending on the programming of the clock gear function. n denotes the value of n programmed into the sck (scl output frequency select) field in the sbixcr. parameter symbol equation standard mode fast mode unit min max min max min max scl clock frequency t scl 0 ? 0 100 0 400 khz hold time for start condition t hd; sta ? ? 4.0 ? 0.6 ? s scl low width (input) (note 1) t low ? ? 4.7 ? 1.3 ? s scl high width (input) (note 2) t high ? ? 4.0 ? 0.6 ? s setup time for a repeated start condition t su; sta (note5) ? 4.7 ? 0.6 ? s data hold time (input) (note 3, 4) t hd; dat ? ? 0.0 ? 0.0 ? s data setup time t su; dat ? ? 250 ? 100 ? ns setup time for a stop condition t su; sto ? ? 4.0 ? 0.6 ? s bus free time between stop condition and start condition t buf (note5) ? 4.7 ? 1.3 ? s note 1: scl clock low width (output) = (2 n - 1 + 58)/x note 2: scl clock high width (output) = (2 n - 1 + 12)/x on i2c-bus specification, maximum speed of standard mode is 100khz, fast mode is 400khz. internal scl frequency setting should comply with note1 & note2 shown above. note 3: the output data hold time is equal to 12x of internal scl. note 4: the philips i2c-bus specification states that a device must internally provide a hold time of at least 300 ns for the sda signal to bridge the undefined region of the falling edge of scl. however, this sbi does not satisfy this requirement. also, the output buffer for scl does not incorporate slope control of the falling edges; therefore, the equipment manufacturer should design so that the input data hold time shown in the table is satisfied, in- cluding tr/tf of the scl and sda lines. note 5: software -dependent note 6: the philips i2c-bus specification instructs that if the power supply to a fast-mode device is switched off, the sda and scl i/o pins must be floating so that they don't obstruct the bus lines. however, this sbi does not satisfy this requirement. TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.6 ac electrical characteristics page 434 scl t scl t low t high t r t f t hd;dat t su;dat t hd;sta sda t su;sta t buf t su;sto p sr s s: start condition sr: repeated start condition p: stop condition
17.6.3.2 clock-synchronous 8-bit sio mode in the table below, the letter x represents the i2c operation clock cycle time which is identical to the fsys cycle time. it varies depending on the programming of the clock gear function. (1) sck input mode (the electrical specifications below are for an sck signal with a 50% duty cycle.) parameter symbol equation 40 mhz unit min max min max sck clock high width (input) t sch 4x ? 100 ? ns sck clock low width (input) t scl 4x ? 100 ? sck cycle t scy t sch + t scl ? 200 ? output data sck rise t oss t scy /2 ? 3x ? 45 ? ?20 (note) ? sck rise output data hold t ohs t scy /2 + x ? 125 ? valid data input sck rise t srd 30 ? x ? 5 ? sck rise input data hold t hsr 30 ? 30 ? note: keep this value positive by adjusting sck cycle. (2) sck output mode (the electrical specifications below are for an sck signal with a 50% duty cycle.) parameter symbol equation 40 mhz unit min max min max sck cycle (programmable) t scy 16x ? 400 ? ns output data sck rise t oss t scy /2 ? 20 ? 180 ? sck rise output data hold t ohs t scy /2 ? 20 ? 180 ? valid data input sck rise t srd 45 ? 45 ? sck rise input data hold t hsr 0 ? 0 ? TMPM333FDFG/fyfg/fwfg page 435 012 3 1 valid output data so input data si sck t oss t scy t sch t scl t ohs 0 t srd 23 t hsr valid valid valid
17.6.4 event counter in the table below, the letter x represents the tmrb operation clock cycle time which is identical to the fsys cycle time. it varies depending on the programming of the clock gear function. parameter symbol equation 40 mhz unit min max min max clock low pulse width t vckl 2x + 100 ? 150 ? ns clock high pulse width t vckh 2x + 100 ? 150 ? ns 17.6.5 capture in the table below, the letter x represents the tmrb operation clock cycle time which is identical to the fsys cycle time. it varies depending on the programming of the clock gear function. parameter symbol equation 40 mhz unit min max min max low pulse width t cpl 2x + 100 ? 150 ? ns high pulse width t cph 2x + 100 ? 150 ? ns 17.6.6 external interrupt in the table below, the letter x represents the fsys cycle time. 1. except stop release interrupts parameter symbol equation 40 mhz unit min max min max int0 to 7 low level pulse width t intal x + 100 ? 125 ? ns int0 to 7 high level pulse width t intah x + 100 ? 125 ? ns 2. stop release interrupts parameter symbol min max unit int0 to 7 low level pulse width t intbl 125 ? ns int0 to 7 high level pulse width t intbh 125 ? ns TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.6 ac electrical characteristics page 436
17.6.7 nmi parameter symbol min max unit nim low level pulse width t intcl 100 ? ns 17.6.8 scout pin ac characteristic parameter symbol equation 40 mhz unit min max min max high pulse width t sch 0.5t ? 5 ? 7.5 ? ns low pulse width t scl 0.5t ? 5 ? 7.5 ? ns note: in the above table, the letter t represents the cycle time of the scout output clock. TMPM333FDFG/fyfg/fwfg page 437 t sch scout t scl
17.6.9 debug communication 17.6.9.1 swd interface parameter symbol min max unit clk cycle t dck 83.33 ? ns clk rise output data hold t d1 4 ? ns clk rise output data valid t d2 ? 30 ns input data valid clk rise t ds 20 ? ns clk rise input data hold t dh 15 ? ns 17.6.9.2 jtag interface parameter symbol min max unit clk cycle t dck 100 ? ns clk fall output data hold t d3 4 ? ns clk fall output data valid t d4 ? 50 ns input data valid clk rise t ds 20 ? ns clk rise input data hold t dh 15 ? ns TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.6 ac electrical characteristics page 438 t dck t d1 t d2 t d3 t d4 t ds t dh clk input (swclk) (tck) output data (swdio) output data (tdo) input data (swdio) (tms/tdi)
17.6.10 etm trace parameter symbol min max unit traceclk cycle t tclk 50 ? ns tracedata valid traceclk rise t setupr 2 ? ns traceclk rise tracedata hold t holdr 1 ? ns tracedata valid traceclk fall t setupf 2 ? ns traceclk fall tracedata hold t holdf 1 ? ns 17.7 flash characteristics 17.7.1 rewriting parameter condition min typ. max unit guarantee on flash-memory rewriting dvdd3 = avdd3 = rvdd3 = 2.7 v to 3.6 v ta = 0 to 70 c ? ? 100 times TMPM333FDFG/fyfg/fwfg page 439 012 3 tracedata 0 to 3 traceclk t setupf t tclk t holdf t setupr t holdr
17.8 recommended oscillation circuit figure 17-1 high-frequency oscillation connection note: to obtain a stable oscillation, load capacity and the position of the oscillator must be configured properly. since these factors are strongly affected by substratepatterns, please evaluate oscillation stability using the substrate you use. the tx03 has been evaluated by the oscillator vender below. please refer this information when selecting external parts 17.8.1 ceramic oscillator the tx03 recommends the high-frequency oscillator by murata manufacturing co., ltd. please refer to the following url for details. http://www.murata.co.jp 17.8.2 crystal oscillator the tx03 recommends the high-frequency oscillator by kyocera kinseki corporation. please refer to the following url for details http://www.kinseki.co.jp TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.8 recommended oscillation circuit page 440 x1 x2
17.9 handling precaution 17.9.1 solderability test parameter test condition note solderability use of sn-37pb solder bath solder bath temperature = 230c, dipping time = 5 seconds the number of times = one, use of r-type flux pass: solderability rate until forming 95% use of sn-3.0ag-0.5cu solder bath solder bath temperature = 245c, dipping time = 5 seconds the number of times = one, use of r-type flux 17.9.2 power-on sequence the power supply must be raised (from 0v to 2.7v) at a speed of 0.37ms/v or slower. the power-on sequence must consider the time for the internal regulator and oscillator to be stablein the .in the tx03, the internal regulator requires at least 700 s to be stable. the time required to achieve stable oscillation varies with system. at cold reset, the external reset pin must be kept "low" for a duration of time sufficiently long enough for the internal regulator and oscillator to be stable. figure 17-2 shows the power-on sequence. figure 17-2 power-on sequence TMPM333FDFG/fyfg/fwfg page 441 rvdd3, dvdd3, avdd3 2.7 v 700 s(min.) 12 cycle(min.) reset high-speed oscillation 0 v 0.37ms/v (min.)
TMPM333FDFG/fyfg/fwfg 17. electrical characteristics 17.9 handling precaution page 442
18. port section equivalent circuit schematic basically, the gate symbols written are the same as those used for the standard cmos logic ic [74hcxx] series. the input protection resistance ranges from several tens of to several hundreds of . damping resistors x2 and xt2 are shown with a typical value. 18.1 pa0, pb1 to 2, pe1 to 3, pe5 to 6, pf1 to 7, pg0 to 6, ph0 to 7, pi6 to 7, pj0 to 3, pj6 to 7 18.2 pa1 TMPM333FDFG/fyfg/fwfg page 443 output data p-ch output enable input data input enable n-ch i/o port pull-down enable schmitt programmable pull-down resistor output data p-ch output enable input data input enable n-ch i/o port pull-up enable schmitt programmable pull-up resistor
18.3 pa2 to 7, pb0, pb3 to 7, pe0, pe4, pf0, pg7, pi0 to 5, pj4 to 5, pk1 to 2 18.4 pc0 to 3, pd4 to 7 18.5 pd0 to 3 TMPM333FDFG/fyfg/fwfg 18. port section equivalent circuit schematic 18.3 pa2 to 7, pb0, pb3 to 7, pe0, pe4, pf0, pg7, pi0 to 5, pj4 to 5, pk1 to 2 page 444 input data input enable input port programmable pull-up resistor pull-up enable input ain output data p-ch output enable input data input enable n-ch i/o port pull-up enable programmable pull-up resistor input data input enable input port programmable pull-up resistor pull-up enable input ain schmitt
18.6 pk0 18.7 nmi, mode 18.8 reset TMPM333FDFG/fyfg/fwfg page 445 input data input port schmitt output data output enable input data input enable n-ch i/o port schmitt reset input port schimitt p-ch
18.9 x1, x2 18.10 xt1, xt2 18.11 vrefh, avss TMPM333FDFG/fyfg/fwfg 18. port section equivalent circuit schematic 18.9 x1, x2 page 446 xt2 xt1 300k (typ.) oscillator circuit low-frequency oscillation enable fs x2 x1 n-ch p-ch 2k (typ.) fosc oscillator circuit high-frequency oscillation enable vrefh p-ch avss v refon string resistor
19. package dimensions type: lqfp100-p-1414-0.50h TMPM333FDFG/fyfg/fwfg page 447 unit: mm >> >>>>>?>>>> >?>>e>?? >y >t> >t>a >> >>y >?> >?>a >y>> >? >>>>? >? >y>a>> ?<>>>t >y>a>> ?<>>>t >y>>> ?<>>>y >y>>> ?<>>>y >y>> >?>? >y>> >?>? >>> >>>t >>>>>? >>>>>? >>>y ?<>>>> >y>> >>>>y> >>>>> >y>>? >>? dimensions
TMPM333FDFG/fyfg/fwfg 19. package dimensions page 448 pin detail >hz>??; > > > > >? > > > > > >? > > > >y >t > >>>t> >>> >?>? >>>> hz>>>?>
restrictions on product use r e s t r i c t i o n s o n p r o d u c t u s e toshiba corporation, and its subsidiaries and affiliates (collectively ?toshiba?), reserve the right to make changes to the information in this document, and related hardware, software and systems (collectively ?product?) without notice. this document and any information herein may not be reproduced without prior written permission from toshiba. even with toshiba?s written permission, reproduction is permissible only if reproduction is without alteration/omission. though toshiba works continually to improve product's quality and reliability, product can malfunction or fail. customers are responsible for complying with safety standards and for providing adequate designs and safeguards for their hardware, software and systems which minimize risk and avoid situations in which a malfunction or failure of product could cause loss of human life, bodily injury or damage to property, including data loss or corruption. before customers use the product, create designs including the product, or incorporate the product into their own applications, customers must also refer to and comply with (a) the latest versions of all relevant toshiba information, including without limitation, this document, the specifications, the data sheets and application notes for product and the precautions and conditions set forth in the "toshiba semiconductor reliability handbook" and (b) the instructions for the application with which the product will be used with or for. customers are solely responsible for all aspects of their own product design or applications, including but not limited to (a) determining the appropriateness of the use of this product in such design or applications; (b) evaluating and determining the applicability of any information contained in this document, or in charts, diagrams, programs, algorithms, sample application circuits, or any other referenced documents; and (c) validating all operating parameters for such designs and applications. toshiba assumes no liability for customers' product design or applications. product is intended for use in general electronics applications (e.g., computers, personal equipment, office equipment, measuring equipment, industrial robots and home electronics appliances) or for specific applications as expressly stated in this document. product is neither intended nor warranted for use in equipment or systems that require extraordinarily high levels of quality and/or reliability and/or a malfunction or failure of which may cause loss of human life, bodily injury, serious property damage or serious public impact (?unintended use?). unintended use includes, without limitation, equipment used in nuclear facilities, equipment used in the aerospace industry, medical equipment, equipment used for automobiles, trains, ships and other transportation, traffic signaling equipment, equipment used to control combustions or explosions, safety devices, elevators and escalators, devices related to electric power, and equipment used in finance-related fields. do not use product for unintended use unless specifically permitted in this document. do not disassemble, analyze, reverse-engineer, alter, modify, translate or copy product, whether in whole or in part. product shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable laws or regulations. the information contained herein is presented only as guidance for product use. no responsibility is assumed by toshiba for any infringement of patents or any other intellectual property rights of third parties that may result from the use of product. no license to any intellectual property right is granted by this document, whether express or implied, by estoppel or otherwise. please contact your toshiba sales representative for details as to environmental matters such as the rohs compatibility of product. please use product in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. toshiba assumes no liability for damages or losses occurring as a result of noncompliance with applicable laws and regulations. absent a written signed agreement, except as provided in the relevant terms and conditions of sale for product, and to the maximum extent allowable by law, toshiba (1) assumes no liability whatsoever, including without limitation, indirect, consequential, special, or incidental damages or loss, including without limitation, loss of profits, loss of opportunities, business interruption and loss of data, and (2) disclaims any and all express or implied warranties and conditions related to sale, use of product, or information, including warranties or conditions of merchantability, fitness for a particular purpose, accuracy of information, or noninfringement. do not use or otherwise make available product or related software or technology for any military purposes, including without limitation, for the design, development, use, stockpiling or manufacturing of nuclear, chemical, or biological weapons or missile technology products (mass destruction weapons). product and related software and technology may be controlled under the japanese foreign exchange and foreign trade law and the u.s. export administration regulations. export and re-export of product or related software or technology are strictly prohibited except in compliance with all applicable export laws and regulations.


▲Up To Search▲   

 
Price & Availability of TMPM333FDFG

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