Part Number Hot Search : 
HMBT8050 ICH10 DAN217 UPD6700 QS5244 LTM4644 3BS02 BT3904
Product Description
Full Text Search
 

To Download 9S12T64AF16V1 Datasheet File

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


  Datasheet File OCR Text:
  mc9s12t64 speci?ation february 28th, 2003 ?revision 1.1.1 document number 9S12T64AF16V1/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
revision history mc9s12t64revision 1.1.1 2 motorola revision history rev. contents date who 1.0 - initial release. jan-28-2003 1.1 - added document number information. - modi?d a diagram of fbdm data transfer in spi mode in fbdm section ( page 543 ). feb-13-2003 1.1.1 - corrected order number in ordering information ( page 24 ). feb-28-2003 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola list of sections 3 list of sections list of sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 list of figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 list of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 central processing unit (cpu) . . . . . . . . . . . . . . . . . . . . 25 pinout and signal description . . . . . . . . . . . . . . . . . . . . 59 system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 module mapping control (mmc) . . . . . . . . . . . . . . . . 121 multiplexed external bus interface (mebi) . . . . . . . . . 141 resets and interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . 169 voltage regulator (vreg) . . . . . . . . . . . . . . . . . . . . . . 181 low-voltage detector (lvd) . . . . . . . . . . . . . . . . . . . . 185 flash eeprom 64k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 calram 2k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 port integration module (pim) . . . . . . . . . . . . . . . . . . . 249 clocks and reset generator (crg) . . . . . . . . . . . . . . 271 pulse width modulator (pwm8b8c) . . . . . . . . . . . . . . . 327 enhanced capture timer (ect) . . . . . . . . . . . . . . . . . . 371 serial communications interface (sci). . . . . . . . . . . . 419 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . 457 analog to digital converter (atd) . . . . . . . . . . . . . . . . 487 fast background debug module (fbdm) . . . . . . . . . . 517 breakpoint (bkp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . 561 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 literature updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of sections mc9s12t64revision 1.1.1 4 list of sections motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola table of contents 5 table of contents list of sections table of contents list of figures list of tables general description contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 mc9s12t64 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 central processing unit (cpu) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 data format summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 instruction set overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 pinout and signal description contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 mc9s12t64 pin assignments in 80-pin lqfp . . . . . . . . . . . . . . . . . 59 power supply pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 port signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 system configuration contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 modules variabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 mcu variabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 system clock description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 registers contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 register block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 general purpose registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 operating modes contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc9s12t64revision 1.1.1 6 table of contents motorola secured mode of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 module mapping control (mmc) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 memory maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 multiplexed external bus interface (mebi) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 low-power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 resets and interrupts contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 exception priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 maskable interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 latching of interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 effects of reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 voltage regulator (vreg) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 low-voltage detector (lvd) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc9s12t64revision 1.1.1 motorola table of contents 7 flash eeprom 64k contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 module memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230 flash security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 calram 2k contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 modes of operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .238 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 module memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 port integration module (pim) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 clocks and reset generator (crg) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 operation modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc9s12t64revision 1.1.1 8 table of contents motorola low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 reset description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 pulse width modulator (pwm8b8c) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 enhanced capture timer (ect) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 serial communications interface (sci) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 serial peripheral interface (spi) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc9s12t64revision 1.1.1 motorola table of contents 9 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .470 low power mode options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484 analog to digital converter (atd) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .488 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .490 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .491 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .492 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .494 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .511 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .514 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .515 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .515 fast background debug module (fbdm) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .517 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .517 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .517 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .519 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .520 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .521 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .523 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .524 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .528 low-power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .546 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .546 breakpoint (bkp) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .547 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .547 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .548 modes of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .549 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .550 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .552 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .552 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .553 breakpoint priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .560 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .560 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .560 electrical characteristics contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .561 general . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .561 atd characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .569 flash eeprom characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . .573 voltage regulator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . .577 reset, oscillator and pll characteristics . . . . . . . . . . . . . . . . . . . .578 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
table of contents mc9s12t64revision 1.1.1 10 table of contents motorola spi timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 external bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 glossary literature updates literature distribution centers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 customer focus center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 mfax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 motorola sps world marketing world wide web server . . . . . . . . 606 microcontroller division? web site . . . . . . . . . . . . . . . . . . . . . . . . . 606 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola list of figures 11 list of figures figure 1 mc9s12t64 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 2 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 3 accumulator a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 4 accumulator b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 5 index register x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 6 index register y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 7 stack pointer (sp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 8 program counter (pc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 9 condition code register (ccr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 figure 10 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 figure 11 pin assignments in 80-pin lqfp for mc9s12t64 . . . . . . . . . . . . . . . . . 60 figure 12 80-pin lqfp mechanical dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 figure 13 clock connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 14 module mapping control block diagram . . . . . . . . . . . . . . . . . . . . . . . . 122 figure 15 module mapping control register summary . . . . . . . . . . . . . . . . . . . . 123 figure 16 mc9s12t64 memory map after reset . . . . . . . . . . . . . . . . . . . . . . . . . . 139 figure 17 mebi register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 figure 18 queue status signal timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 figure 19 resets and interrupts register map . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 figure 20 vreg block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 figure 21 lvd block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 figure 22 flash 64k block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 figure 23 flash data memory map in normal modes . . . . . . . . . . . . . . . . . . . . . . 199 figure 24 flash data memory map in special modes. . . . . . . . . . . . . . . . . . . . . . 201 figure 25 flash control register map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 figure 26 faddr address mapping to flash relative address . . . . . . . . . . . . . . 218 figure 27 prdiv8 and fdiv bits determination procedure . . . . . . . . . . . . . . . . . 222 figure 28 example program algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 figure 29 example program algorithm in flash super user mode. . . . . . . . . . . . 227 figure 30 flash interrupt implementation.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 figure 31 calram 2k byte block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 figure 32 calram data memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 figure 33 copy data from flash eeprom to calram . . . . . . . . . . . . . . . . . . . . 244 figure 34 map calram over flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 figure 35 an example memory map when erase/program flash eeprom . . . . 246 figure 36 remove calram from memory mapping . . . . . . . . . . . . . . . . . . . . . . 247 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of figures mc9s12t64revision 1.1.1 12 list of figures motorola figure 37 pim block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 figure 38 pim9t64 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 figure 39 illustration of i/o pin functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 figure 40 block diagram of crg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 figure 41 pll loop filter connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 figure 42 colpitts crystal connections (xclks=1). . . . . . . . . . . . . . . . . . . . . . . . 277 figure 43 pierce oscillator connections (xclks=0). . . . . . . . . . . . . . . . . . . . . . . 277 figure 44 external clock connections (xclks=0) . . . . . . . . . . . . . . . . . . . . . . . . 278 figure 45 crg register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 figure 46 pll functional diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 figure 47 clock generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 figure 48 core clock and bus clock relationship . . . . . . . . . . . . . . . . . . . . . . . . . 300 figure 49 check window definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 figure 50 sequence for clock quality check . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 figure 51 clock chain for cop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 figure 52 clock chain for rti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 figure 53 wait mode entry/exit sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 figure 54 stop mode entry/exit sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 figure 55 reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 figure 56 reset pin tied to vdd (by a pull-up resistor) . . . . . . . . . . . . . . . . . . . . 322 figure 57 reset pin held low externally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 figure 58 pwm8b8c block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 figure 59 pwm register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 figure 60 pwm clock select block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 figure 61 pwm timer channel block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . 357 figure 62 pwm left aligned output waveform . . . . . . . . . . . . . . . . . . . . . . . . . . 361 figure 63 pwm left aligned output example waveform . . . . . . . . . . . . . . . . . . . 362 figure 64 pwm center aligned output waveform . . . . . . . . . . . . . . . . . . . . . . . . 363 figure 65 pwm center aligned output example waveform. . . . . . . . . . . . . . . . . 364 figure 66 pwm 16-bit mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 figure 67 timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 figure 68 enhanced capture timer register map. . . . . . . . . . . . . . . . . . . . . . . . . 375 figure 69 timer block diagram in latch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 figure 70 timer block diagram in queue mode . . . . . . . . . . . . . . . . . . . . . . . . . . 410 figure 71 8-bit pulse accumulators block diagram. . . . . . . . . . . . . . . . . . . . . . . . 411 figure 72 16-bit pulse accumulators block diagram. . . . . . . . . . . . . . . . . . . . . . . 412 figure 73 interrupt flag setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 figure 74 sci block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 figure 75 sci register quick reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 figure 76 detailed sci block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 figure 77 sci data formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 figure 78 transmitter block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 figure 79 sci receiver block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of figures mc9s12t64revision 1.1.1 motorola list of figures 13 figure 80 receiver data sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 figure 81 start bit search example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 figure 82 start bit search example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 figure 83 start bit search example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 figure 84 start bit search example 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 figure 85 start bit search example 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 figure 86 start bit search example 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 figure 87 slow data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 figure 88 fast data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 figure 89 single-wire operation (loops = 1, rsrc = 1) . . . . . . . . . . . . . . . . . . 453 figure 90 loop operation (loops = 1, rsrc = 0) . . . . . . . . . . . . . . . . . . . . . . . 453 figure 91 spi block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 figure 92 spi register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 figure 93 master/slave transfer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 474 figure 94 spi clock format 0 (cpha = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 figure 95 spi clock format 1 (cpha = 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 figure 96 bus clock divisor equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 figure 97 atd module block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 figure 98 atd register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 figure 99 block diagram of bdm in single wire mode . . . . . . . . . . . . . . . . . . . . . 520 figure 100 block diagram of bdm in spi mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 figure 101 bdm register map summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 figure 102 bdm command structure - single wire mode . . . . . . . . . . . . . . . . . . . 537 figure 103 bdm command structure - spi mode. . . . . . . . . . . . . . . . . . . . . . . . . . 538 figure 104 bdm host-to-target serial bit timing . . . . . . . . . . . . . . . . . . . . . . . . . . 541 figure 105 bdm target-to-host serial bit timing (logic 1) . . . . . . . . . . . . . . . . . . 542 figure 106 bdm target-to-host serial bit timing (logic 0) . . . . . . . . . . . . . . . . . . 543 figure 107 8-bit data transfer in spi mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 figure 108 breakpoint block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 figure 109 breakpoint register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 figure 110 atd accuracy definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 figure 111 pll loop filter connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 figure 112 spi master timing (cpha = 0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 figure 113 spi master timing (cpha =1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 figure 114 spi slave timing (cpha = 0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 figure 115 spi slave timing (cpha =1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 figure 116 general external bus timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of figures mc9s12t64revision 1.1.1 14 list of figures motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola list of tables 15 list of tables table 1 mc9s12t64 device ordering information .......................................................... 24 table 2 mc9s12t64 development tools ordering information ...................................... 24 table 3 addressing mode summary ................................................................................ 35 table 4 instruction set summary ..................................................................................... 36 table 5 register and memory notation............................................................................ 51 table 6 source form notation ......................................................................................... 53 table 7 operation notation .............................................................................................. 54 table 8 address mode notation ....................................................................................... 54 table 9 machine code notation ....................................................................................... 55 table 10 access detail notation ........................................................................................ 55 table 11 condition code state notation ............................................................................ 58 table 12 mc9s12t64 power and ground connection summary ..................................... 64 table 13 mc9s12t64 signal description summary .......................................................... 70 table 14 mc9s12t64 port a, b, e, k, t, s, p description summary................................ 77 table 15 port a, b, e, k, ad pull-up, pull-down and reduced drive summary ............... 78 table 16 mmc module variable i/o signals ...................................................................... 79 table 17 assigned part id numbers .................................................................................. 80 table 18 module availability in wait and run modes .................................................... 83 table 19 mc9s12t64 register map .................................................................................. 86 table 20 mode selection.................................................................................................. 106 table 21 modc, modb, moda write capability............................................................ 115 table 22 : security bits .................................................................................................... 118 table 23 exstr stretch bit definition ............................................................................. 128 table 24 state of romon bit after reset ......................................................................... 129 table 25 program space page index in special modes.................................................... 133 table 26 mapping precedence ........................................................................................ 134 table 27 access type in expanded modes ..................................................................... 135 table 28 64k byte physical flash/rom allocated .......................................................... 135 table 29 external system pins associated with mebi.................................................... 142 table 30 access type vs. bus control pins .................................................................... 162 table 31 ipipe[1:0] decoding when e clock is high ....................................................... 165 table 32 ipipe[1:0] decoding when e clock is low ........................................................ 165 table 33 interrupt vector table........................................................................................ 172 table 34 lvdf flag indication ......................................................................................... 190 table 35 flash memory mapping in normal modes......................................................... 198 table 36 flash memory mapping in special modes ........................................................ 200 table 37 flash protection/security field.......................................................................... 202 table 38 memory map summary in normal modes......................................................... 203 table 39 example fclkdiv settings ............................................................................... 207 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of tables mc9s12t64revision 1.1.1 16 list of tables motorola table 40 security states .................................................................................................. 208 table 41 register bank selects ....................................................................................... 210 table 42 loading of the protection register from flash .................................................. 211 table 43 higher address range protection..................................................................... 212 table 44 lower address range protection ..................................................................... 213 table 45 valid user mode commands ............................................................................ 216 table 46 flash interrupt sources ..................................................................................... 232 table 47 example calram mapping ............................................................................. 242 table 48 port reset state and priority summary ............................................................ 252 table 49 pin configuration summary .............................................................................. 255 table 50 clock selection based on xclks at reset ....................................................... 278 table 51 rti frequency divide rates ............................................................................. 289 table 52 cop watchdog rates ....................................................................................... 292 table 53 mcu configuration during wait mode ............................................................... 306 table 54 outcome of clock loss in wait mode ............................................................... 309 table 55 outcome of clock loss in pseudo-stop mode ................................................. 314 table 56 reset summary ................................................................................................ 318 table 57 reset vector selection...................................................................................... 319 table 58 relation between porlvdrf and lvdf......................................................... 323 table 59 crg interrupt vectors....................................................................................... 324 table 60 clock b prescaler selects ................................................................................. 341 table 61 clock a prescaler selects ................................................................................. 341 table 62 pwm timer counter conditions........................................................................ 360 table 63 16-bit concatenation mode summary............................................................... 366 table 64 pwm boundary cases ...................................................................................... 367 table 65 compare result output action ......................................................................... 385 table 66 edge detector circuit configuration.................................................................. 386 table 67 prescaler selection ........................................................................................... 388 table 68 pin action .......................................................................................................... 392 table 69 clock selection ................................................................................................. 392 table 70 modulus counter prescaler select.................................................................... 397 table 71 delay counter select ........................................................................................ 400 table 72 ect interrupts ................................................................................................... 416 table 73 loop functions.................................................................................................. 426 table 74 example of 8-bit data formats ......................................................................... 436 table 75 example of 9-bit data formats ......................................................................... 436 table 76 baud rates (example: bus clock = 16.0 mhz) ................................................ 437 table 77 start bit verification.......................................................................................... 444 table 78 data bit recovery ............................................................................................. 445 table 79 stop bit recovery ............................................................................................. 445 table 80 sci interrupt sources........................................................................................ 454 table 81 ss input / output selection ............................................................................... 463 table 82 bidirectional pin configurations ........................................................................ 465 table 83 spi baud rate selection (16 mhz bus clock).................................................. 466 table 84 normal mode and bidirectional mode ............................................................... 481 table 85 spi interrupt signals ......................................................................................... 485 table 86 external trigger configurations ....................................................................... 495 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of tables mc9s12t64revision 1.1.1 motorola list of tables 17 table 87 conversion sequence length coding. ..............................................................496 table 88 atd behavior in freeze mode (breakpoint)......................................................498 table 89 sample time select...........................................................................................499 table 90 clock prescaler values......................................................................................501 table 91 result data formats available. .........................................................................503 table 92 left justified, signed and unsigned atd output codes...................................503 table 93 analog input channel select coding.................................................................504 table 94 special channel select coding .........................................................................507 table 95 external trigger control bits..............................................................................513 table 96 atd module interrupt vectors ...........................................................................515 table 97 target clock selection summary ......................................................................526 table 98 hardware commands........................................................................................532 table 99 firmware commands ........................................................................................534 table 100 spi mode timing ...............................................................................................544 table 101 tag pin function................................................................................................545 table 102 breakpoint mask bits for first address.............................................................554 table 103 breakpoint mask bits for second address (dual address mode) ....................555 table 104 breakpoint mask bits for data breakpoints (full breakpoint mode).................556 table 105 absolute maximum ratings ...............................................................................564 table 106 operating conditions .........................................................................................565 table 107 thermal package characteristics......................................................................567 table 108 5v i/o characteristics........................................................................................567 table 109 supply current characteristics ..........................................................................568 table 110 atd operating characteristics ..........................................................................569 table 111 atd electrical characteristics ...........................................................................570 table 112 atd conversion performance..........................................................................571 table 113 nvm timing characteristics .............................................................................575 table 114 nvm reliability characteristics.........................................................................576 table 115 voltage regulator recommended load capacitance.......................................577 table 116 startup characteristics .....................................................................................578 table 117 oscillator characteristics .................................................................................580 table 118 pll characteristics............................................................................................582 table 119 spi master mode timing characteristics ..........................................................584 table 120 spi slave mode timing characteristics ...........................................................586 table 121 expanded bus timing characteristics ?16mhz ...............................................589 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
list of tables mc9s12t64revision 1.1.1 18 list of tables motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola general description 19 general description contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 mc9s12t64 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 introduction the mc9s12t64 microcontroller unit (mcu) is a 16-bit device composed of standard on-chip peripherals including a 16-bit central processing unit (hcs12 cpu), 64k bytes of flash eeprom, 2k bytes of ram, 2k bytes of calram (calibration ram), two asynchronous serial communications interfaces (sci), one serial peripheral interface (spi), an 8 channel ic/oc enhanced capture timer, an 8-channel 10-bit analog-to-digital converter (adc), an 8-channel pulse-width modulator (pwm), 25 discrete digital i/o channels (port a, port b, port e and port k). system resource mapping, clock generation, interrupt control and bus interfacing are managed by the system integration module (sim). the mc9s12t64 has full 16-bit data paths throughout. however, the external bus can operate in an 8-bit narrow mode so single 8-bit wide memory can be interfaced for lower cost systems. the inclusion of a pll circuit allows power consumption and performance to be adjusted to suit operational requirements. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description mc9s12t64revision 1.1.1 20 general description motorola features hcs12 core 16-bit hcs12 cpu i. upward compatible with m68hc11 instruction set ii. interrupt stacking and programmer? model identical to m68hc11 iii. 20-bit alu iv. instruction queue v. enhanced indexed addressing mebi (multiplexed external bus interface) 1 mmc (module mapping control) int (interrupt control) bkp (breakpoints) fbdm (fast background debug mode) i. synchronous serial peripheral interface (spi mode) to allow fast read and write of internal memory contents. ii. 4m bit per second in spi mode at 16mhz bus iii. single wire interface crg (low current oscillator, pll, reset, clocks, cop watchdog, real time interrupt, clock monitor) lvd (low voltage detector) low voltage detector to pull reset when the v ddr supply voltage falls to lvd trip voltage. 64k byte flash eeprom 2 two 32k byte flash eeprom blocks independently programmable and erasable 1. internal flash eeprom must be disabled to connect external memory devices with the exter- nal bus. 2. whole 64k bytes of flash eeprom can not be used at a time, since 1k byte register block and 2k byte ram array are always overlapped with flash eeprom. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description features mc9s12t64revision 1.1.1 motorola general description 21 programmable during calibration 2k byte ram single cycle misaligned 16-bit access 2k byte calram (calibration ram) 2k byte calibration block over flash eeprom access cycle compatible to flash eeprom 8 channel analog-to-digital converters 10-bit resolution external conversion trigger enhanced capture timer 16-bit main counter with 7-bit prescaler 8 programmable input capture or output compare channels two 8-bit or one 16-bit pulse accumulators 8 pwm channels programmable period and duty cycle 8-bit 8-channel or 16-bit 4-channel separate control for each pulse width and duty cycle center-aligned or left-aligned outputs programmable clock select logic with a wide range of frequencies fast emergency shutdown input usable as interrupt inputs serial interfaces two asynchronous serial communications interfaces (sci) one synchronous serial peripheral interface (spi) operating condition 32 mhz cpu equivalent to 16mhz bus operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description mc9s12t64revision 1.1.1 22 general description motorola 2.25 to 2.75v digital supply voltage generated using an internal voltage regulator 4.75v to 5.25v analog and i/o supply voltage 80-pin lqfp technology: 0.25 micron cmos f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description mc9s12t64 block diagram mc9s12t64revision 1.1.1 motorola general description 23 mc9s12t64 block diagram figure 1 mc9s12t64 block diagram 32k byte flash eeprom 2k byte ram enhanced capture reset extal xtal v dd1,2 v ss1,2 sci0 modc/ taghi/si/bkgd v ddr cpu12 periodic interrupt cop watchdog clock monitor background debug breakpoints pll v sspll xfc v ddpll v ddx v ssx internal logic 2.5v v ddpll v sspll pll 2.5v ioc2 ioc6 ioc0 ioc7 ioc1 ioc3 ioc4 ioc5 pt3 pt4 pt5 pt6 pt7 pt0 pt1 pt2 v rh v rl atd an2 an6 an0 etrig/an7 an1 an3 an4 an5 pad3 pad4 pad5 pad6 pad7 pad0 pad1 pad2 v dda v ssa rxd0 txd0 miso mosi ps3 ps4 ps5 ps0 ps1 ps2 sci1 rxd1 txd1 pwm2 pwm0 pwm1 pwm3 pp3 pp0 pp1 pp2 sck ss ps6 ps7 spi i/o driver 5v v dda v ssa a/d converter 5v ad ptt ddrt ptp ddrp pts ddrs clock and reset generation module voltage regulator v ssr v dd1,2 v ss1,2 vregen v ddr v ssr voltage regulator 5v & i/o timer pwm so sckbdm/spimode spi or single wire interface module with low voltage 7 18 16 12 8 8 8 pwm6 pwm4 pwm5 pwm7 pp7 pp4 pp5 pp6 r/ w modb/ipipe1 xirq noacc/ xclks system integration module multiplexed address/data bus multiplexed wide bus multiplexed narrow bus irq lstrb/ taglo eclk moda/ipipe0 pa 4 pa 3 pa 2 pa 1 pa 0 pa 7 pa 6 pa 5 test addr12 addr11 addr10 addr9 addr8 addr15 addr14 addr13 data12 data11 data10 data9 data8 data15 data14 data13 pb4 pb3 pb2 pb1 pb0 pb7 pb6 pb5 addr4 addr3 addr2 addr1 addr0 addr7 addr6 addr5 data4 data3 data2 data1 data0 data7 data6 data5 data4 data3 data2 data1 data0 data7 data6 data5 pe3 pe4 pe5 pe6 pe7 pe0 pe1 pe2 ddra ddrb pta ptb ddre pte v ddx v ssx 2 2k byte calram 32k byte flash eeprom fast romone/ ecs pk7 ptk ddrk 1 port k detector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
general description mc9s12t64revision 1.1.1 24 general description motorola ordering information table 1 mc9s12t64 device ordering information package temperature voltage frequency order number range ( ?c) designator 80-pin lqfp ?0 to +85 c 5v bus: 16mhz (cpu: 32mhz) mc9s12t64cpk16 ?0 to +105 v mc9s12t64vpk16 ?0 to +125 m mc9s12t64mpk16 table 2 mc9s12t64 development tools ordering information description details order number (1) 1. contact local sales for this information. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 25 central processing unit (cpu) contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 data format summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 instruction set overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 introduction the hcs12 cpu is a high-speed, 16-bit processing unit. it has full 16-bit data paths and wider internal registers (up to 20 bits) for high-speed extended math instructions. the instruction set is a proper superset of the m68hc11instruction set. the hcs12 cpu allows instructions with odd byte counts, including many single-byte instructions. this provides efficient use of rom space. an instruction pipe buffers program information so the cpu always has immediate access to at least three bytes of machine code at the start of every instruction. the hcs12 cpu also offers an extensive set of indexed addressing capabilities. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 26 central processing unit (cpu) motorola programming model the core cpu12 programming model, shown in figure 2 , is the same as that of the 68hc12 and 68hc11. the register set and data types used in the model are covered in the subsections that follow. figure 2 programming model accumulators general-purpose 8-bit accumulators a and b hold operands and results of operations. some instructions use the combined 8-bit accumulators, a:b, as a 16-bit double accumulator, d, with the most significant byte in a. 7 15 15 15 15 15 d x y sp pc ab n sxh i zvc 0 0 0 0 0 0 7 0 condition code register 8-bit accumulators a and b 16-bit double accumulator d (a: b) index register x index register y stack pointer program counter stop disable (ignore stop instruction) carry overflow zero negative irq interrupt mask (disable) half-carry for bcd arithmetic xirq interrupt mask (disable) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) programming model mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 27 most operations can use accumulator a or b interchangeably. however, there are a few exceptions. add, subtract, and compare instructions involving both a and b (aba, sba, and cba) only operate in one direction, so it is important to verify that the correct operand is in the correct accumulator. the decimal adjust accumulator a (daa) instruction is used after binary-coded decimal (bcd) arithmetic operations. there is no equivalent instruction to adjust accumulator b. index registers (x and y) 16-bit index registers x and y are used for indexed addressing. in indexed addressing, the contents of an index register are added to a 5-bit, 9-bit, or 16-bit constant or to the contents of an accumulator to form the effective address of the instruction operand. having two index registers is especially useful for moves and in cases where operands from two separate tables are used in a calculation. 76543210 read: write: reset: 0 0000000 figure 3 accumulator a 76543210 read: write: reset: 0 0000000 figure 4 accumulator b f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 28 central processing unit (cpu) motorola stack pointer (sp) the stack stores system context during subroutine calls and interrupts, and can also be used for temporary data storage. it can be located anywhere in the standard 64k byte address space and can grow to any size up to the total amount of memory available in the system. sp holds the 16-bit address of the last stack location used. normally, sp is initialized by one of the first instructions in an application program. the stack grows downward from the address pointed to by sp. each time a byte is pushed onto the stack, the stack pointer is automatically decremented, and each time a byte is pulled from the stack, the stack pointer is automatically incremented. when a subroutine is called, the address of the instruction following the calling instruction is automatically calculated and pushed onto the stack. normally, a return from subroutine (rts) is executed at the end of a subroutine. the return instruction loads the program counter with the previously stacked return address and execution continues at that address. 151413121110987654321 0 read: write: reset: 0000000000000000 figure 5 index register x 151413121110987654321 0 read: write: reset: 0000000000000000 figure 6 index register y f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) programming model mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 29 when an interrupt occurs, the cpu: completes execution of the current instruction calculates the address of the next instruction and pushes it onto the stack pushes the contents of all the cpu registers onto the stack loads the program counter with the address pointed to by the interrupt vector, and begins execution at that address the stacked cpu registers are referred to as an interrupt stack frame. the core stack frame is the same as that of the cpu. program counter (pc) pc is a 16-bit register that holds the address of the next instruction to be executed. the address in pc is automatically incremented each time an instruction is executed. condition code register (ccr) ccr has five status bits, two interrupt mask bits, and a stop instruction mask bit. it is named for the five conditions indicated by the status bits. 1514131211109876543210 read: write: reset: 0000000011111111 figure 7 stack pointer (sp) 1514131211109876543210 read: write: reset: 0 000000000000000 figure 8 program counter (pc) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 30 central processing unit (cpu) motorola the status bits reflect the results of cpu operations. the five status bits are half-carry (h), negative (n), zero (z), overflow (v), and carry/borrow (c). the half-carry bit is used only for bcd arithmetic operations. the n, z, v, and c status bits allow for branching based on the results of a cpu operation. most instructions automatically update condition codes, so it is rarely necessary to execute extra instructions to load and test a variable. the condition codes affected by each instruction are shown in the hcs12 core user guide. the following paragraphs describe common uses of the condition codes. there are other, more specialized uses. for instance, the c status bit is used to enable weighted fuzzy logic rule evaluation. specialized usages are described in the relevant portions of this guide and in the hcs12 core user guide. s ?stop mask bit clearing the s bit enables the stop instruction. execution of a stop instruction causes the on-chip oscillator to stop. this may be undesirable in some applications. when the s bit is set, the cpu treats the stop instruction as a no-operation (nop) instruction and continues on to the next instruction. reset sets the s bit. 1 = stop instruction disabled 0 = stop instruction enabled x xirq mask bit clearing the x bit enables interrupt requests on the xirq pin. the xirq input is an updated version of the nonmaskable interrupt ( nmi) input found on earlier generations of motorola microcontroller units bit 7 654321 bit 0 read: sxh i nzvc write: reset: 11010000 figure 9 condition code register (ccr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) programming model mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 31 (mcus). nonmaskable interrupts are typically used to deal with major system failures such as loss of power. however, enabling nonmaskable interrupts before a system is fully powered and initialized can lead to spurious interrupts. the x bit provides a mechanism for masking nonmaskable interrupts until the system is stable. reset sets the x bit. as long as the x bit remains set, interrupt service requests made via the xirq pin are not recognized. software must clear the x bit to enable interrupt service requests from the xirq pin. once software clears the x bit, enabling xirq interrupt requests, only a reset can set it again. the x bit does not affect i bit maskable interrupt requests. when the x bit is clear and an xirq interrupt request occurs, the cpu stacks the cleared x bit. it then automatically sets the x and i bits in the ccr to disable xirq and maskable interrupt requests during the xirq interrupt service routine. an rti instruction at the end of the interrupt service routine restores the cleared x bit to the ccr, re-enabling xirq interrupt requests. 1 = xirq interrupt requests disabled 0 = xirq interrupt requests enabled h ?half-carry bit the h bit indicates a carry from bit 3 of the result during an addition operation. the daa instruction uses the value of the h bit to adjust the result in accumulator a to bcd format. aba, add, and adc are the only instructions that update the h bit. 1 = carry from bit 3 after aba, add, or adc instruction 0 = no carry from bit 3 after aba, add, or adc instruction i ?interrupt mask bit clearing the i bit enables maskable interrupt sources. reset sets the i bit. to enable maskable interrupt requests, software must clear the i bit. maskable interrupt requests that occur while the i bit is set remain pending until the i bit is cleared. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 32 central processing unit (cpu) motorola when the i bit is clear and a maskable interrupt request occurs, the cpu stacks the cleared i bit. it then automatically sets the i bit in the ccr to prevent other maskable interrupt requests during the interrupt service routine. an rti instruction at the end of the interrupt service routine restores the cleared i bit to the ccr, reenabling maskable interrupt requests. the i bit can be cleared within the service routine, but implementing a nested interrupt scheme requires great care, and seldom improves system performance. 1 = maskable interrupt requests disabled 0 = maskable interrupt requests enabled n ?negative bit the n bit is set when the msb of the result is set. n is most commonly used in two? complement arithmetic, where the msb of a negative number is one and the msb of a positive number is zero, but it has other uses. for instance, if the msb of a register or memory location is used as a status bit, the user can test the bit by loading an accumulator. 1 = msb of result set 0 = msb of result clear z ?zero bit the z bit is set when all the bits of the result are zeros. compare instructions perform an internal implied subtraction, and the condition codes, including z, reflect the results of that subtraction. the inx, dex, iny, and dey instructions affect the z bit and no other condition bits. these operations can only determine = and . 1 = result all zeros 0 = result not all zeros v ?overflow bit the v bit is set when a two? complement overflow occurs as a result of an operation. 1 = overflow 0 = no overflow c ?carry bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) programming model mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 33 the c bit is set when a carry occurs during addition or a borrow occurs during subtraction. the c bit also acts as an error flag for multiply and divide operations. shift and rotate instructions operate through the c bit to facilitate multiple-word shifts. 1 = carry or borrow 0 = no carry or borrow hcs12 cpu registers are an integral part of the cpu and are not addressed as if they were memory locations. figure 10 programming model 7 15 15 15 15 15 d x y sp pc ab n sxh i zvc 0 0 0 0 0 0 7 0 condition code register 8-bit accumulators a and b 16-bit double accumulator d (a : b) index register x index register y stack pointer program counter stop disable (ignore stop instruction) carry overflow zero negative irq interrupt mask (disable) half-carry for bcd arithmetic xirq interrupt mask (disable) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 34 central processing unit (cpu) motorola data format summary following is a discussion of the data types used and their organization in memory for the core. data types the cpu uses the following types of data: bits 5-bit signed integers 8-bit signed and unsigned integers 8-bit, 2-digit binary coded decimal numbers 9-bit signed integers 16-bit signed and unsigned integers 16-bit effective addresses 32-bit signed and unsigned integers note: negative integers are represented in two? complement form. five-bit and 9-bit signed integers are used only as offsets for indexed addressing modes. sixteen-bit effective addresses are formed during addressing mode computations. thirty-two-bit integer dividends are used by extended division instructions. extended multiply and extended multiply-and-accumulate instructions produce 32-bit products. memory organization the standard hcs12 core address space is 64k bytes. however, the cpu has special instructions to support paged memory expansion which increases the standard area by means of predefined windows within the available address space. see the module mapping control (mmc) section for more information. eight-bit values can be stored at any odd or even byte address in available memory. sixteen-bit values occupy two consecutive memory locations; the high byte is in the lowest address, but does not have to be aligned to an even boundary. thirty-two-bit values occupy four f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) addressing modes mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 35 consecutive memory locations; the high byte is in the lowest address, but does not have to be aligned to an even boundary. all i/o and all on-chip peripherals are memory-mapped. no special instruction syntax is required to access these addresses. on-chip register and memory mapping are determined at the soc level and are configured during integration of the core into the system. addressing modes a summary of the addressing modes used by the core is given in table 3 below. the operation of each of these modes is shown in detail in the hcs12 core user guide. table 3 addressing mode summary addressing mode source form abbreviation description inherent inst (no externally supplied operands) inh operands (if any) are in cpu registers. immediate inst #opr8i or inst #opr16i imm operand is included in instruction stream; 8-bit or 16-bit size implied by context. direct inst opr8a dir operand is the lower 8-bits of an address in the range $0000?00ff. extended inst opr16a ext operand is a 16-bit address. relative inst rel8 or inst rel16 rel effective address is the value in pc plus an 8-bit or 16-bit relative offset value. indexed (5-bit offset) inst oprx5,xysp idx effective address is the value in x, y, sp, or pc plus a 5-bit signed constant offset. indexed (predecrement) inst oprx3,?ys idx effective address is the value in x, y, or sp autodecremented by 1 to 8. indexed (preincrement) inst oprx3,+xys idx effective address is the value in x, y, or sp autoincremented by 1 to 8. indexed (postdecrement) inst oprx3,xys idx effective address is the value in x, y, or sp. the value is postdecremented by 1 to 8. indexed (postincrement) inst oprx3,xys+ idx effective address is the value in x, y, or sp. the value is postincremented by 1 to 8. indexed (accumulator offset) inst abd,xysp idx effective address is the value in x, y, sp, or pc plus the value in a, b, or d. indexed (9-bit offset) inst oprx9,xysp idx1 effective address is the value in x, y, sp, or pc plus a 9-bit signed constant offset. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 36 central processing unit (cpu) motorola instruction set overview all memory and i/o are mapped in a common 64k byte address space, allowing the same set of instructions to access memory, i/o, and control registers. load, store, transfer, exchange, and move instructions facilitate movement of data to and from memory and peripherals. there are instructions for signed and unsigned addition, division and multiplication with 8-bit, 16-bit, and some larger operands. special arithmetic and logic instructions aid stacking operations, indexing, bcd calculation, and condition code register manipulation. there are also dedicated instructions for multiply and accumulate operations, table interpolation, and specialized mathematical calculations for fuzzy logic operations. a summary of the cpu instruction set is given in figure 4 below. a detailed overview of the entire instruction set is covered in the hcs12 core user guide. indexed (16-bit offset) inst oprx16,xysp idx2 effective address is the value in x, y, sp, or pc plus a 16-bit constant offset. indexed-indirect (16-bit offset) inst [oprx16,xysp] [idx2] the value in x, y, sp, or pc plus a 16-bit constant offset points to the effective address. indexed-indirect (d accumulator offset) inst [d,xysp] [d,idx] the value in x, y, sp, or pc plus the value in d points to the effective address. table 3 addressing mode summary (continued) addressing mode source form abbreviation description table 4 instruction set summary source form operation address mode machine coding (hex) access detail s x h i n z v c aba add b to a; (a)+(b) ? a inh 18 06 oo abxsame as leax b,x add b to x; (x)+(b) ? x idx 1a e5 pf abysame as leay b,y add b to y; (y)+(b) ? y idx 19 ed pf ? ? ? ? ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 37 adca # opr8i adca opr8a adca opr16a adca oprx0_xysppc adca oprx9 , xysppc adca oprx16 , xysppc adca [d, xysppc ] adca [ oprx16 , xysppc ] add with carry to a; (a)+(m)+c ? a or (a)+imm+c ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 89 ii 99 dd b9 hh ll a9 xb a9 xb ff a9 xb ee ff a9 xb a9 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf adcb # opr8i adcb opr8a adcb opr16a adcb oprx0_xysppc adcb oprx9 , xysppc adcb oprx16 , xysppc adcb [d, xysppc ] adcb [ oprx16 , xysppc ] add with carry to b; (b)+(m)+c ? b or (b)+imm+c ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c9 ii d9 dd f9 hh ll e9 xb e9 xb ff e9 xb ee ff e9 xb e9 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf adda # opr8i adda opr8a adda opr16a adda oprx0_xysppc adda oprx9 , xysppc adda oprx16 , xysppc adda [d, xysppc ] adda [ oprx16 , xysppc ] add to a; (a)+(m) ? a or (a)+imm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 8b ii 9b dd bb hh ll ab xb ab xb ff ab xb ee ff ab xb ab xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf addb # opr8i addb opr8a addb opr16a addb oprx0_xysppc addb oprx9 , xysppc addb oprx16 , xysppc addb [d, xysppc ] addb [ oprx16 , xysppc ] add to b; (b)+(m) ? b or (b)+imm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] cb ii db dd fb hh ll eb xb eb xb ff eb xb ee ff eb xb eb xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf addd # opr16i addd opr8a addd opr16a addd oprx0_xysppc addd oprx9 , xysppc addd oprx16 , xysppc addd [d, xysppc ] addd [ oprx16 , xysppc ] add to d; (a:b)+(m:m+1) ? a:b or (a:b)+imm ? a:b imm dir ext idx idx1 idx2 [d,idx] [idx2] c3 jj kk d3 dd f3 hh ll e3 xb e3 xb ff e3 xb ee ff e3 xb e3 xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf anda # opr8i anda opr8a anda opr16a anda oprx0_xysppc anda oprx9 , xysppc anda oprx16 , xysppc anda [d, xysppc ] anda [ oprx16 , xysppc ] and with a; (a) ? (m) ? a or (a) ? imm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 84 ii 94 dd b4 hh ll a4 xb a4 xb ff a4 xb ee ff a4 xb a4 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf andb # opr8i andb opr8a andb opr16a andb oprx0_xysppc andb oprx9 , xysppc andb oprx16 , xysppc andb [d, xysppc ] andb [ oprx16 , xysppc ] and with b; (b) ? (m) ? b or (b) ? imm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c4 ii d4 dd f4 hh ll e4 xb e4 xb ff e4 xb ee ff e4 xb e4 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf andcc # opr8i and with ccr; (ccr) ? imm ? ccr imm 10 ii p table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 ?? 0 ???????? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 38 central processing unit (cpu) motorola asl opr16a same as lsl asl oprx0_xysp asl oprx9 , xysppc asl oprx16 , xysppc asl [d, xysppc ] asl [ oprx16 , xysppc ] aslasame as lsla aslbsame as lslb arithmetic shift left m arithmetic shift left a arithmetic shift left b ext idx idx1 idx2 [d,idx] [idx2] inh inh 78 hh ll 68 xb 68 xb ff 68 xb ee ff 68 xb 68 xb ee ff 48 58 rpwo rpw rpwo frpwp fifrpw fiprpw o o asldsame as lsld arithmetic shift left d inh 59 o asr opr16a asr oprx0_xysppc asr oprx9 , xysppc asr oprx16 , xysppc asr [d, xysppc ] asr [ oprx16 , xysppc ] asra asrb arithmetic shift right m arithmetic shift right a arithmetic shift right b ext idx idx1 idx2 [d,idx] [idx2] inh inh 77 hh ll 67 xb 67 xb ff 67 xb ee ff 67 xb 67 xb ee ff 47 57 rpwo rpw rpwo frpwp fifrpw fiprpw o o bcc rel8 same as bhs branch if c clear; if c=0, then (pc)+2+rel ? pc rel 24 rr ppp (branch) p (no branch) bclr opr8a , msk8 bclr opr16a , msk8 bclr oprx0_xysppc , msk8 bclr oprx9 , xysppc , msk8 bclr oprx16 , xysppc , msk8 clear bit(s) in m; (m) ? mask byte ? m dir ext idx idx1 idx2 4d dd mm 1d hh ll mm 0d xb mm 0d xb ff mm 0d xb ee ff mm rpwo rpwp rpwo rpwp frpwpo bcs rel8 same as blo branch if c set; if c=1, then (pc)+2+rel ? pc rel 25 rr ppp (branch) p (no branch) beq rel8 branch if equal; if z=1, then (pc)+2+rel ? pc rel 27 rr ppp (branch) p (no branch) bge rel8 branch if 0, signed; if n v=0, then (pc)+2+rel ? pc rel 2c rr ppp (branch) p (no branch) bgnd enter background debug mode inh 00 vfppp bgt rel8 branch if > 0, signed; if z | (n v)=0, then (pc)+2+rel ? pc rel 2e rr ppp (branch) p (no branch) bhi rel8 branch if higher, unsigned; if c | z=0, then (pc)+2+rel ? pc rel 22 rr ppp (branch) p (no branch) bhs rel8 same as bcc branchifhigherorsame,unsigned;if c=0,then(pc)+2+rel ? pc rel 24 rr ppp (branch) p (no branch) bita # opr8i bita opr8a bita opr16a bita oprx0_xysppc bita oprx9 , xysppc bita oprx16 , xysppc bita [d, xysppc ] bita [ oprx16 , xysppc ] bit test a; (a) ? (m) or (a) ? imm imm dir ext idx idx1 idx2 [d,idx] [idx2] 85 ii 95 dd b5 hh ll a5 xb a5 xb ff a5 xb ee ff a5 xb a5 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf bitb # opr8i bitb opr8a bitb opr16a bitb oprx0_xysppc bitb oprx9 , xysppc bitb oprx16 , xysppc bitb [d, xysppc ] bitb [ oprx16 , xysppc ] bit test b; (b) ? (m) or (b) ? imm imm dir ext idx idx1 idx2 [d,idx] [idx2] c5 ii d5 dd f5 hh ll e5 xb e5 xb ff e5 xb ee ff e5 xb e5 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c c 0 b7 b0 ???? ?? ?? c 0 b7 b0 ab b7 b0 ???? c b7 b0 ???? ?? 0 ?? 0 ?? 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 39 ble rel8 branch if 0,signed; if z | (n v)=1, then (pc)+2+rel ? pc rel 2f rr ppp (branch) p (no branch) blo rel8 same as bcs branch if lower, unsigned; if c=1, then (pc)+2+rel ? pc rel 25 rr ppp (branch) p (no branch) bls rel8 branch if lower or same, unsigned; if c | z=1, then (pc)+2+rel ? pc rel 23 rr ppp (branch) p (no branch) blt rel8 branch if < 0, signed; if n v=1, then (pc)+2+rel ? pc rel 2d rr ppp (branch) p (no branch) bmi rel8 branch if minus; if n=1, then (pc)+2+rel ? pc rel 2b rr ppp (branch) p (no branch) bne rel8 branch if not equal to 0; if z=0, then (pc)+2+rel ? pc rel 26 rr ppp (branch) p (no branch) bpl rel8 branch if plus; if n=0, then (pc)+2+rel ? pc rel 2a rr ppp (branch) p (no branch) bra rel8 branch always rel 20 rr ppp brclr opr8a , msk8 , rel8 brclr opr16a , msk8 , rel8 brclr oprx0_xysppc , msk8 , rel8 brclr oprx9 , xysppc , msk8 , rel8 brclr oprx16 , xysppc , msk8 , rel8 branch if bit(s) clear; if (m) ? (mask byte)=0, then (pc)+2+rel ? pc dir ext idx idx1 idx2 4f dd mm rr 1f hh ll mm rr 0f xb mm rr 0f xb ff mm rr 0f xb ee ff mm rr rppp rfppp rppp rfppp prfppp brn rel8 branch never rel 21 rr p brset opr8 , msk8 , rel8 brset opr16a , msk8 , rel8 brset oprx0_xysppc , msk8 , rel8 brset oprx9 , xysppc , msk8 , rel8 brset oprx16 , xysppc , msk8 , rel8 branch if bit(s) set; if ( m) ? (mask byte)=0, then (pc)+2+rel ? pc dir ext idx idx1 idx2 4e dd mm rr 1e hh ll mm rr 0e xb mm rr 0e xb ff mm rr 0e xb ee ff mm rr rppp rfppp rppp rfppp prfppp bset opr8 , msk8 bset opr16a , msk8 bset oprx0_xysppc , msk8 bset oprx9 , xysppc , msk8 bset oprx16 , xysppc , msk8 set bit(s) in m (m) | mask byte ? m dir ext idx idx1 idx2 4c dd mm 1c hh ll mm 0c xb mm 0c xb ff mm 0c xb ee ff mm rpwo rpwp rpwo rpwp frpwpo bsr rel8 branch to subroutine; (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (pc)+2+rel ? pc rel 07 rr sppp bvc rel8 branch if v clear; if v=0, then (pc)+2+rel ? pc rel 28 rr ppp (branch) p (no branch) bvs rel8 branch if v set; if v=1, then (pc)+2+rel ? pc rel 29 rr ppp (branch) p (no branch) call opr16a , page call oprx0_xysppc , page call oprx9 , xysppc , page call oprx16 , xysppc , page call [d, xysppc ] call [ oprx16 , xysppc ] call subroutine in expanded memory (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (sp)? ? sp; (ppg) ? m sp pg ? ppage register subroutine address ? pc ext idx idx1 idx2 [d,idx] [idx2] 4a hh ll pg 4b xb pg 4b xb ff pg 4b xb ee ff pg 4b xb 4b xb ee ff gnssppp gnssppp gnssppp fgnssppp fiignssppp fiignssppp cba compare a to b; (a)?b) inh 18 17 oo clcsame as andcc #$fe clear c bit imm 10 fe p clisame as andcc #$ef clear i bit imm 10 ef p table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ?? 0 ???? ? ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 40 central processing unit (cpu) motorola clr opr16a clr oprx0_xysppc clr oprx9 , xysppc clr oprx16 , xysppc clr [d, xysppc ] clr [ oprx16 , xysppc ] clra clrb clear m; $00 ? m clear a; $00 ? a clear b; $00 ? b ext idx idx1 idx2 [d,idx] [idx2] inh inh 79 hh ll 69 xb 69 xb ff 69 xb ee ff 69 xb 69 xb ee ff 87 c7 pwo pw pwo pwp pifw pipw o o clvsame as andcc #$fd clear v imm 10 fd p cmpa # opr8i cmpa opr8a cmpa opr16a cmpa oprx0_xysppc cmpa oprx9 , xysppc cmpa oprx16 , xysppc cmpa [d, xysppc ] cmpa [ oprx16 , xysppc ] compare a (a)?m) or (a)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] 81 ii 91 dd b1 hh ll a1 xb a1 xb ff a1 xb ee ff a1 xb a1 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf cmpb # opr8i cmpb opr8a cmpb opr16a cmpb oprx0_xysppc cmpb oprx9 , xysppc cmpb oprx16 , xysppc cmpb [d, xysppc ] cmpb [ oprx16 , xysppc ] compare b (b)?m) or (b)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] c1 ii d1 dd f1 hh ll e1 xb e1 xb ff e1 xb ee ff e1 xb e1 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf com opr16a com oprx0_xysppc com oprx9 , xysppc com oprx16 , xysppc com [d, xysppc ] com [ oprx16 , xysppc ] coma comb complement m; ( m)=$ff?m) ? m complement a; ( a)=$ff?a) ? a complement b; ( b)=$ff?b) ? b ext idx idx1 idx2 [d,idx] [idx2] inh inh 71 hh ll 61 xb 61 xb ff 61 xb ee ff 61 xb 61 xb ee ff 41 51 rpwo rpw rpwo frpwp fifrpw fiprpw o o cpd # opr16i cpd opr8a cpd opr16a cpd oprx0_xysppc cpd oprx9 , xysppc cpd oprx16 , xysppc cpd [d, xysppc ] cpd [ oprx16 , xysppc ] compare d (a:b)?m:m+1) or (a:b)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] 8c jj kk 9c dd bc hh ll ac xb ac xb ff ac xb ee ff ac xb ac xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf cps # opr16i cps opr8a cps opr16a cps oprx0_xysppc cps oprx9,xysppc cps oprx16 , xysppc cps [d, xysppc ] cps [ oprx16 , xysppc ] compare sp (sp)?m:m+1) or (sp)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] 8f jj kk 9f dd bf hh ll af xb af xb ff af xb ee ff af xb af xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf cpx # opr16i cpx opr8a cpx opr16a cpx oprx0_xysppc cpx oprx9 , xysppc cpx oprx16 , xysppc cpx [d, xysppc ] cpx [ oprx16 , xysppc ] compare x (x)?m:m+1) or (x)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] 8e jj kk 9e dd be hh ll ae xb ae xb ff ae xb ee ff ae xb ae xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c 0100 0 ???? ???? ?? 01 ???? ???? ???? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 41 cpy # opr16i cpy opr8a cpy opr16a cpy oprx0_xysppc cpy oprx9 , xysppc cpy oprx16 , xysppc cpy [d, xysppc ] cpy [ oprx16 , xysppc ] compare y (y)?m:m+1) or (y)?mm imm dir ext idx idx1 idx2 [d,idx] [idx2] 8d jj kk 9d dd bd hh ll ad xb ad xb ff ad xb ee ff ad xb ad xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf daa decimal adjust a for bcd inh 18 07 ofo dbeq abdxysp , rel9 decrement and branch if equal to 0 (counter)? ? counter if (counter)=0, then branch rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) dbne abdxysp , rel9 decrement and branch if not equal to 0; (counter)? ? counter; if (counter) 0, then branch rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) dec opr16a dec oprx0_xysppc dec oprx9 , xysppc dec oprx16 , xysppc dec [d, xysppc ] dec [ oprx16 , xysppc ] deca decb decrement m; (m)? ? m decrement a; (a)? ? a decrement b; (b)? ? b ext idx idx1 idx2 [d,idx] [idx2] inh inh 73 hh ll 63 xb 63 xb ff 63 xb ee ff 63 xb 63 xb ee ff 43 53 rpwo rpw rpwo frpwp fifrpw fiprpw o o dessame as leas ?,sp decrement sp; (sp)? ? sp idx 1b 9f pf dex decrement x; (x)? ? x inh 09 o dey decrement y; (y)? ? y inh 03 o ediv extended divide, unsigned; 32 by 16 to 16-bit; (y:d) (x) ? y; remainder ? d inh 11 ffffffffffo edivs extended divide,signed; 32 by 16 to 16-bit; (y:d) (x) ? y remainder ? d inh 18 14 offffffffffo emacs opr16a extended multiply and accumulate, signed; (m x :m x+1 ) (m y :m y+1 ) + (m~m+3) ? m~m+3; 16 by 16 to 32-bit special 18 12 hh ll orrofffrrfwwp emaxd oprx0_xysppc emaxd oprx9 , xysppc emaxd oprx16 , xysppc emaxd [d, xysppc ] emaxd [ oprx16 , xysppc ] extended maximum in d; put larger of 2 unsigned 16-bit values in d max[(d), (m:m+1)] ? d n, z, v, c bits reflect result of internal compare [(d)?m:m+1)] idx idx1 idx2 [d,idx] [idx2] 18 1a xb 18 1a xb ff 18 1a xb ee ff 18 1a xb 18 1a xb ee ff orpf orpo ofrpp ofifrpf ofiprpf emaxm oprx0_xysppc emaxm oprx9 , xysppc emaxm oprx16 , xysppc emaxm [d, xysppc ] emaxm [ oprx16 , xysppc ] extended maximum in m; put larger of 2 unsigned 16-bit values in m max[(d), (m:m+1)] ? m:m+1 n, z, v, c bits reflect result of internal compare [(d)?m:m+1)] idx idx1 idx2 [d,idx] [idx2] 18 1e xb 18 1e xb ff 18 1e xb ee ff 18 1e xb 18 1e xb ee ff orpw orpwo ofrpwp ofifrpw ofiprpw emind oprx0_xysppc emind oprx9 , xysppc emind oprx16 , xysppc emind [d, xysppc ] emind [ oprx16 , xysppc ] extended minimum in d; put smaller of 2 unsigned 16-bit values in d min[(d), (m:m+1)] ? d n, z, v, c bits reflect result of internal compare [(d)?m:m+1)] idx idx1 idx2 [d,idx] [idx2] 18 1b xb 18 1b xb ff 18 1b xb ee ff 18 1b xb 18 1b xb ee ff orpf orpo ofrpp ofifrpf ofiprpf table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ???? ?? ? ? ??? ? ? ???? ???? ???? ???? ???? ???? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 42 central processing unit (cpu) motorola eminm oprx0_xysppc eminm oprx9 , xysppc eminm oprx16 , xysppc eminm [d, xysppc ] eminm [ oprx16 , xysppc ] extended minimum in m; put smaller of 2 unsigned 16-bit values in m min[(d), (m:m+1)] ? m:m+1 n, z, v, c bits reflect result of internal compare [(d)?m:m+1)] idx idx1 idx2 [d,idx] [idx2] 18 1f xb 18 1f xb ff 18 1f xb ee ff 18 1f xb 18 1f xb ee ff orpw orpwo ofrpwp ofifrpw ofiprpw emul extended multiply, unsigned (d) (y) ? y:d; 16 by 16 to 32-bit inh 13 ffo emuls extended multiply, signed (d) (y) ? y:d; 16 by 16 to 32-bit inh 18 13 ofo offo (if followed by page 2 instruction) eora # opr8i eora opr8a eora opr16a eora oprx0_xysppc eora oprx9 , xysppc eora oprx16 , xysppc eora [d, xysppc ] eora [ oprx16 , xysppc ] exclusive or a (a) (m) ? a or (a) imm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 88 ii 98 dd b8 hh ll a8 xb a8 xb ff a8 xb ee ff a8 xb a8 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf eorb # opr8i eorb opr8a eorb opr16a eorb oprx0_xysppc eorb oprx9 , xysppc eorb oprx16 , xysppc eorb [d, xysppc ] eorb [ oprx16 , xysppc ] exclusive or b (b) (m) ? b or (b) imm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c8 ii d8 dd f8 hh ll e8 xb e8 xb ff e8 xb ee ff e8 xb e8 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf etbl oprx0_xysppc extended table lookup and interpolate, 16-bit; (m:m+1)+ [(b) ((m+2:m+3)?m:m+1))] ? d idx 18 3f xb orrffffffp before executing etbl, initialize b with fractional part of lookup value; initialize index register to point to first table entry (m:m+1). no exten sions or indirect addressing allowed. exg abcdxysp , abcdxysp exchange register contents (r1) ? (r2) r1 and r2 same size $00:(r1) ? r2r1=8-bit; r2=16-bit (r1 l ) ? (r2)r1=16-bit; r2=8-bit inh b7 eb p fdiv fractional divide; (d) (x) ? x remainder ? d; 16 by 16-bit inh 18 11 offffffffffo ibeq abdxysp , rel9 increment and branch if equal to 0 (counter)+1 ? counter if (counter)=0, then branch rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) ibne abdxysp , rel9 increment and branch if not equal to 0 (counter)+1 ? counter if (counter) 0, then branch rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) idiv integer divide, unsigned; (d) (x) ? x remainder ? d; 16 by 16-bit inh 18 10 offffffffffo idivs integer divide, signed; (d) (x) ? x remainder ? d; 16 by 16-bit inh 18 15 offffffffffo inc opr16a inc oprx0_xysppc inc oprx9 , xysppc inc oprx16 , xysppc inc [d, xysppc ] inc [ oprx16 , xysppc ] inca incb increment m; (m)+1 ? m increment a; (a)+1 ? a increment b; (b)+1 ? b ext idx idx1 idx2 [d,idx] [idx2] inh inh 72 hh ll 62 xb 62 xb ff 62 xb ee ff 62 xb 62 xb ee ff 42 52 rpwo rpw rpwo frpwp fifrpw fiprpw o o table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ???? ?? ? ?? ? ?? 0 ?? 0 ?? ? ??? ? 0 ? ???? ??? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 43 inssame as leas 1,sp increment sp; (sp)+1 ? sp idx 1b 81 pf inx increment x; (x)+1 ? x inh 08 o iny increment y; (y)+1 ? y inh 02 o jmp opr16a jmp oprx0_xysppc jmp oprx9 , xysppc jmp oprx16 , xysppc jmp [d, xysppc ] jmp [ oprx16 , xysppc ] jump subroutine address ? pc ext idx idx1 idx2 [d,idx] [idx2] 06 hh ll 05 xb 05 xb ff 05 xb ee ff 05 xb 05 xb ee ff ppp ppp ppp fppp fifppp fifppp jsr opr8a jsr opr16a jsr oprx0_xysppc jsr oprx9 , xysppc jsr oprx16 , xysppc jsr [d, xysppc ] jsr [ oprx16 , xysppc ] jump to subroutine (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 subroutine address ? pc dir ext idx idx1 idx2 [d,idx] [idx2] 17 dd 16 hh ll 15 xb 15 xb ff 15 xb ee ff 15 xb 15 xb ee ff sppp sppp ppps ppps fppps fifppps fifppps lbcc rel16 same as lbhs long branch if c clear; if c=0, then (pc)+4+rel ? pc rel 18 24 qq rr oppp (branch) opo (no branch) lbcs rel16 same as lblo long branch if c set; if c=1, then (pc)+4+rel ? pc rel 18 25 qq rr oppp (branch) opo (no branch) lbeq rel16 long branch if equal; if z=1, then (pc)+4+rel ? pc rel 18 27 qq rr oppp (branch) opo (no branch) lbge rel16 long branch if 0, signed if n v=0, then (pc)+4+rel ? pc rel 18 2c qq rr oppp (branch) opo (no branch) lbgt rel16 long branch if > 0, signed if z | (n v)=0, then (pc)+4+rel ? pc rel 18 2e qq rr oppp (branch) opo (no branch) lbhi rel16 long branch if higher, unsigned if c | z=0, then (pc)+4+rel ? pc rel 18 22 qq rr oppp (branch) opo (no branch) lbhs rel16 same as lbcc long branch if higher or same, unsigned; if c=0, (pc)+4+rel ? pc rel 18 24 qq rr oppp (branch) opo (no branch) lble rel16 long branch if 0, signed; if z|(n v)=1, then (pc)+4+rel ? pc rel 18 2f qq rr oppp (branch) opo (no branch) lblo rel16 same as lbcs long branch if lower, unsigned; if c=1, then (pc)+4+rel ? pc rel 18 25 qq rr oppp (branch) opo (no branch) lbls rel16 long branch if lower or same, unsigned; if c | z=1, then (pc)+4+rel ? pc rel 18 23 qq rr oppp (branch) opo (no branch) lblt rel16 long branch if < 0, signed if n v=1, then (pc)+4+rel ? pc rel 18 2d qq rr oppp (branch) opo (no branch) lbmi rel16 long branch if minus if n=1, then (pc)+4+rel ? pc rel 18 2b qq rr oppp (branch) opo (no branch) lbne rel16 long branch if not equal to 0 if z=0, then (pc)+4+rel ? pc rel 18 26 qq rr oppp (branch) opo (no branch) lbpl rel16 long branch if plus if n=0, then (pc)+4+rel ? pc rel 18 2a qq rr oppp (branch) opo (no branch) lbra rel16 long branch always rel 18 20 qq rr oppp lbrn rel16 long branch never rel 18 21 qq rr opo lbvc rel16 long branch if v clear if v=0,then (pc)+4+rel ? pc rel 18 28 qq rr oppp (branch) opo (no branch) lbvs rel16 long branch if v set if v=1,then (pc)+4+rel ? pc rel 18 29 qq rr oppp (branch) opo (no branch) table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ? ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 44 central processing unit (cpu) motorola ldaa # opr8i ldaa opr8a ldaa opr16a ldaa oprx0_xysppc ldaa oprx9 , xysppc ldaa oprx16 , xysppc ldaa [d, xysppc ] ldaa [ oprx16 , xysppc ] load a (m) ? a or imm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 86 ii 96 dd b6 hh ll a6 xb a6 xb ff a6 xb ee ff a6 xb a6 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf ldab # opr8i ldab opr8a ldab opr16a ldab oprx0_xysppc ldab oprx9 , xysppc ldab oprx16 , xysppc ldab [d, xysppc ] ldab [ oprx16 , xysppc ] load b (m) ? b or imm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c6 ii d6 dd f6 hh ll e6 xb e6 xb ff e6 xb ee ff e6 xb e6 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf ldd # opr16i ldd opr8a ldd opr16a ldd oprx0_xysppc ldd oprx9 , xysppc ldd oprx16 , xysppc ldd [d, xysppc ] ldd [ oprx16 , xysppc ] load d (m:m+1) ? a:b or imm ? a:b imm dir ext idx idx1 idx2 [d,idx] [idx2] cc jj kk dc dd fc hh ll ec xb ec xb ff ec xb ee ff ec xb ec xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf lds # opr16i lds opr8a lds opr16a lds oprx0_xysppc lds oprx9 , xysppc lds oprx16 , xysppc lds [d, xysppc ] lds [ oprx16 , xysppc ] load sp (m:m+1) ? sp or imm ? sp imm dir ext idx idx1 idx2 [d,idx] [idx2] cf jj kk df dd ff hh ll ef xb ef xb ff ef xb ee ff ef xb ef xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf ldx # opr16i ldx opr8a ldx opr16a ldx oprx0_xysppc ldx oprx9 , xysppc ldx oprx16 , xysppc ldx [d, xysppc ] ldx [ oprx16 , xysppc ] load x (m:m+1) ? x or imm ? x imm dir ext idx idx1 idx2 [d,idx] [idx2] ce jj kk de dd fe hh ll ee xb ee xb ff ee xb ee ff ee xb ee xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf ldy # opr16i ldy opr8a ldy opr16a ldy oprx0_xysppc ldy oprx9 , xysppc ldy oprx16 , xysppc ldy [d, xysppc ] ldy [ oprx16 , xysppc ] load y (m:m+1) ? y or imm ? y imm dir ext idx idx1 idx2 [d,idx] [idx2] cd jj kk dd dd fd hh ll ed xb ed xb ff ed xb ee ff ed xb ed xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf leas oprx0_xysppc leas oprx9 , xysppc leas oprx16 , xysppc load effective address into sp ea ? sp idx idx1 idx2 1b xb 1b xb ff 1b xb ee ff pf po pp leax oprx0_xysppc leax oprx9 , xysppc leax oprx16 , xysppc load effective address into x ea ? x idx idx1 idx2 1a xb 1a xb ff 1a xb ee ff pf po pp leay oprx0_xysppc leay oprx9 , xysppc leay oprx16 , xysppc load effective address into y ea ? y idx idx1 idx2 19 xb 19 xb ff 19 xb ee ff pf po pp table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ?? 0 ?? 0 ?? 0 ?? 0 ?? 0 ?? 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 45 lsl opr16a same as asl lsl oprx0_xysppc lsl oprx9 , xysppc lsl oprx16 , xysppc lsl [d, xysppc ] lsl [ oprx16 , xysppc ] lslasame as asla lslbsame as aslb logical shift left m logical shift left a logical shift left b ext idx idx1 idx2 [d,idx] [idx2] inh inh 78 hh ll 68 xb 68 xb ff 68 xb ee ff 68 xb 68 xb ee ff 48 58 ropw rpw rpow frppw fifrpw fiprpw o o lsldsame as asld logical shift left d inh 59 o lsr opr16a lsr oprx0_xysppc lsr oprx9 , xysppc lsr oprx16 , xysppc lsr [d, xysppc ] lsr [ oprx16 , xysppc ] lsra lsrb logical shift right m logical shift right a logical shift right b ext idx idx1 idx2 [d,idx] [idx2] inh inh 74 hh ll 64 xb 64 xb ff 64 xb ee ff 64 xb 64 xb ee ff 44 54 rpwo rpw rpwo frpwp fifrpw fiprpw o o lsrd logical shift right d inh 49 o maxa oprx0_xysppc maxa oprx9 , xysppc maxa oprx16 , xysppc maxa [d, xysppc ] maxa [ oprx16 , xysppc ] maximum in a; put larger of 2 unsigned 8-bit values in a max[(a), (m)] ? a n, z, v, c bits reflect result of internal compare [(a)?m)] idx idx1 idx2 [d,idx] [idx2] 18 18 xb 18 18 xb ff 18 18 xb ee ff 18 18 xb 18 18 xb ee ff orpf orpo ofrpp ofifrpf ofiprpf maxm oprx0_xysppc maxm oprx9 , xysppc maxm oprx16 , xysppc maxm [d, xysppc ] maxm [ oprx16 , xysppc ] maximum in m; put larger of 2 unsigned 8-bit values in m max[(a), (m)] ? m n, z, v, c bits reflect result of internal compare [(a)?m)] idx idx1 idx2 [d,idx] [idx2] 18 1c xb 18 1c xb ff 18 1c xb ee ff 18 1c xb 18 1c xb ee ff orpw orpwo ofrpwp ofifrpw ofiprpw mem determine grade of membership; (grade) ? m y ; (x)+4 ? x; (y)+1 ? y if (a)p2, then =0; else = min[((a)?1) s1, (p2?a)) s2, $ff] (a)=current crisp input value; x points at 4 data bytes (p1, p2, s1, s2) of a trapezoidal membership function; y points at fuzzy input (ram location) special 01 rrfow mina oprx0_xysppc mina oprx9 , xysppc mina oprx16 , xysppc mina [d, xysppc ] mina [ oprx16 , xysppc ] minimum in a; put smaller of 2 unsigned 8-bit values in a min[(a), (m)] ? a n, z, v, c bits reflect result of internal compare [(a)?m)] idx idx1 idx2 [d,idx] [idx2] 18 19 xb 18 19 xb ff 18 19 xb ee ff 18 19 xb 18 19 xb ee ff orpf orpo ofrpp ofifrpf ofiprpf minm oprx0_xysppc minm oprx9 , xysppc minm oprx16 , xysppc minm [d, xysppc ] minm [ oprx16 , xysppc ] minimum in n; put smaller of two unsigned 8-bit values in m min[(a), (m)] ? m n, z, v, c bits reflect result of internal compare [(a)?m)] idx idx1 idx2 [d,idx] [idx2] 18 1d xb 18 1d xb ff 18 1d xb ee ff 18 1d xb 18 1d xb ee ff orpw orpwo ofrpwp ofifrpw ofiprpw movb # opr8 , opr16a movb # opr8i , oprx0_xysppc movb opr16a , opr16a movb opr16a , oprx0_xysppc movb oprx0_xysppc , opr16a movb oprx0_xysppc , oprx0_xysppc move byte memory-to-memory 8-bit byte-move (m 1 ) ? m 2 first operand specifies byte to move imm-ext imm-idx ext-ext ext-idx idx-ext idx-idx 18 0b ii hh ll 18 08 xb ii 18 0c hh ll hh ll 18 09 xb hh ll 18 0d xb hh ll 18 0a xb xb opwp opwo orpwpo oprpw orpwp orpwo table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c c 0 b7 b0 ???? c 0 b7 b0 ab b7 b0 ?? ?? ???? c 0 b7 b0 0 ??? c b7 b0 ab b7 b0 0 0 ??? ???? ???? ????? ???? ???? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 46 central processing unit (cpu) motorola movw # oprx16 , opr16a movw # opr16i , oprx0_xysppc movw opr16a , opr16a movw opr16a , oprx0_xysppc movw oprx0_xysppc , opr16a movw oprx0_xysppc , oprx0_xysppc move word memory-to-memory 16-bit word-move (m 1 :m 1 +1) ? m 2 :m 2 +1 first operand specifies word to move imm-ext imm-idx ext-ext ext-idx idx-ext idx-idx 18 03 jj kk hh ll 18 00 xb jj kk 18 04 hh ll hh ll 18 01 xb hh ll 18 05 xb hh ll 18 02 xb xb opwpo oppw orpwpo oprpw orpwp orpwo mul multiply, unsigned (a) (b) ? a:b; 8 by 8-bit inh 12 o neg opr16a neg oprx0_xysppc neg oprx9 , xysppc neg oprx16 , xysppc neg [d, xysppc ] neg [ oprx16 , xysppc ] nega negb negate m; 0?m) ? mor( m)+1 ? m negate a; 0?a) ? aor( a)+1 ? a negate b; 0?b) ? bor( b)+1 ? b ext idx idx1 idx2 [d,idx] [idx2] inh inh 70 hh ll 60 xb 60 xb ff 60 xb ee ff 60 xb 60 xb ee ff 40 50 rpwo rpw rpwo frpwp fifrpw fiprpw o o nop no operation inh a7 o oraa # opr8i oraa opr8a oraa opr16a oraa oprx0_xysppc oraa oprx9 , xysppc oraa oprx16 , xysppc oraa [d, xysppc ] oraa [ oprx16 , xysppc ] or accumulator a (a) | (m) ? a or (a) | imm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 8a ii 9a dd ba hh ll aa xb aa xb ff aa xb ee ff aa xb aa xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf orab # opr8i orab opr8a orab opr16a orab oprx0_xysppc orab oprx9 , xysppc orab oprx16 , xysppc orab [d, xysppc ] orab [ oprx16 , xysppc ] or accumulator b (b) | (m) ? b or (b) | imm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] ca ii da dd fa hh ll ea xb ea xb ff ea xb ee ff ea xb ea xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf orcc # opr8i or ccr; (ccr) | imm ? ccr imm 14 ii p psha push a; (sp)? ? sp; (a) ? m sp inh 36 os pshb push b; (sp)? ? sp; (b) ? m sp inh 37 os pshc push ccr; (sp)? ? sp; (ccr) ? m sp inh 39 os pshd push d (sp)? ? sp; (a:b) ? m sp :m sp+1 inh 3b os pshx push x (sp)? ? sp; (x h :x l ) ? m sp :m sp+1 inh 34 os pshy push y (sp)? ? sp; (y h :y l ) ? m sp :m sp+1 inh 35 os pula pull a (m sp ) ? a; (sp)+1 ? sp inh 32 ufo pulb pull b (m sp ) ? b; (sp)+1 ? sp inh 33 ufo pulc pull ccr (m sp ) ? ccr; (sp)+1 ? sp inh 38 ufo puld pull d (m sp :m sp+1 ) ? a:b; (sp)+2 ? sp inh 3a ufo table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ? ???? ?? 0 ?? 0 ? ?????? ? ? ?????? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 47 pulx pull x (m sp :m sp+1 ) ? x h :x l ; (sp)+2 ? sp inh 30 ufo puly pull y (m sp :m sp+1 ) ? y h :y l ; (sp)+2 ? sp inh 31 ufo rev rule evaluation, unweighted; find smallest rule input; store to rule outputs unless fuzzy output is larger special 18 3a orf(t^tx)o* ff+orft^** *the t^tx loop is executed once for each element in the rule list. the ^ denotes a check for pending interrupt requests. **these are additional cycles caused by an interrupt: ff is the exit sequence and orft^ is the re-entry sequence. revw rule evaluation, weighted; rule weights optional; find smallest rule input; store to rule outputs unless fuzzy output is larger special 18 3b orf(t^tx)o* or orf(r^ffrf)o** ffff+orft^*** ffff+orfr^**** *with weighting not enabled, the t^tx loop is executed once for each element in the rule list. the ^ denotes a check for pending interrupt requests. **with weighting enabled, the t^tx loop is replaced by r^ffrf . ***additional cycles caused by an interrupt when weighting is not enabled: ffff is the exit sequence and orft^ is the re-entry sequence. **** additional cycles caused by an interrupt when weighting is enabled: ffff is the exit sequence and orfr^ is the re-entry sequence. rol opr16a rol oprx0_xysppc rol oprx9 , xysppc rol oprx16 , xysppc rol [d, xysppc ] rol [ oprx16 , xysppc ] rola rolb rotate left m rotate left a rotate left b ext idx idx1 idx2 [d,idx] [idx2] inh inh 75 hh ll 65 xb 65 xb ff 65 xb ee ff 65 xb 65 xb ee ff 45 55 rpwo rpw rpwo frpwp fifrpw fiprpw o o ror opr16a ror oprx0_xysppc ror oprx9 , xysppc ror oprx16 , xysppc ror [d, xysppc ] ror [ oprx16 , xysppc ] rora rorb rotate right m rotate right a rotate right b ext idx idx1 idx2 [d,idx] [idx2] inh inh 76 hh ll 66 xb 66 xb ff 66 xb ee ff 66 xb 66 xb ee ff 46 56 rpwo rpw rpwo frpwp fifrpw fiprpw o o rtc return from call; (m sp ) ? ppage (sp)+1 ? sp; (m sp :m sp+1 ) ? pc h :pc l (sp)+2 ? sp inh 0a uunfppp rti return from interrupt (m sp ) ? ccr; (sp)+1 ? sp (m sp :m sp+1 ) ? b:a;(sp)+2 ? sp (m sp :m sp+1 ) ? x h :x l ;(sp)+4 ? sp (m sp :m sp+1 ) ? pc h :pc l ;(sp)+2 ? sp (m sp :m sp+1 ) ? y h :y l ;(sp)+4 ? sp inh 0b uuuuuppp or uuuuufvfppp* *rti takes 11 cycles if an interrupt is pending. rts return from subroutine (m sp :m sp+1 ) ? pc h :pc l ; (sp)+2 ? sp inh 3d ufppp sba subtract b from a; (a)?b) ? a inh 18 16 oo table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ??? ? ? ??? ? ! c b7 b0 ???? c b7 b0 ???? ? ? ?????? ???? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 48 central processing unit (cpu) motorola sbca # opr8i sbca opr8a sbca opr16a sbca oprx0_xysppc sbca oprx9 , xysppc sbca oprx16 , xysppc sbca [d, xysppc ] sbca [ oprx16 , xysppc ] subtract with carry from a (a)?m)? ? a or (a)?mm? ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 82 ii 92 dd b2 hh ll a2 xb a2 xb ff a2 xb ee ff a2 xb a2 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf sbcb # opr8i sbcb opr8a sbcb opr16a sbcb oprx0_xysppc sbcb oprx9 , xysppc sbcb oprx16 , xysppc sbcb [d, xysppc ] sbcb [ oprx16 , xysppc ] subtract with carry from b (b)?m)? ? b or (b)?mm? ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c2 ii d2 dd f2 hh ll e2 xb e2 xb ff e2 xb ee ff e2 xb e2 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf secsame as orcc #$01 set c bit imm 14 01 p seisame as orcc #$10 set i bit imm 14 10 p sevsame as orcc #$02 set v bit imm 14 02 p sex abc , dxysp same as tfr r1, r2 sign extend; 8-bit r1 to 16-bit r2 $00:(r1) ? r2 if bit 7 of r1 is 0 $ff:(r1) ? r2 if bit 7 of r1 is 1 inh b7 eb p staa opr8a staa opr16a staa oprx0_xysppc staa oprx9 , xysppc staa oprx16 , xysppc staa [d, xysppc ] staa [ oprx16 , xysppc ] store accumulator a (a) ? m dir ext idx idx1 idx2 [d,idx] [idx2] 5a dd 7a hh ll 6a xb 6a xb ff 6a xb ee ff 6a xb 6a xb ee ff pw pwo pw pwo pwp pifw pipw stab opr8a stab opr16a stab oprx0_xysppc stab oprx9 , xysppc stab oprx16 , xysppc stab [d, xysppc ] stab [ oprx16 , xysppc ] store accumulator b (b) ? m dir ext idx idx1 idx2 [d,idx] [idx2] 5b dd 7b hh ll 6b xb 6b xb ff 6b xb ee ff 6b xb 6b xb ee ff pw pwo pw pwo pwp pifw pipw std opr8a std opr16a std oprx0_xysppc std oprx9 , xysppc std oprx16 , xysppc std [d, xysppc ] std [ oprx16 , xysppc ] store d (a:b) ? m:m+1 dir ext idx idx1 idx2 [d,idx] [idx2] 5c dd 7c hh ll 6c xb 6c xb ff 6c xb ee ff 6c xb 6c xb ee ff pw pwo pw pwo pwp pifw pipw stop stop processing; (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (sp)? ? sp; (y h :y l ) ? m sp :m sp+1 (sp)? ? sp; (x h :x l ) ? m sp :m sp+1 (sp)? ? sp; (b:a) ? m sp :m sp+1 (sp)? ? sp; (ccr) ? m sp stop all clocks inh 18 3e oosssssf (enter stop mode) fvfppp (exit stop mode) ff (continue stop mode) oo (if stop mode disabled by s=1) table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ???? ???? ? ? 1 ?? 0 ?? 0 ?? 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 49 sts opr8a sts opr16a sts oprx0_xysppc sts oprx9 , xysppc sts oprx16 , xysppc sts [d, xysppc ] sts [ oprx16 , xysppc ] store sp (sp h :sp l ) ? m:m+1 dir ext idx idx1 idx2 [d,idx] [idx2] 5f dd 7f hh ll 6f xb 6f xb ff 6f xb ee ff 6f xb 6f xb ee ff pw pwo pw pwo pwp pifw pipw stx opr8a stx opr16a stx oprx0_xysppc stx oprx9 , xysppc stx oprx16 , xysppc stx [d, xysppc ] stx [ oprx16 , xysppc ] store x (x h :x l ) ? m:m+1 dir ext idx idx1 idx2 [d,idx] [idx2] 5e dd 7e hh ll 6e xb 6e xb ff 6e xb ee ff 6e xb 6e xb ee ff pw pwo pw pwo pwp pifw pipw sty opr8a sty opr16a sty oprx0_xysppc sty oprx9 , xysppc sty oprx16 , xysppc sty [d, xysppc ] sty [ oprx16 , xysppc ] store y (y h :y l ) ? m:m+1 dir ext idx idx1 idx2 [d,idx] [idx2] 5d dd 7d hh ll 6d xb 6d xb ff 6d xb ee ff 6d xb 6d xb ee ff pw pwo pw pwo pwp pifw pipw suba # opr8i suba opr8a suba opr16a suba oprx0_xysppc suba oprx9 , xysppc suba oprx16 , xysppc suba [d, xysppc ] suba [ oprx16 , xysppc ] subtract from a (a)?m) ? a or (a)?mm ? a imm dir ext idx idx1 idx2 [d,idx] [idx2] 80 ii 90 dd b0 hh ll a0 xb a0 xb ff a0 xb ee ff a0 xb a0 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf subb # opr8i subb opr8a subb opr16a subb oprx0_xysppc subb oprx9 , xysppc subb oprx16 , xysppc subb [d, xysppc ] subb [ oprx16 , xysppc ] subtract from b (b)?m) ? b or (b)?mm ? b imm dir ext idx idx1 idx2 [d,idx] [idx2] c0 ii d0 dd f0 hh ll e0 xb e0 xb ff e0 xb ee ff e0 xb e0 xb ee ff p rpf rpo rpf rpo frpp fifrpf fiprpf subd # opr16i subd opr8a subd opr16a subd oprx0_xysppc subd oprx9 , xysppc subd oprx16 , xysppc subd [d, xysppc ] subd [ oprx16 , xysppc ] subtract from d (a:b)?m:m+1) ? a:b or (a:b)?mm ? a:b imm dir ext idx idx1 idx2 [d,idx] [idx2] 83 jj kk 93 dd b3 hh ll a3 xb a3 xb ff a3 xb ee ff a3 xb a3 xb ee ff po rpf rpo rpf rpo frpp fifrpf fiprpf swi software interrupt; (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (sp)? ? sp; (y h :y l ) ? m sp :m sp+1 (sp)? ? sp; (x h :x l ) ? m sp :m sp+1 (sp)? ? sp; (b:a) ? m sp :m sp+1 (sp)? ? sp; (ccr) ? m sp ;1 ? i (swi vector) ? pc inh 3f vspsspssp* *the cpu also uses vspsspssp for hardware interrupts and unimplemented opcode traps. tab transfer a to b; (a) ? b inh 18 0e oo tap transfer a to ccr; (a) ? ccr assembled as tfr a, ccr inh b7 02 p tba transfer b to a; (b) ? a inh 18 0f oo table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ?? 0 ?? 0 ?? 0 ???? ???? ???? ? ?? 0 ? ? ?????? ?? 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 50 central processing unit (cpu) motorola tbeq abdxysp , rel9 test and branch if equal to 0 if (counter)=0, then (pc) + 2 + rel ? pc rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) tbl oprx0_xysppc table lookup and interpolate, 8-bit (m)+[(b) ((m+1)?m))] ? a idx 18 3d xb orfffp tbne abdxysp , rel9 test and branch if not equal to 0 if (counter) 0, then (pc) + 2 + rel ? pc rel (9-bit) 04 lb rr ppp (branch) ppo (no branch) tfr abcdxysp , abcdxysp transfer from register to register (r1) ? r2r1 and r2 same size $00:(r1) ? r2r1=8-bit; r2=16-bit (r1 l ) ? r2r1=16-bit; r2=8-bit inh b7 eb p or tpasame as tfr ccr,a transfer ccr to a; (ccr) ? a inh b7 20 p trap trapnum trap unimplemented opcode; (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (sp)? ? sp; (y h :y l ) ? m sp :m sp+1 (sp)? ? sp; (x h :x l ) ? m sp :m sp+1 (sp)? ? sp; (b:a) ? m sp :m sp+1 (sp)? ? sp; (ccr) ? m sp 1 ? i; (trap vector) ? pc inh 18 tn tn = $30?39 or tn = $40?ff ovspsspssp tst opr16a tst oprx0_xysppc tst oprx9 , xysppc tst oprx16 , xysppc tst [d, xysppc ] tst [ oprx16 , xysppc ] tsta tstb test m; (m)? test a; (a)? test b; (b)? ext idx idx1 idx2 [d,idx] [idx2] inh inh f7 hh ll e7 xb e7 xb ff e7 xb ee ff e7 xb e7 xb ee ff 97 d7 rpo rpf rpo frpp fifrpf fiprpf o o tsxsame as tfr sp,x transfer sp to x; (sp) ? x inh b7 75 p tsysame as tfr sp,y transfer sp to y; (sp) ? y inh b7 76 p txssame as tfr x,sp transfer x to sp; (x) ? sp inh b7 57 p tyssame as tfr y,sp transfer y to sp; (y) ? sp inh b7 67 p wai wait for interrupt; (sp)? ? sp rtn h :rtn l ? m sp :m sp+1 (sp)? ? sp; (y h :y l ) ? m sp :m sp+1 (sp)? ? sp; (x h :x l ) ? m sp :m sp+1 (sp)? ? sp; (b:a) ? m sp :m sp+1 (sp)? ? sp; (ccr) ? m sp inh 3e osssssf (before interrupt) fvfppp (after interrupt) or or wav calculate weighted average; sum of products (sop) and sum of weights (sow)* special 18 3c of(frr^ffff)o** sss+uuurr^*** *initialize b, x, and y: b=number of elements; x points at first element in s i list; y points at first element in f i list. all s i and f i elements are 8-bit values. **the frr^ffff sequence is the loop for one iteration of sop and sow accumulation. the ^ denotes a check for pending interrupt requests. ***additional cycles caused by an interrupt: sss is the exit sequence and uuurr^ is the re-entry sequence. intermediate values use six stack bytes. wavr* resume executing interrupted wav special 3c uuurr^ffff(frr^ ffff)o** sss+uuurr^*** table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c ?? ? ? ? ?????? ? ?? 00 ? ?? f i i1 = b x ? s i f i i1 = b y:d ? ?? ? ?? ?? ? ?? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 51 register and memory notation *wavr is a pseudoinstruction that recovers intermediate results from the stack rather than initializing them to 0. **the frr^ffff sequence is the loop for one iteration of sop and sow recovery. the ^ denotes a check for pending interrupt requests. ***these are additional cycles caused by an interrupt: sss is the exit sequence and uuurr^ is the re-entry sequence. xgdxsame as exg d, x exchange d with x; (d) ? (x) inh b7 c5 p xgdysame as exg d, y exchange d with y; (d) ? (y) inh b7 c6 p table 4 instruction set summary (continued) source form operation address mode machine coding (hex) access detail s x h i n z v c table 5 register and memory notation a or a accumulator a an bit n of accumulator a b or b accumulator b bn bit n of accumulator b d or d accumulator d dn bit n of accumulator d x or x index register x x h high byte of index register x x l low byte of index register x xn bit n of index register x y or y index register y y h high byte of index register y y l low byte of index register y yn bit n of index register y sp or sp stack pointer spn bit n of stack pointer pc or pc program counter pc h high byte of program counter pc l low byte of program counter ccr or c condition code register m address of 8-bit memory location mn bit n of byte at memory location m rn bit n of the result of an arithmetic or logical operation in bit n of the intermediate result of an arithmetic or logical operation rtn h high byte of return address rtn l low byte of return address ( ) contents of f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 52 central processing unit (cpu) motorola source form notation the source form column of the summary in table 4 gives essential information about assembler source forms. for complete information about writing source files for a particular assembler, refer to the documentation provided by the assembler vendor. everything in the source form column, except expressions in italic characters , is literal information which must appear in the assembly source file exactly as shown. the initial 3- to 5-letter mnemonic is always a literal expression. all commas, pound signs (#), parentheses, square brackets ( [ or ] ), plus signs (+), minus signs (?, and the register designation (a, b, d), are literal characters. the groups of italic characters shown in table 6 represent variable information to be supplied by the programmer. these groups can include any alphanumeric character or the underscore character, but cannot include a space or comma. for example, the groups xysppc and oprx0_xysppc are both valid, but the two groups oprx0 xysppc are not valid because there is a space between them. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 53 table 6 source form notation abc register designator for a, b, or ccr abcdxysp register designator for a, b, ccr, d, x, y, or sp abd register designator for a, b, or d abdxysp register designator for a, b, d, x, y, or sp dxysp register designator for d, x, y, or sp msk8 8-bit mask value some assemblers require the # symbol before the mask value. opr8i 8-bit immediate value opr16i 16-bit immediate value opr8a 8-bit address value used with direct address mode opr16a 16-bit address value oprx0_xysp indexed addressing postbyte code: oprx3 , ?ysp predecrement x , y, or sp by 1? oprx3 , +xysp preincrement x , y, or sp by 1? oprx3 , xysp postdecrement x, y, or sp by 1? oprx3 , xysp+ postincrement x, y, or sp by 1? oprx5 , xysppc 5-bit constant offset from x, y, sp, or pc abd , xysppc accumulator a, b, or d offset from x, y, sp, or pc oprx3 any positive integer from 1 to 8 for pre/post increment/decrement oprx5 any integer from ?6 to +15 oprx9 any integer from ?56 to +255 oprx16 any integer from ?2,768 to +65,535 page 8-bit value for ppage register some assemblers require the # symbol before this value. rel8 label of branch destination within ?56 to +255 locations rel9 label of branch destination within ?12 to +511 locations rel16 any label within the 64-kbyte memory space trapnum any 8-bit integer from $30 to $39 or from $40 to $ff xysp register designator for x or y or sp xysppc register designator for x or y or sp or pc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 54 central processing unit (cpu) motorola operation notation address mode notation machine code notation in the machine code (hex) column of the summary in table 4 , digits 0? and upper case letters a? represent hexadecimal values. pairs of lower-case letters represent 8-bit values as shown in table 9 . table 7 operation notation + add subtract ? and |or exclusive or multiply divide : concatenate ? transfer ? exchange table 8 address mode notation inh inherent; no operands in instruction stream imm immediate; operand immediate value in instruction stream dir direct; operand is lower byte of address from $0000 to $00ff ext operand is a 16-bit address rel twos complement relative offset; for branch instructions idx indexed (no extension bytes); includes: 5-bit constant offset from x, y, sp or pc pre/post increment/decrement by 1? accumulator a, b, or d offset idx1 9-bit signed offset from x, y, sp, or pc; 1 extension byte idx2 16-bit signed offset from x, y, sp, or pc; 2 extension bytes [idx2] indexed-indirect; 16-bit offset from x, y, sp, or pc [d, idx] indexed-indirect; accumulator d offset from x, y, sp, or pc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 55 access detail notation a single-letter code in the access detail column of figure 4 represents a single cpu access cycle. an upper-case letter indicates a 16-bit access. table 9 machine code notation dd 8-bit direct address from $0000 to $00ff; high byte is $00 ee high byte of a 16-bit constant offset for indexed addressing eb exchange/transfer postbyte ff low eight bits of a 9-bit signed constant offset in indexed addressing, or low byte of a 16-bit constant offset in indexed addressing hh high byte of a 16-bit extended address ii 8-bit immediate data value jj high byte of a 16-bit immediate data value kk low byte of a 16-bit immediate data value lb loop primitive (dbne) postbyte ll low byte of a 16-bit extended address mm 8-bit immediate mask value for bit manipulation instructions; bits that are set indicate bits to be affected pg program page or bank number used in call instruction qq high byte of a 16-bit relative offset for long branches tn trap number from $30 to $39 or from $40 to $ff rr signed relative offset $80 (?28) to $7f ( + 127) relative to the byte following the relative offset byte, or low byte of a 16-bit relative offset for long branches xb indexed addressing postbyte table 10 access detail notation f free cycle. during an f cycle, the cpu does not use the bus. an f cycle is always one cycle of the system bus clock. an f cycle can be used by a queue controller or the background debug system to perform a single-cycle access without disturbing the cpu. g read ppage register. a g cycle is used only in call instructions and is not visible on the external bus. since ppage is an internal 8-bit register, a g cycle is never stretched. i read indirect pointer. indexed-indirect instructions use the 16-bit indirect pointer from memory to address the instruction operand. an i cycle is a 16-bit read that can be aligned or misaligned. an i cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the corresponding data is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. an i cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. i read indirect ppage value. an i cycle is used only in indexed-indirect call instructions. the 8-bit ppage value for the call destination is fetched from an indirect memory location. an i cycle is stretched only when controlled by a chip-select circuit that is programmed for slow memory. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 56 central processing unit (cpu) motorola n write ppage register. an n cycle is used only in call and rtc instructions to write the destination value of the ppage register and is not visible on the external bus. since the ppage register is an internal 8-bit register, an n cycle is never stretched. o optional cycle. an o cycle adjusts instruction alignment in the instruction queue. an o cycle can be a free cycle ( f ) or a program word access cycle ( p ). when the ?st byte of an instruction with an odd number of bytes is misaligned, the o cycle becomes a p cycle to maintain queue order. if the ?st byte is aligned, the o cycle is an f cycle. the $18 prebyte for a page-two opcode is treated as a special one-byte instruction. if the prebyte is misaligned, the o cycle at the beginning of the instruction becomes a p cycle to maintain queue order. if the prebyte is aligned, the o cycle is an f cycle. if the instruction has an odd number of bytes, it has a second o cycle at the end. if the ?st o cycle is a p cycle (prebyte misaligned), the second o cycle is an f cycle. if the ?st o cycle is an f cycle (prebyte aligned), the second o cycle is a p cycle. an o cycle that becomes a p cycle can be extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the program is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. an o cycle that becomes an f cycle is never stretched. p program word access. program information is fetched as aligned 16-bit words. a p cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the program is stored externally. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. r 8-bit data read. an r cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. r 16-bit data read. an r cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the corresponding data is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. an r cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. s stack 8-bit data. an s cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. s stack 16-bit data. an s cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the sp is pointing to external memory. there can be additional stretching if the address space is assigned to a chip-select circuit programmed for slow memory. an s cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. the internal ram is designed to allow single cycle misaligned word access. w 8-bit data write. a w cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. w 16-bit data write. a w cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the corresponding data is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. a w cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. u unstack 8-bit data. a w cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. table 10 access detail notation (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) instruction set overview mc9s12t64revision 1.1.1 motorola central processing unit (cpu) 57 u unstack 16-bit data. a u cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the sp is pointing to external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. a u cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. the internal ram is designed to allow single-cycle misaligned word access. v 16-bit vector fetch. vectors are always aligned 16-bit words. a v cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the program is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. t 8-bit conditional read. a t cycle is either a data read cycle or a free cycle, depending on the data and ?w of the revw instruction. a t cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. t 16-bit conditional read. a t cycle is either a data read cycle or a free cycle, depending on the data and ?w of the rev or revw instruction. a t cycle is extended to two bus cycles if the mcu is operating with an 8-bit external data bus and the corresponding data is stored in external memory. there can be additional stretching when the address space is assigned to a chip-select circuit programmed for slow memory. a t cycle is also stretched if it corresponds to a misaligned access to a memory that is not designed for single-cycle misaligned access. x 8-bit conditional write. an x cycle is either a data write cycle or a free cycle, depending on the data and ?w of the rev or revw instruction. an x cycle is stretched only when controlled by a chip-select circuit programmed for slow memory. special notation for branch taken/not taken ppp/p a short branch requires three cycles if taken, one cycle if not taken. since the instruction consists of a single word containing both an opcode and an 8-bit offset, the not-taken case is simple ?the queue advances, another program word fetch is made, and execution continues with the next instruction. the taken case requires that the queue be re?led so that execution can continue at a new address. first, the effective address of the destination is determined, then the cpu performs three program word fetches from that address. oppp/opo a long branch requires four cycles if taken, three cycles if not taken. an o cycle is required because all long branches are page two opcodes and thus include the $18 prebyte. the prebyte is treated as a one-byte instruction. if the prebyte is misaligned, the o cycle is a p cycle; if the prebyte is aligned, the o cycle is an f cycle. as a result, both the taken and not-taken cases use one o cycle for the prebyte. in the not-taken case, the queue must advance so that execution can continue with the next instruction, and another o cycle is required to maintain the queue. the taken case requires that the queue be re?led so that execution can continue at a new address. first, the effective address of the destination is determined, then the cpu performs three program word fetches from that address. table 10 access detail notation (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
central processing unit (cpu) mc9s12t64revision 1.1.1 58 central processing unit (cpu) motorola condition code state notation table 11 condition code state notation not changed by operation 0 cleared by operation 1 set by operation ? set or cleared by operation ? may be cleared or remain set, but not set by operation ? may be set or remain cleared, but not cleared by operation ? may be changed by operation but ?al state not de?ed ! used for a special purpose f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola pinout and signal description 59 pinout and signal description contents mc9s12t64 pin assignments in 80-pin lqfp . . . . . . . . . . . . . . . . . . 59 power supply pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 port signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 mc9s12t64 pin assignments in 80-pin lqfp the mc9s12t64 is available in an 80-pin low-profile quad flat package (lqfp). most pins perform two or more functions, as described in the signal descriptions . figure 11 shows pin assignments. in expanded narrow modes the lower byte data is multiplexed with higher byte data through pins pa7:0 (port a). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 60 pinout and signal description motorola figure 11 pin assignments in 80-pin lqfp for mc9s12t64 mc9s12t64 80-pin lqfp ps4 / miso test 45 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 21 22 44 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 41 42 43 46 47 48 49 50 51 52 53 54 55 56 57 58 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 pe7 / noacc / xclks pa0 / addr8/data8/data0 pa1 / addr9/data9/data1 pa2 / addr10/data10/data2 pa3 / addr11/data11/data3 pa4 / addr12/data12/data4 pwm0 / pp0 pwm1 / pp1 pwm2 / pp2 modc/ t a ghi/si / bkgd ioc7 / pt7 ioc5 / pt5 ioc4 / pt4 ioc3 / pt3 ioc2 / pt2 pe6 / modb/ipipe1 romone/ ecs / pk7 extal v sspll xfc r/ w / pe2 irq / pe1 pe4 / eclk v ddpll v ddr v ssr vregen reset xirq / pe0 pwm7 / pp7 pwm6 / pp6 pwm5 / pp5 pwm4 / pp4 pwm3 / pp3 v ddx pad3 / an3 pad2 / an2 pad1 / an1 pad0 / an0 v rl v rh v dda pa7 / addr15/data15/data7 pa6 / addr14/data14/data6 v ss2 v dd2 pa5 / addr13/data13/data5 pad6 / an6 pad7 / an7 / etrig v ssa ps0 / rxd0 ps1 / txd0 ps2 / rxd1 ps3 / txd1 ps6 / sck ps7 / ss pe5 / moda/ipipe0 port ad port a port b port s port p shaded pins are power and ground t a glo / lstrb / pe3 pad4 / an4 pad5 / an5 v ssx v ss1 v dd1 ps5 / mosi port t ebdm sckbdm /spimode so ioc6 / pt6 port e port a xtal pt0 / ioc0 pt1 / ioc1 addr0/data0 / pb0 addr7/data7 / pb7 addr6/data6 / pb6 addr5/data5 / pb5 addr4/data4 / pb4 addr3/data3 / pb3 addr2/data2 / pb2 addr1/data1 / pb1 19 20 39 40 59 60 79 80 port k f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64 pin assignments in 80-pin lqfp mc9s12t64revision 1.1.1 motorola pinout and signal description 61 figure 12 80-pin lqfp mechanical dimensions detail a e 61 60 41 40 80 d hd 120 21 e he a2 a1 a l l1 detail a zd or ze b (after plating) x y dim millimeters min. typ. max. a 1.70 a1 0.05 0.10 0.15 a2 1.40 b 0.17 0.22 0.27 c 0.10 0.17 0.20 d 11.90 12.00 12.10 e 11.90 12.00 12.10 e 0.50 hd 13.80 14.00 14.20 he 13.80 14.00 14.20 l 0.50 l1 0.80 1.00 1.20 0.0 10.0 x 0.10 y 0.10 zd 1.25 ze 1.25 c (after pla ting) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 62 pinout and signal description motorola power supply pins mc9s12t64 power and ground pins are described below and summarized in table 12 . note: all vss pins must be connected together in the applications. v ddx , v ssx power & ground pins for i/o drivers external power and ground for i/o drivers. because fast signal transitions place high, short-duration current demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. bypass requirements depend on how heavily the mcu pins are loaded. v ddr , v ssr power & ground pins for i/o drivers & for internal voltage regulator external power and ground for i/o drivers and input to the internal voltage regulator. because fast signal transitions place high, short-duration current demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. bypass requirements depend on how heavily the mcu pins are loaded. v dd1 , v dd2 , v ss1 , v ss2 core power pins power is supplied to the mcu through v dd and v ss . because fast signal transitions place high, short-duration current demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. this 2.5v supply is derived from the internal voltage regulator. no static load is allowed on these pins. the internal voltage regulator is turned off, if vregen is tied to ground. note: no load allowed except for bypass capacitors. v dda , v ssa power supply pins for atd and vreg v dda and v ssa are the power supply and ground input pins for the voltage regulator and the analog to digital converter. it also provides the reference for the internal voltage regulator.this allows the supply voltage to the a/d and the reference voltage to be bypassed independently. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description power supply pins mc9s12t64revision 1.1.1 motorola pinout and signal description 63 v rh , v rl ?atd reference voltage input pins v rh and v rl are the reference voltage input pins for the analog-to-digital converter. v ddpll , v sspll power supply pins for pll provides operating voltage and ground for the oscillator and the phased-locked loop. this allows the supply voltage to the oscillator and pll to be bypassed independently.this 2.5v voltage is generated by the internal voltage regulator. note: no load allowed except for bypass capacitors. vregen ?on chip voltage regulator enable enables the internal 5v to 2.5v voltage regulator. if this pin is tied low, vdd1,2 and vddpll must be supplied externally. note: the voltage regulator must be enabled for proper lvd operation. if the voltage regulator is disabled, the lvd operation is unpredictable. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 64 pinout and signal description motorola table 12 mc9s12t64 power and ground connection summary mnemonic pin number nominal voltage description 80 lqfp v dd1 10 2.5 v internal power and ground generated by internal regulator v ss1 11 0 v v dd2 50 2.5 v v ss2 51 0 v v ddr 34 5.0 v external power and ground, supply to pin drivers and internal voltage regulator. v ssr 35 0 v v ddx 77 5.0 v external power and ground, supply to pin drivers. v ssx 76 0 v v dda 55 5.0 v operating voltage and ground for the analog-to-digital converters and the reference for the internal voltage regulator, allows the supply voltage to the a/d to be bypassed independently. v ssa 58 0 v v rl 57 0 v reference voltages for the analog-to-digital converter. v rh 56 5.0 v v ddpll 33 2.5 v provides operating voltage and ground for the phased-locked loop. this allows the supply voltage to the pll to be bypassed independently. internal power and ground generated by internal regulator. v sspll 31 0 v vregen 75 5.0 v internal voltage regulator enable/disable f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description signal descriptions mc9s12t64revision 1.1.1 motorola pinout and signal description 65 signal descriptions extal, xtal oscillator pins extal and xtal are the crystal driver and external clock pins. on reset all the device clocks are derived from the extal input frequency. xtal is the crystal output. refer to the clocks and reset generator (crg) section for more information. reset ?external reset pin an active low bidirectional control signal, it acts as an input to initialize the mcu to a known start-up state, and an output when an internal mcu function causes a reset. test ?test pin this input only pin is reserved for test. note: the test pin must be tied to vss in all applications. vregen voltage regulator enable pin this input only pin enables or disables the on-chip voltage regulator. xfc ?pll loop filter pin pll loop filter. please ask your motorola representative for the interactive application note to compute pll loop filter elements. any current leakage on this pin must be avoided. refer to the clocks and reset generator (crg) section for more information. bkgd / taghi / si / modc background debug, tag high, and mode pin the bkgd/ taghi/si/modc pin is used as a pseudo-open-drain pin for the background debug communication. in mcu expanded modes of operation when instruction tagging is on, an input low on this pin during the falling edge of e-clock tags the high half of the instruction word being read into the instruction queue. it is used as a mcu operating mode select pin during reset. the state of this pin is latched to the modc bit at the rising edge of reset. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 66 pinout and signal description motorola this pin has an weak on-chip active pullup that is enabled at all times. it is assumed that there is an external pullup and that drivers connected to bkgd do not typically drive the high level. note: the resistance of the internal pull-up may be too high depending on the speed and the load to ensure proper bdm communication. in this case an additional external pull-up resistor must be provided. spimode/sckbdm pin this pin is used as serial clock when fbdm is in spi mode. this pin has an weak on-chip active pull-down that is enabled at all times. fbdm will be in single wire mode as default. pulling this pin high will put fbdm in spi mode. so pin this pin is used as a serial out data pin when fbdm is in spi mode. during reset and immediately out of reset this pin will drive low. pad[7:0] / an0[7:0] ?port ad input pins [7:0] pad7-pad0 are general purpose input pins and analog inputs of the analog to digital converter. pa[7:0] / addr[15:8] / data[15:8] ?port a i/o pins pa7-pa0 are general purpose input or output pins. in mcu expanded modes of operation, these pins are used for the multiplexed external address and data bus. pb[7:0] / addr[7:0] / data[7:0] port b i/o pins pb7-pb0 are general purpose input or output pins. in mcu expanded modes of operation, these pins are used for the multiplexed external address and data bus. pe7 / noacc / xclks port e i/o pin 7 pe7 is a general purpose input or output pin. during mcu expanded modes of operation, the noacc signal, when enabled, is used to indicate that the current bus cycle is an unused or ?ree?cycle. this signal will assert when the cpu is not using the bus. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description signal descriptions mc9s12t64revision 1.1.1 motorola pinout and signal description 67 the xclks input controls whether a crystal in combination with the internal colpitts oscillator is used or whether pierce oscillator/external clock circuitry is used. the state of this pin is latched at the rising edge of reset. if the input is a logic low, pierce oscillator/external clock circuit is configured on the extal and xtal pins. if the input is a logic high, the colpitts oscillator circuit is configured on extal and xtal. since this pin is an input with a pull-up device, if the pin is left floating, the default configuration is the colpitts oscillator circuit on extal and xtal. pe6 / modb / ipipe1 port e i/o pin 6 pe6 is a general purpose input or output pin. it is used as a mcu operating mode select pin during reset. the state of this pin is latched to the modb bit at the rising edge of reset. this pin is shared with the instruction queue tracking signal ipipe1. this pin is an input with a pull-down device which is only active when reset is low. pe5 / moda / ipipe0 port e i/o pin 5 pe5 is a general purpose input or output pin. it is used as a mcu operating mode select pin during reset. the state of this pin is latched to the moda bit at the rising edge of reset. this pin is shared with the instruction queue tracking signal ipipe0. this pin is an input with a pull-down device which is only active when reset is low. pe4 / eclk port e i/o pin 4 pe4 is a general purpose input or output pin. it can be configured to drive the internal bus clock eclk. eclk can be used as a timing reference. pe3 / lstrb / taglo ?port e i/o pin 3 pe3 is a general purpose input or output pin. in mcu expanded modes of operation, lstrb can be used for the low-byte strobe function to indicate the type of bus access and when instruction tagging is on, taglo is used to tag the low half of the instruction word being read into the instruction queue. pe2 / r/ w port e i/o pin 2 pe2 is a general purpose input or output pin. in mcu expanded modes of operations, this pin drives the read/write output signal for the external bus. it indicates the direction of data on the external bus. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 68 pinout and signal description motorola pe1 / irq ?port e input pin 1 pe1 is a general purpose input pin and the maskable interrupt request input that provides a means of applying asynchronous interrupt requests. this will wake up the mcu from stop or wait mode. pe0 / xirq port e input pin 0 pe0 is a general purpose input pin and the non-maskable interrupt request input that provides a means of applying asynchronous interrupt requests. this will wake up the mcu from stop or wait mode. pk7 / ecs / romone ?port k i/o pin 7 pk7 is a general purpose input or output pin. during mcu expanded modes of operation, this pin is used as the emulation chip select output ( ecs). during mcu normal expanded and emulation modes of operation, this pin is used to enable the flash eeprom memory in the memory map (romone). at the rising edge of reset, the state of this pin determines the state of the romon bit (misc register) according to table 24 in page 129. see page 128 for details about the romon bit. pp7 / pwm7 port p i/o pin 7 pp7 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 7 output. pp6 / pwm6 port p i/o pin 6 pp6 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 6 output. pp5 / pwm5 port p i/o pin 5 pp5 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 5 output. pp4 / pwm4 port p i/o pin 4 pp4 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 4 output. pp3 / pwm3 port p i/o pin 3 pp3 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 3 output. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description signal descriptions mc9s12t64revision 1.1.1 motorola pinout and signal description 69 pp2 / pwm2 port p i/o pin 2 pp2 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 2 output. pp1 / pwm1 port p i/o pin 1 pp1 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 1 output. pp0 / pwm0 port p i/o pin 0 pp0 is a general purpose input or output pin. it can be configured as pulse width modulator (pwm) channel 0 output. ps7 / ss ?port s i/o pin 7 ps6 is a general purpose input or output pin. it can be configured as the slave select pin ss of the serial peripheral interface. ps6 / sck port s i/o pin 6 ps6 is a general purpose input or output pin. it can be configured as the serial clock pin sck of the serial peripheral interface. ps5 / mosi ?port s i/o pin 5 ps5 is a general purpose input or output pin. it can be configured as master output (during master mode) or slave input pin (during slave mode) mosi of the serial peripheral interface. ps4 / miso ?port s i/o pin 4 ps4 is a general purpose input or output pin. it can be configured as master input (during master mode) or slave output pin (during slave mode) mosi of the serial peripheral interface. ps3 / txd1 port s i/o pin 3 ps3 is a general purpose input or output pin. it can be configured as the transmit pin txd of serial communication interface 1 (sci1). ps2 / rxd1 ?port s i/o pin 2 ps2 is a general purpose input or output pin. it can be configured as the receive pin rxd of serial communication interface 1 (sci1). ps1 / txd0 port s i/o pin 1 ps1 is a general purpose input or output pin. it can be configured as the transmit pin txd of serial communication interface 0 (sci0). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 70 pinout and signal description motorola ps0 / rxd0 ?port s i/o pin 0 ps0 is a general purpose input or output pin. it can be configured as the receive pin rxd of serial communication interface 0 (sci0). pt[7:0] / ioc[7:0] ?port t i/o pins [7:0] pt7-pt0 are general purpose input or output pins. they can be configured as input capture or output compare pins ioc7-ioc0 of the enhanced capture timer (ect). table 13 mc9s12t64 signal description summary pin function pin name powered by pin number description ioc2 pt2 vddx 1 capture timer channel ioc3 pt3 vddx 2 ioc4 pt4 vddx 3 ioc5 pt5 vddx 4 ioc6 pt6 vddx 5 ioc7 pt7 vddx 6 modc/ t a ghi/bkgd / si bkgd vddx 7 pseudo_open_drain communication pin for the background debug mode. at the rising edge on reset, the state of this pin activates the bdm (when bkgd = 1). when instruction tagging is on, a 0 at the falling edge of e tags the high half of the instruction word being read into the instruction queue. spimode/sckbdm spimode vddx 8 serial clock pin when fbdm is in spi mode. so so vddx 9 serial out data pin when fbdm is in spi mode. vdd1 vdd1 10 2.5v core supply vss1 vss1 11 pwm0 pp0 vddx 12 pulse width modulator channel outputs pwm1 pp1 vddx 13 pwm2 pp2 vddx 14 pwm3 pp3 vddx 15 pwm4 pp4 vddx 16 pwm5 pp5 vddx 17 pwm6 pp6 vddx 18 pwm7 pp7 vddx 19 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description signal descriptions mc9s12t64revision 1.1.1 motorola pinout and signal description 71 addr0 / data0 pb0 vddr 20 external bus pins share function with general-purpose i/o port b. in single chip modes, the pins can be used for general-purpose i/o. in expanded modes, the pins are used for the external address and data buses. addr1 / data1 pb1 vddr 21 addr2 / data2 pb2 vddr 22 addr3 / data3 pb3 vddr 23 addr4 / data4 pb4 vddr 24 addr5 / data5 pb5 vddr 25 addr6 / data6 pb6 vddr 26 addr7 / data7 pb7 vddr 27 reset reset vddr 28 an active low bidirectional control signal, reset acts as an input to initialize the mcu to a known start-up state, and an output when cop or clock monitor or lvd causes a reset. extal extal vddpll 29 crystal driver and external clock input pins. on reset all the device clocks are derived from the extal input frequency. xtal is the crystal output. xtal xtal vddpll 30 vsspll 31 2.5v pll ground xfc vddpll 32 external pll filter capacitor vddpll 33 2.5v pll supply vddr vddr 34 5v voltage regulator and i/o supply vssr vssr 35 5v voltage regulator and i/o ground ecs/romone pk7 vddr 36 emulation chip select/romone pin shares function with general-purpose i/o port. xirq pe0 vddr 37 the xirq input provides a means of requesting a nonmaskable interrupt after reset initialization. because it is level sensitive, it can be connected to a multiple-source wired-or network. irq pe1 vddr 38 maskable interrupt request input provides a means of applying asynchronous interrupt requests to the mcu. either falling edge-sensitive triggering or level-sensitive triggering is program selectable (irqcr register). r/ w pe2 vddr 39 indicates direction of data on expansion bus. shares function with general-purpose i/o. read/write in expanded modes. lstrb / t a glo pe3 vddr 40 low byte strobe (0 = low byte valid), in all modes this pin can be used as i/o. pin function t a glo used in instruction low byte tagging. eclk pe4 vddr 41 e clock is the output connection for the external bus clock. eclk is used as a timing reference and for address demultiplexing. table 13 mc9s12t64 signal description summary (continued) pin function pin name powered by pin number description f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 72 pinout and signal description motorola moda / ipipe0 pe5 vddr 42 state of mode select pins during reset determine the initial operating mode of the mcu. after reset, modb and moda can be con?ured as instruction queue tracking signals ipipe1 and ipipe0 or as general-purpose i/o pins. modb / ipipe1 pe6 vddr 43 noacc / xclks pe7 vddr 44 no access. indicates free cycles in expanded mode. selects also colpitts oscillator or pierce oscillator/external clock during reset. can be used as general purpose i/o pin. addr8 / data8 / data 0 pa0 vddr 45 external bus pins share function with general-purpose i/o ports a. in single chip modes, the pins can be used for general-purpose i/o. in expanded modes, the pins are used for the external buses. addr9 / data9 / data 1 pa1 vddr 46 addr10 / data10 / data 2 pa2 vddr 47 addr11 / data11 / data 3 pa3 vddr 48 addr12 / data12 / data 4 pa4 vddr 49 vdd2 vdd2 50 2.5v core supply vss2 vss2 51 addr13 / data13 / data 5 pa5 vddr 52 external bus pins share function with general-purpose i/o ports a. in single chip modes, the pins can be used for general-purpose i/o. in expanded modes, the pins are used for the external buses. addr14 / data14 / data 6 pa6 vddr 53 addr15 / data15 / data 7 pa7 vddr 54 vdda 55 5.0v supply analog to digital converter vrh vdda 56 analog to digital converter reference high vrl vdda 57 analog to digital converter reference low vssa 58 ground analog to digital converter an0 pad0 vdda 59 a/d converter channel 0 an1 pad1 vdda 60 a/d converter channel 1 an2 pad2 vdda 61 a/d converter channel 2 an3 pad3 vdda 62 a/d converter channel 3 an4 pad4 vdda 63 a/d converter channel 4 an5 pad5 vdda 64 a/d converter channel 5 an6 pad6 vdda 65 a/d converter channel 6 table 13 mc9s12t64 signal description summary (continued) pin function pin name powered by pin number description f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description signal descriptions mc9s12t64revision 1.1.1 motorola pinout and signal description 73 an7 / etrig pad7 vdda 66 a/d converter channel 7, or an external trigger for the atd conversion rxd0 ps0 vddx 67 sci0 receive pin txd0 ps1 vddx 68 sci0 transmit pin rxd1 ps2 vddx 69 sci1 receive pin txd1 ps3 vddx 70 sci1 transmit pin miso ps4 vddx 71 master in/slave out pin for serial peripheral interface mosi ps5 vddx 72 master out/slave in pin for serial peripheral interface sck ps6 vddx 73 serial clock for serial peripheral interface system ss ps7 vddx 74 slave select output for spi master mode, input for slave mode or master mode. vregen vregen vddx 75 internal voltage regulator enable vssx vssx 76 5v i/o supply and ground vddx vddx 77 test_vpp test vddx 78 con?ures the device for various test modes including scan testing. also the programming voltage input for nvms during factory test. this pin must be tied to ground in all applications. ioc0 pt0 vddx 79 capture timer channel ioc1 pt1 vddx 80 table 13 mc9s12t64 signal description summary (continued) pin function pin name powered by pin number description f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 74 pinout and signal description motorola port signals the mc9s12t64 incorporates seven ports which are used to control and access the various device subsystems. when not used for these purposes, port pins may be used for general-purpose i/o. in addition to the pins described below, each port consists of a data register which can be read and written at any time, and, with the exception of port ad and pe[1:0], a data direction register which controls the direction of each pin. after reset all general purpose i/o pins are configured as input. port a port a bits 7 through 0 are associated with address lines a15 through a8 respectively and data lines d15/d7 through d8/d0 respectively. when this port is not used for external addresses such as in single-chip mode, these pins can be used as general purpose i/o. data direction register a (ddra) determines the primary direction of each pin. ddra also determines the source of data for a read of porta. register ddra determines whether each port a pin is an input or output. ddra is not in the address map during expanded and peripheral mode operation. setting a bit in ddra makes the corresponding bit in port a an output; clearing a bit in ddra makes the corresponding bit in port a an input. the default reset state of ddra is all zeroes. this register is not in the on-chip map in expanded and peripheral modes. port b port b bits 7 through 0 are associated with address lines a7 through a0 respectively and data lines d7 through d0 respectively. when this port is not used for external addresses, such as in single-chip mode, these pins can be used as general purpose i/o. data direction register b (ddrb) determines the primary direction of each pin. ddrb also determines the source of data for a read of portb. register ddrb determines whether each port b pin is an input or output. ddrb is not in the address map during expanded and peripheral mode operation. setting a bit in ddrb makes the corresponding bit in port b f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description port signals mc9s12t64revision 1.1.1 motorola pinout and signal description 75 an output; clearing a bit in ddrb makes the corresponding bit in port b an input. the default reset state of ddrb is all zeroes. this register is not in the on-chip map in expanded and peripheral modes. port e port e is associated with external bus control signals and interrupt inputs. these include mode select (pe7/noacc/ xclks, pe6/modb/ipipe1, pe5/moda/ipipe0), e clock, size ( lstrb/ taglo), read / write (r/ w), irq, and xirq. when the associated pin is not used for one of these specific functions, the pin can be used as general purpose i/o with the exception of irq and xirq. the port e assignment register (pear) selects the function of each pin and ddre determines whether each pin is an input or output when it is configured to be general purpose i/o. ddre also determines the source of data for a read of porte. the xclks input selects between colpitts oscillator or pierce oscillator/an external clock configuration. some of these pins have software selectable pullups (noacc, eclk, lstrb, r/ w, irq and xirq). a single control bit enables the pullups for all of these pins when they are configured as inputs. this register is not in the on-chip map in peripheral mode or in expanded modes when the eme bit is set. port k this port is associated with the internal memory emulation pin. when the port is not enabled to emulate the internal memory, the port pin is used as general-purpose i/o. when input, this pin can be selected to be high impedance or pulled up, based upon the state of the pupke bit in the pucr register. register ddrk determines whether port k pin is an input or output when configured as general-purpose i/o. ddrk is not in the address map during expanded and peripheral mode operation with emk set. setting a bit in ddrk makes the corresponding bit in port k an output; clearing f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 76 pinout and signal description motorola a bit in ddrk makes the corresponding bit in port k an input. the default reset state of ddrk is all zeroes. this register is not in the map in peripheral mode or in expanded modes while the emk bit in the mode register is set. note: the ports a, b, e, k, p, s, t can be configured in a very flexible way. for a full and detailed overview refer to section port integration module (pim) . ad port this port is an analog input interface to the analog-to-digital subsystem. the digital function of the ports must explicitly be enabled on per pin basis using a control register in the adc module. when the port data registers are read, they contain the digital levels appearing on the input pins at the time of the read. input pins with signal potentials not meeting v il or v ih specifications will have an indeterminate value. use of any ad port pin except etrig for digital input does not preclude the use of any other port pin for analog input. note that the digital/analog multiplexing function is performed in the input pad. the port registers are connected to the input pads through tristate buffers. these buffers are only activated when the port is configured as digital pin so that analog signal potentials on the input pins will not cause the buffers to draw excess supply current. port s for sci0, sci1 and spi there are two identical sci ports. each sci module uses two external pins. the rxd0, rxd1 and txd0, txd1pins share general purpose port sci p[3:0]. txd0, txd1 are available for general-purpose i/o when it is not configured for transmitter operation. rxd0, rxd1 are available for general-purpose i/o when it is not configured for receiver operation. the spi module uses four external pins. ss, sck, mosi, and miso pins share general purpose port ps[7:4]. port t for timer port the timer module has eight external pins: pt[7:0]_ioc[7:0], for input capture and output compare functions. two of the pins are also the pulse f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description port signals mc9s12t64revision 1.1.1 motorola pinout and signal description 77 accumulator inputs. all eight pins are available for general-purpose i/o when not configured for timer functions. port p for pwm the pwm module has a total of 8 external pins on which the pulse width modulated waveforms are output. the 8 pwm outputs are multiplexed on the pp[7:0] pins. . port pull-up pull-down and reduced drive mcu ports can be configured for internal pull-up. to reduce power consumption and rfi, the pin output drivers can be configured to operate at a reduced drive level. reduced drive causes a slight increase in transition time depending on loading and should be used only for ports which have a light loading. table 15 summarizes the port pull-up default status and controls. table 14 mc9s12t64 port a, b, e, k, t, s, p description summary port name data direction register description pe[7:0] pe[1:0] in pe[7:2] in/out ddre mode selection, bus control signals and interrupt service request signals; or general-purpose i/o. pb[7:0] in/out ddrb port a and port b pins are used for address and data in expanded modes. the port data registers are not in the address map during expanded and peripheral mode operation. when in the map, port a and port b can be read or written any time. ddra and ddrb are not in the address map in expanded or peripheral modes. pa[7:0] in/out ddra pk7 in/out ddrk emulation chip select signal or general-purpose i/o. pt[7:0] in/out ddrt enhanced capture timer signals; or general-purpose i/o. ps[7:0] in/out ddrs spi and sci signals; or general-purpose i/o. pp[7:0] in/out ddrp pwm signals; or general-purpose i/o. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pinout and signal description mc9s12t64revision 1.1.1 78 pinout and signal description motorola table 15 port a, b, e, k, ad pull-up, pull-down and reduced drive summary port name resistive input loads enable bit reduced drive control bit register (address) bit name reset state register (address) bit name reset state port a pull-up pucr ($000c) pupa disabled rdriv ($000d) rdpa full drive port b pull-up pucr ($000c) pupb disabled rdriv ($000d) rdpb full drive port e: pe7, pe[4:0] pull-up pucr ($000c) pupe enabled rdriv ($000d) rdpe full drive pe[6:5] pull-down (1) enabled rdriv ($000d) rdpe full drive port k7 pull-up pucr ($000c) pupke enabled rdriv ($000d) rdpk full drive port ad[7:0] none 1. pull-down is only active when reset is low. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola system configuration 79 system configuration contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 modules variabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 mcu variabilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 system clock description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 introduction this section describes the variabilities of the modules that are present at the mcu level and how they are connected. modules variabilities mmc the information is also readable by the mcu at address $1c, $1d (memsiz0 and memsiz1) table 16 mmc module variable i/o signals signal name i/o configuration description connected to reg_sw0 i register block size set to 1k bytes 0 ram_sw2:0 i ram memory size set to 2k bytes 000 eep_sw1:0 i calram size set to 2k bytes 01 rom_sw1:0 i rom mapping select set to 64k bytes 11 pag_sw1:0 i 64k bytes on-chip / 0k bytes off-chip space 11 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system con?uration mc9s12t64revision 1.1.1 80 system configuration motorola mcu variabilities part id register assignments the partid register is located in the ipbi (ip-bus interface) at address $__1a,$__1b. it contains a unique part id for each revision of the chip. table 17 contains the assigned part id numbers. part id register this register is used to designate the part id. each revision of the chip will have a unique value in the contents of this register read anytime. write never. . table 17 assigned part id numbers part number mask set number partid (1) 1. the coding is as follows: bit 15-12: major family identifier bit 11-8: minor family identifier bit 7-4: major mask revision number including fab transfers bit 3-0: minor - non full - mask set revisions (motorola use only for production control. this field may be changed. user program should not refer this field as an identification number.) mc9s12t64 l42m $422x partidh ?part id register high address offset: $001a (1) bit 7 6 5 4 3 2 1 bit 0 read: id15 id14 id13 id12 id11 id10 id9 id8 write: reset: refer to ta b l e 1 7 = unimplemented 1. register address = base address (initrg) + address offset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system configuration system clock description mc9s12t64revision 1.1.1 motorola system configuration 81 system clock description the clock and reset generator provides the internal clock signals for the core and all peripheral modules. figure 13 shows the clock connections from the crg to all modules. the gating condition placed on top of the individual clock gates indicates the dependencies of different modes (stop, wait) and the setting of the respective configuration bits. for example, a wait(syswai) gating condition states that when the syswai bit is set, the correspondent gate will be disabled during wait mode. consult the crg section in page 271 for details on clock generation and clock enabling conditions. table 18 summarizes the enabling conditions of specific modules according to the mcu mode of operation. all modules listed in table 18 cease operation when the mcu enters stop mode. partidl ?part id register high address offset: $001b (1) bit 7 6 5 4 3 2 1 bit 0 read: id7 id6 id5 id4 id3 (2) id2 (2) id1 (2) id0 (2) write: reset: refer to ta b l e 1 7 = unimplemented 1. register address = base address (initrg) + address offset 2. motorola use only for production control. this field may be changed. user program should not refer to this field as an iden- tification number. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system con?uration mc9s12t64revision 1.1.1 82 system configuration motorola figure 13 clock connections crg bus clock core clock oscillator clock s12_core lvd ram sci0, sci1 pwm atd calram flash ect spi fbdm pim wait(cwai,syswai), stop wait(syswai), wait(syswai), stop stop = clock gate gate condition 1/2 xtal extal f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system configuration system clock description mc9s12t64revision 1.1.1 motorola system configuration 83 table 18 module availability in wait and run modes module name wait mode (1) (disable bit) run mode (enable bit) hcs12 core always enabled always enabled flash always enabled always enabled calram always enabled always enabled sram always enabled always enabled pim always enabled always enabled pwm pswai (pwmctl register) always enabled (2) ect tswait (tscr1 register) always enabled at d awai (atdctl2 register) always enabled (2) spi spiswai (spicr2 register) spe (spicr1 register) lvd disabled lvde (lvdcr register) sci0, sci1 sciswai (scixcr1 register) always enabled 1. assuming all system clocks are running during wait mode (syswai=0 in clksel reg- ister - see page 284 ) 2. low power options available. see the correspondent module section for details f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
system con?uration mc9s12t64revision 1.1.1 84 system configuration motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola registers 85 registers contents register block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 general purpose registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 register block the register block can be mapped to any 2k byte boundary within the first 32k byte of the standard 64k byte address space by manipulating bits reg[14:11] in the initrg register. initrg establishes the upper five bits of the register block? 16-bit address. the register block occupies 1k byte. default addressing (after reset) is indicated in the table below. non-user registers non-user registers are divided in three categories: reserved, unimplemented and reserved for factory test. a detailed description follows below; reserved registers reserved registers return logic zero when read. writes to these registers have no effect. unimplemented registers unimplemented registers return unpredictable values when read. writes to these registers have no effect. reserved for factory test registers reserved for factory test registers return unpredictable values when read. writes to these registers have no effect in normal modes. writing to these registers in special modes might result in unpredictable mcu behavior. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 86 registers motorola table 19 mc9s12t64 register map addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e $0000 porta read: bit 7 6 5 4 3 2 1 bit 0 mebi write: $0001 portb read: bit 7 6 5 4 3 2 1 bit 0 write: $0002 ddra read: bit 7 6 5 4 3 2 1 bit 0 write: $0003 ddrb read: bit 7 6 5 4 3 2 1 bit 0 write: $0004 reserved read: 0 0 0 0 0 0 0 0 write: $0005 reserved read: 0 0 0 0 0 0 0 0 write: $0006 reserved read: 0 0 0 0 0 0 0 0 write: $0007 reserved read: 0 0 0 0 0 0 0 0 write: $0008 porte read: bit 7 6 5 4 3 2 bit 1 bit 0 write: $0009 ddre read: bit 7 6 5 4 3 bit 2 00 write: $000a pear read: noacce 0 pipoe neclk lstre rdwe 00 write: $000b mode read: modc modb moda 0 ivis 0 emk eme write: $000c pucr read: pupke 00 pupee 00 pupbe pupae write: $000d rdriv read: rdpk 00 rdpe 00 rdpb rdpa write: $000e ebictl read: 0 0 0 0 0 0 0 estr write: $000f reserved read: 0 0 0 0 0 0 0 0 write: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 87 $0010 initrm read: ram15 ram14 ram13 ram12 ram11 00 ramhal mmc write: $0011 initrg read: 0 reg14 reg13 reg12 reg11 000 write: $0012 initcrm read: cram15 cram14 cram13 cram12 cram11 00 cramon write: $0013 misc read: 0 0 0 0 exstr1 exstr0 romhm romon write: $0014 reserved for factory test read: reads to this register return unpredictable values. write: $0015 reserved for factory test read: reads to this register return unpredictable values. write: $0016 reserved for factory test read: reads to this register return unpredictable values. write: $0017 reserved for factory test read: reads to this register return unpredictable values. write: $0018 reserved read: 0 0 0 0 0 0 0 0 peripheral write: $0019 reserved read: 0 0 0 0 0 0 0 0 write: $001a partidh read: id15 id14 id13 id12 id11 id10 id9 id8 write: $001b partidl read: id7 id6 id5 id4 id3 id2 id1 id0 write: $001c memsiz0 read: reg_sw0 0 eep_sw1 eep_sw0 0 ram_sw2 ram_sw1 ram_sw0 mmc write: $001d memsiz1 read: rom_sw1 rom_sw0 0 0 0 0 pag_sw1 pag_sw0 write: $001e irqcr read: irqe irqen 000000 mebi write: $001f hprio read: psel7 psel6 psel5 psel4 psel3 psel2 psel1 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 88 registers motorola $0020 gpr0 read: bit 7 6 5 4 3 2 1 0 general purpose registers write: $0021 gpr1 read: bit 7 6 5 4 3 2 1 0 write: $0022 gpr2 read: bit 7 6 5 4 3 2 1 0 write: $0023 gpr3 read: bit 7 6 5 4 3 2 1 0 write: $0024 gpr4 read: bit 7 6 5 4 3 2 1 0 write: $0025 gpr5 read: bit 7 6 5 4 3 2 1 0 write: $0026 gpr6 read: bit 7 6 5 4 3 2 1 0 write: $0027 gpr7 read bit 7 6 5 4 3 2 1 0 write: $0028 bkpct0 read: bken bkfull bkbdm bktag 0000 bkp write: $0029 bkpct1 read: bk0mbh bk0mbl bk1mbh bk1mbl bk0rwe bk0rw bk1rwe bk1rw write: $002a bkp0x read: 0 0 bk0v5 bk0v4 bk0v3 bk0v2 bk0v1 bk0v0 write: $002b bkp0h read: bit 15 14 13 12 11 10 9 bit 8 write: $002c bkp0l read: bit 7 6 5 4 3 2 1 bit 0 write: $002d bkp1x read: 0 0 bk1v5 bk1v4 bk1v3 bk1v2 bk1v1 bk1v0 write: $002e bkp1h read: bit 15 14 13 12 11 10 9 bit 8 write: $002f bkp1l read: bit 7 6 5 4 3 2 1 bit 0 write: $0030 ppage read: 0 0 pix5 pix4 pix3 pix2 pix1 pix0 mmc write: $0031 reserved read: 0 0 0 0 0 0 0 0 write: $0032 portk read: bit 7 6 5 4 3 2 1 bit 0 mebi write: $0033 ddrk read: bit 7 6 5 4 3 2 1 bit 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 89 $0034 synr read: 0 0 syn5 syn4 syn3 syn2 syn1 syn0 crg write: $0035 refdv read: 0 0 0 0 refdv3 refdv2 refdv1 refdv0 write: $0036 reserved for factory test read: reads to this register return unpredictable values. write: $0037 crgflg read: rtif porlvd rf 0 lockif lock track scmif scm write: $0038 crgint read: rtie 00 lockie 00 scmie 0 write: $0039 clksel read: pllsel pstp syswai roawai pllwai cwai rtiwai copwai write: $003a pllctl read: cme pllon auto acq 0 pre pce scme write: $003b rtictl read: 0 rtr6 rtr5 rtr4 rtr3 rtr2 rtr1 rtr0 write: $003c copctl read: wcop rsbck 000 cr2 cr1 cr0 write: $003d reserved for factory test read: reads to this register return unpredictable values. write: $003e reserved for factory test read: reads to this register return unpredictable values. write: $003f armcop read: 0 0 0 0 0 0 0 0 write: bit 7 6 5 4 3 2 1 bit 0 table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 90 registers motorola $0040 tios read: ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 enhanced capture timer write: $0041 cforc read: 0 0 0 0 0 0 0 0 write: foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 $0042 oc7m read: oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 write: $0043 oc7d read: oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 write: $0044 tcnt (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0045 tcnt (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0046 tscr1 read: ten tswai tsfrz tffca 0000 write: $0047 ttov read: tov7 tov6 tov5 tov4 tov3 tov2 tov1 tov0 write: $0048 tctl1 read: om7 ol7 om6 ol6 om5 ol5 om4 ol4 write: $0049 tctl2 read: om3 ol3 om2 ol2 om1 ol1 om0 ol0 write: $004a tctl3 read: edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a write: $004b tctl4 read: edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a write: $004c tie read: c7i c6i c5i c4i c3i c2i c1i c0i write: $004d tscr2 read: toi 000 tcre pr2 pr1 pr0 write: $004e tflg1 read: c7f c6f c5f c4f c3f c2f c1f c0f write: $004f tflg2 read: tof 0000000 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 91 $0050 tc0 (hi) read: bit 15 14 13 12 11 10 9 bit 8 enhanced capture timer write: $0051 tc0 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0052 tc1 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0053 tc1 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0054 tc2 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0055 tc2 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0056 tc3 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0057 tc3 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0058 tc4 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0059 tc4 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $005a tc5 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $005b tc5 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $005c tc6 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $005d tc6 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $005e tc7 (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $005f tc7 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 92 registers motorola $0060 pactl read: 0 paen pamod pedge clk1 clk0 paovi pai enhanced capture timer write: $0061 paflg read: 0 0 0 0 0 0 paovf paif write: $0062 pacn3 (hi) read: bit 7 6 5 4 3 2 1 bit 0 write: $0063 pacn2 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0064 pacn1 (hi) read: bit 7 6 5 4 3 2 1 bit 0 write: $0065 pacn0 (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0066 mcctl read: mczi modmc rdmcl 00 mcen mcpr1 mcpr0 write: iclat flmc $0067 mcflg read: mczf 0 0 0 polf3 polf2 polf1 polf0 write: $0068 icpar read: 0 0 0 0 pa3en pa2en pa1en pa0en write: $0069 dlyct read: 0 0 0 0 0 0 dly1 dly0 write: $006a icovw read: novw7 novw6 novw5 novw4 novw3 novw2 novw1 novw0 write: $006b icsys read: sh37 sh26 sh15 sh04 tfmod pacmx bufen latq write: $006c reserved read: 0 0 0 0 0 0 0 0 write: $006d reserved for factory test read: reads to this register return unpredictable values. write: $006e reserved read: 0 0 0 0 0 0 0 0 write: $006f reserved read: 0 0 0 0 0 0 0 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 93 $0070 pbctl read: 0 pben 0000 pbovi 0 enhanced capture timer write: $0071 pbflg read: 0 0 0 0 0 0 pbovf 0 write: $0072 pa3h read: bit 7 6 5 4 3 2 1 bit 0 write: $0073 pa2h read: bit 7 6 5 4 3 2 1 bit 0 write: $0074 pa1h read: bit 7 6 5 4 3 2 1 bit 0 write: $0075 pa0h read: bit 7 6 5 4 3 2 1 bit 0 write: $0076 mccnt (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0077 mccnt (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $0078 tc0h (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $0079 tc0h (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $007a tc1h (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $007b tc1h (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $007c tc2h (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $007d tc2h (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: $007e tc3h (hi) read: bit 15 14 13 12 11 10 9 bit 8 write: $007f tc3h (lo) read: bit 7 6 5 4 3 2 1 bit 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 94 registers motorola $0080 reserved for factory test read: reads to this register return unpredictable values. atd write: $081 reserved for factory test read: reads to this register return unpredictable values. write: $082 atdctl2 read: adpu affc awai etrigle etrigp etrige ascie ascif write: $0083 atdctl3 read: 0 s8c s4c s2c s1c fifo frz1 frz0 write: $0084 atdctl4 read: sres8 smp1 smp0 prs4 prs3 prs2 prs1 prs0 write: $0085 atdctl5 read: djm dsgn scan mult 0 cc cb ca write: $0086 atdstat0 read: scf 0 etorf fifor 0 cc2 cc1 cc0 write: $0087 unimplemented read: reads to this register return unpredictable values. write: $0088 reserved for factory test read: reads to this register return unpredictable values. write: $0089 atdtest1 read: reads to these bits return unpredictable values. sc write: $008a unimplemented read: reads to this register return unpredictable values. write: $008b atdstat1 read: ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 write: $008c unimplemented read: reads to this register return unpredictable values. write: $008d atddien read: ien7 ien6 ien5 ien4 ien3 ien2 ien1 ien0 write: $008e unimplemented read: reads to this register return unpredictable values. write: $008f portad read: ptad7 ptad6 ptad5 ptad4 ptad3 ptad2 ptad1 ptad0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 95 $0090 atddr0h read: bit15 14 13 12 11 10 9 bit8 atd write: $0091 atddr0l read: bit7 bit6 0 0 0 0 0 0 write: $0092 atddr1h read: bit15 14 13 12 11 10 9 bit8 write: $0093 atddr1l read: bit7 bit6 0 0 0 0 0 0 write: $0094 atddr2h read: bit15 14 13 12 11 10 9 bit8 write: $0095 atddr2l read: bit7 bit6 0 0 0 0 0 0 write: $0096 atddr3h read: bit15 14 13 12 11 10 9 bit8 write: $0097 atddr3l read: bit7 bit6 0 0 0 0 0 0 write: $0098 atddr4h read: bit15 14 13 12 11 10 9 bit8 write: $0099 atddr4l read: bit7 bit6 0 0 0 0 0 0 write: $009a atddr5h read: bit15 14 13 12 11 10 9 bit8 write: $009b atddr5l read: bit7 bit6 0 0 0 0 0 0 write: $009c atddr6h read: bit15 14 13 12 11 10 9 bit8 write: $009d atddr6l read: bit7 bit6 0 0 0 0 0 0 write: $009e atddr7h read: bit15 14 13 12 11 10 9 bit8 write: $009f atddr7l read: bit7 bit6 0 0 0 0 0 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 96 registers motorola $00a0 pwme read: pwme7 pwme6 pwme5 pwme4 pwme3 pwme2 pwme1 pwme0 pwm write: $00a1 pwmpol read: ppol7 ppol6 ppol5 ppol4 ppol3 ppol2 ppol1 ppol0 write: $00a2 pwmclk read: pclk7 pclkl6 pclk5 pclk4 pclk3 pclk2 pclk1 pclk0 write: $00a3 pwmprclk read: 0 pckb2 pckb1 pckb0 0 pcka2 pcka1 pcka0 write: $00a4 pwmcae read: cae7 cae6 cae5 cae4 cae3 cae2 cae1 cae0 write: $00a5 pwmctl read: con67 con45 con23 con01 pswai pfrz 0 0 write: $00a6 reserved for factory test read: reads to this register return unpredictable values. write: $00a7 reserved for factory test read: reads to this register return unpredictable values. write: $00a8 pwmscla read: bit 7 6 5 4 3 2 1 bit 0 write: $00a9 pwmsclb read: bit 7 6 5 4 3 2 1 bit 0 write: $00aa reserved for factory test read: reads to this register return unpredictable values. write: $00ab reserved for factory test read: reads to this register return unpredictable values. write: $00ac pwmcnt0 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00ad pwmcnt1 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00ae pwmcnt2 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00af pwmcnt3 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 97 $00b0 pwmcnt4 read: bit 7 6 5 4 3 2 1 bit 0 pwm write: 0 0 0 0 0 0 0 0 $00b1 pwmcnt5 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00b2 pwmcnt6 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00b3 pwmcnt7 read: bit 7 6 5 4 3 2 1 bit 0 write: 0 0 0 0 0 0 0 0 $00b4 pwmper0 read: bit 7 6 5 4 3 2 1 bit 0 write: $00b5 pwmper1 read: bit 7 6 5 4 3 2 1 bit 0 write: $00b6 pwmper2 read: bit 7 6 5 4 3 2 1 bit 0 write: $00b7 pwmper3 read: bit 7 6 5 4 3 2 1 bit 0 write: $00b8 pwmper4 read: bit 7 6 5 4 3 2 1 bit 0 write: $00b9 pwmper5 read: bit 7 6 5 4 3 2 1 bit 0 write: $00ba pwmper6 read: bit 7 6 5 4 3 2 1 bit 0 write: $00bb pwmper7 read: bit 7 6 5 4 3 2 1 bit 0 write: $00bc pwmdty0 read: bit 7 6 5 4 3 2 1 bit 0 write: $00bd pwmdty1 read: bit 7 6 5 4 3 2 1 bit 0 write: $00be pwmdty2 read: bit 7 6 5 4 3 2 1 bit 0 write: $00bf pwmdty3 read: bit 7 6 5 4 3 2 1 bit 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 98 registers motorola $00c0 pwmdty4 read: bit 7 6 5 4 3 2 1 bit 0 pwm write: $00c1 pwmdty5 read: bit 7 6 5 4 3 2 1 bit 0 write: $00c2 pwmdty6 read: bit 7 6 5 4 3 2 1 bit 0 write: $00c3 pwmdty7 read: bit 7 6 5 4 3 2 1 bit 0 write: $00c4 pwmsdn read: pwmif pwmie 0 pwmlvl 0 pwm7in pwm7in l pwm7en a write: pwmrst rt $00c5 reserved read: 0 0 0 0 0 0 0 0 write: $00c6 reserved read: 0 0 0 0 0 0 0 0 write: $00c7 reserved read: 0 0 0 0 0 0 0 0 write: $00c8 sci0bdh read: 0 0 0 sbr12 sbr11 sbr10 sbr9 sbr8 sci0 write: $00c9 sci0bdl read: sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 write: $00ca sci0cr1 read: loops sciswai rsrc m wake ilt pe pt write: $00cb sci0cr2 read: tie tcie rie ilie te re rwu sbk write: $00cc sci0sr1 read: tdre tc rdrf idle or nf fe pf write: $00cd sci0sr2 read: 0 0 0 0 0 brk13 txdir raf write: $00ce sci0drh read: r8 t8 000000 write: $00cf sci0drl read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 99 $00d0 sci1bdh read: 0 0 0 sbr12 sbr11 sbr10 sbr9 sbr8 sci1 write: $00d1 sci1bdl read: sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 write: $00d2 sci1cr1 read: loops sciswai rsrc m wake ilt pe pt write: $00d3 sci1cr2 read: tie tcie rie ilie te re rwu sbk write: $00d4 sci1sr1 read: tdre tc rdrf idle or nf fe pf write: $00d5 sci1sr2 read: 0 0 0 0 0 brk13 txdir raf write: $00d6 sci1drh read: r8 t8 000000 write: $00d7 sci1drl read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 $00d8 spicr1 read: spie spe sptie mstr cpol cpha ssoe lsbfe spi write: $00d9 spicr2 read: 0 0 0 modfen bidiroe 0 spiswai spc0 write: $00da spibr read: 0 sppr2 sppr1 sppr0 0 spr2 spr1 spr0 write: $00db spisr read: spif 0 sptef modf 0 0 0 0 write: $00dc reserved read: 0 0 0 0 0 0 0 0 write: $00dd spidr read: bit7 6 5 4 3 2 1 bit0 write: $00de reserved read: 0 0 0 0 0 0 0 0 write: $00df reserved read: 0 0 0 0 0 0 0 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 100 registers motorola $00e0 ptt read: ptt7 ptt6 ptt5 ptt4 ptt3 ptt2 ptt1 ptt0 port t write: $00e1 ptit read: ptit7 ptit6 ptit5 ptit4 ptit3 ptit2 ptit1 ptit0 write: $00e2 ddrt read: ddrt7 ddrt7 ddrt5 ddrt4 ddrt3 ddrt2 ddrt1 ddrt0 write: $00e3 rdrt read: rdrt7 rdrt6 rdrt5 rdrt4 rdrt3 rdrt2 rdrt1 rdrt0 write: $00e4 pert read: pert7 pert6 pert5 pert4 pert3 pert2 pert1 pert0 write: $00e5 ppst read: ppst7 ppst6 ppst5 ppst4 ppst3 ppst2 ppst1 ppst0 write: $00e6 reserved read: 0 0 0 0 0 0 0 0 write: $00e7 reserved read: 0 0 0 0 0 0 0 0 write: $00e8 pts read: pts7 pts6 pts5 pts4 pts3 pts2 pts1 pts0 port s write: $00e9 ptis read: ptis7 ptis6 ptis5 ptis4 ptis3 ptis2 ptis1 ptis0 write: $00ea ddrs read: ddrs7 ddrs7 ddrs5 ddrs4 ddrs3 ddrs2 ddrs1 ddrs0 write: $00eb rdrs read: rdrs7 rdrs6 rdrs5 rdrs4 rdrs3 rdrs2 rdrs1 rdrs0 write: $00ec pers read: pers7 pers6 pers5 pers4 pers3 pers2 pers1 pers0 write: $00ed ppss read: ppss7 ppss6 ppss5 ppss4 ppss3 ppss2 ppss1 ppss0 write: $00ee woms read: woms7 woms6 woms5 woms4 woms3 woms2 woms1 woms0 write: $00ef reserved read: 0 0 0 0 0 0 0 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers register block mc9s12t64revision 1.1.1 motorola registers 101 $00f0 ptp read: ptp7 ptp6 ptp5 ptp4 ptp3 ptp2 ptp1 ptp0 port p write: $00f1 ptip read: ptip7 ptip6 ptip5 ptip4 ptip3 ptip2 ptip1 ptip0 write: $00f2 ddrp read: ddrp7 ddrp7 ddrp5 ddrp4 ddrp3 ddrp2 ddrp1 ddrp0 write: $00f3 rdrp read: rdrp7 rdrp6 rdrp5 rdrp4 rdrp3 rdrp2 rdrp1 rdrp0 write: $00f4 perp read: perp7 perp6 perp5 perp4 perp3 perp2 perp1 perp0 write: $00f5 ppsp read: ppsp7 ppsp6 ppsp5 ppsp4 ppsp3 ppsp2 ppsp1 ppss0 write: $00f6 reserved read: 0 0 0 0 0 0 0 0 write: $00f7 reserved read: 0 0 0 0 0 0 0 0 write: $00f8 lvdcr read: lvde lvdre 000000 lvd write: $00f9 reserved read: 0 0 0 0 0 0 0 0 write: $00fa lvdsr read: lvdf 0000000 write: $00fb reserved read: 0 0 0 0 0 0 0 0 write: $00fc calcfg read: fsum 0000000 calram write: $00fd reserved read: 0 0 0 0 0 0 0 0 write: $00fe reserved read: 0 0 0 0 0 0 0 0 write: $00ff reserved read: 0 0 0 0 0 0 0 0 write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 102 registers motorola $0100 fclkdiv read: fdivld prdiv8 fdiv5 fdiv4 fdiv3 fdiv2 fdiv1 fdiv0 flash control write: $0101 fsec read: keyen nv6 nv5 nv4 nv3 nv2 sec1 sec0 write: $0102 ftstmod read: reads to this register return unpredictable values in normal modes. write: $0103 fcnfg read: cbeie ccie keyacc 0000 bksel0 write: $0104 fprot read: fpopen nv6 fphdis fphs1 fphs0 fpldis fpls1 fpls0 write: $0105 fstat read: cbeif ccif pviol accerr 0 blank 0 0 write: $0106 fcmd read: 0 cmdb6 cmdb5 00 cmdb2 0 cmdb0 write: $0107 reserved for factory test read: reads to this register return unpredictable values. write: $0108 faddrhi read: 0 ab15 ab14 ab13 ab12 ab11 ab10 ab9 write: $0109 faddrlo read: ab8 ab7 ab6 ab5 ab4 ab3 ab2 ab1 write: $010a fdatahi read: d15 d14 d13 d12 d11 d10 d9 d8 write: $010b fdatalo read: d7 d6 d5 d4 d3 d2 d1 d0 write: $010c reserved read: 0 0 0 0 0 0 0 0 write: $010d reserved read: 0 0 0 0 0 0 0 0 write: $010e reserved read: 0 0 0 0 0 0 0 0 write: $010f reserved read: 0 0 0 0 0 0 0 0 write: $0110 - $03ff unimplemented read: reads to this register return unpredictable values. write: table 19 mc9s12t64 register map (continued) addre ss name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 modul e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers general purpose registers mc9s12t64revision 1.1.1 motorola registers 103 general purpose registers general purpose registers (gpr[0-7]) are the register spaces reside in the first 256 bytes of the memory map (when register block is mapped at $0000) which can be used as the storage spaces by the user program. gpr0-7 general purpose registers read: anytime write: anytime these registers will reset to 0 and can be written and read any time. address offset: $0020 ?$0027 bit 7 654321 bit 0 read: gpr0? write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
registers mc9s12t64revision 1.1.1 104 registers motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola operating modes 105 operating modes contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 operating modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 secured mode of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 introduction eight possible operating modes determine the operating configuration of the mc9s12t64. each mode has an associated default memory map and external bus configuration. operating modes the operating mode out of reset is determined by the states of the modc, modb, and moda pins during reset (refer to table 20 ). the modc, modb, and moda bits in the mode register show current operating mode and provide limited mode switching during operation. the states of the modc, modb, and moda pins are latched into these bits on the rising edge of the reset signal. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 106 operating modes motorola there are two basic types of operating modes: normal modes ?some registers and bits are protected against accidental changes. special modes ?allow greater access to protected control registers and bits for special purposes such as testing. a system development and debug feature, background debug mode (bdm), is available in all modes. in special single-chip mode, bdm is active immediately after reset. the four 8-bit ports (a, b, e and k) associated with the mebi sub-block can serve as general purpose i/o pins or alternatively as the address, data and control signals for a multiplexed expansion bus. address and data are multiplexed on ports a and b. the control pin functions are dependent on the operating mode and the control registers pear and mode. the initial state of bits in the pear and mode registers are also established during reset to configure various aspects of the expansion table 20 mode selection input bkgd & bit modc input & bit modb input & bit moda mode description 000 special single chip, bdm allowed and active. bdm is ?llowed in all other modes but a serial command is required to make bdm ?ctive? 0 0 1 emulation expanded narrow, bdm allowed 010 special test (expanded wide) (1) , bdm allowed 0 1 1 emulation expanded wide, bdm allowed 1 0 0 normal single chip, bdm allowed 1 0 1 normal expanded narrow, bdm allowed 110 peripheral (1) ; bdm allowed but bus operations would cause bus con?cts (must not be used) 1 1 1 normal expanded wide, bdm allowed 1. this mode is intended for motorola factory testing of the mcu. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes operating modes mc9s12t64revision 1.1.1 motorola operating modes 107 bus. after the system is running, application software can access the pear and mode registers to modify the expansion bus configuration. some aspects of port e are not mode dependent. bit 1 of port e is a general purpose input or the irq interrupt input. irq can be enabled by bits in the cpus condition codes register but it is inhibited at reset so this pin is initially configured as a simple input with a pullup. bit 0 of port e is a general purpose input or the xirq interrupt input. xirq can be enabled by bits in the cpus condition codes register but it is inhibited at reset so this pin is initially configured as a simple input with a pullup. the estr bit in the ebictl register is set to one by reset in any user mode. this assures that the reset vector can be fetched even if it is located in an external slow memory device. the pe6/modb/ipipe1 and pe5/moda/ipipe0 pins act as high-impedance mode select inputs during reset. the following paragraphs discuss the default bus setup and describe which aspects of the bus can be changed after reset on a per mode basis. normal operating modes these modes provide three operating configurations. background debug is available in all three modes, but must first be enabled for some operations by means of a bdm background command, then activated. normal single-chip mode there is no external expansion bus in this mode. all pins of ports a, b and k are configured as general purpose i/o pins. port e bits 1 and 0 are available as general purpose input only pins with internal pullups enabled. all other pins of port e are bidirectional i/o pins that are initially configured as high-impedance inputs with internal pullups enabled. the pins associated with port e bits 7, 6, 5, 3, and 2 cannot be configured for their alternate functions ipipe1, ipipe0, lstrb, and r/ w while the mcu is in single chip modes. the associated control bits pipoe, lstre, and rdwe are reset to zero. writing the opposite state into them in single chip mode does not change the operation of the associated port e pins. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 108 operating modes motorola in normal single chip mode, the mode register is writable one time. this allows a user program to change the bus mode to narrow or wide expanded mode and/or turn on visibility of internal accesses. port e, bit 4 can be configured for a free-running e clock output by clearing neclk in the pear register. typically, the only use for an e clock output while the mcu is in single chip modes would be to get a constant speed clock for use in the external application system. normal expanded wide mode in expanded wide modes, ports a and b are configured as a 16-bit multiplexed address and data bus and port e bit 4 is configured as the e clock output signal. these signals allow external memory and peripheral devices to be interfaced to the mcu. port e pins other than pe4/eclk are configured as general purpose i/o pins (initially high-impedance inputs with internal pullup resistors enabled). control bits pipoe, neclk, lstre, and rdwe in the pear register can be used to configure port e pins to act as bus control outputs instead of general purpose i/o pins. it is possible to enable the pipe status signals on port e bits 6 and 5 by setting the pipoe bit in pear, but it would be unusual to do so in this mode. development systems where pipe status signals are monitored would typically use the special variation of this mode. the port e bit 2 pin can be reconfigured as the r/ w bus control signal by writing ? to the rdwe bit in pear. if the expanded system includes external devices that can be written, such as ram, the rdwe bit would need to be set before any attempt to write to an external location. if there are no writable resources in the external system, pe2 can be left as a general purpose i/o pin. the port e bit 3 pin can be reconfigured as the lstrb bus control signal by writing ? to the lstre bit in pear. the default condition of this pin is a general purpose input because the lstrb function is not needed in all expanded wide applications. the port e bit 4 pin is initially configured as eclk output with stretch. the e clock output function depends upon the settings of the neclk bit in the pear register, the ivis bit in the mode register and the estr bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes operating modes mc9s12t64revision 1.1.1 motorola operating modes 109 in the ebictl register. the e clock is available for use in external select decode logic or as a constant speed clock for use in the external application system. normal expanded narrow mode this mode is used for lower cost production systems that use 8-bit wide external eproms or rams. such systems take extra bus cycles to access 16-bit locations but this may be preferred over the extra cost of additional external memory devices. ports a and b are configured as a 16-bit address bus and port a is multiplexed with data. internal visibility is not available in this mode because the internal cycles would need to be split into two 8-bit cycles. since the pear register can only be written once in this mode, use care to set all bits to the desired states during the single allowed write. the pe3/ lstrb pin is always a general purpose i/o pin in normal expanded narrow mode. although it is possible to write the lstre bit in pear to ??in this mode, the state of lstre is overridden and port e bit 3 cannot be reconfigured as the lstrb output. it is possible to enable the pipe status signals on port e bits 6 and 5 by setting the pipoe bit in pear, but it would be unusual to do so in this mode. lstrb would also be needed to fully understand system activity. development systems where pipe status signals are monitored would typically use special expanded wide mode or occasionally special expanded narrow mode. the pe4/eclk pin is initially configured as eclk output with stretch. the e clock output function depends upon the settings of the neclk bit in the pear register, the ivis bit in the mode register and the estr bit in the ebictl register. in normal expanded narrow mode, the e clock is available for use in external select decode logic or as a constant speed clock for use in the external application system. the pe2/r/ w pin is initially configured as a general purpose input with a pullup but this pin can be reconfigured as the r/ w bus control signal by writing ? to the rdwe bit in pear. if the expanded narrow system includes external devices that can be written such as ram, the rdwe bit would need to be set before any attempt to write to an external f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 110 operating modes motorola location. if there are no writable resources in the external system, pe2 can be left as a general purpose i/o pin. internal visibility internal visibility is available when the mcu is operating in expanded wide modes, special test mode or emulation narrow mode. it is not available in single-chip, peripheral or normal expanded narrow modes. internal visibility is enabled by setting the ivis bit in the mode register. if an internal access is made while e, r/ w, and lstrb are configured as bus control outputs and internal visibility is off (ivis=0), e will remain low for the cycle, r/ w will remain high, and address, data and the lstrb pins will remain at their previous state. when internal visibility is enabled (ivis=1), certain internal cycles will be blocked from going external to prevent possible corruption of external devices. during cycles when the bdm is selected, r/ w will remain high, data will maintain its previous state, and address and lstrb pins will be updated with the internal value. during cpu no access cycles when the bdm is not driving, r/ w will remain high, and address, data and the lstrb pins will remain at their previous state. emulation expanded wide mode in expanded wide modes, ports a and b are configured as a 16-bit multiplexed address and data bus and port e provides bus control and status signals. these signals allow external memory and peripheral devices to be interfaced to the mcu. these signals can also be used by a logic analyzer to monitor the progress of application programs. the bus control related pins in port e (pe7/noacc, pe6/modb/ipipe1, pe5/moda/ipipe0, pe4/eclk, pe3/ lstrb/ taglo, and pe2/r/ w) are all configured to serve their bus control output functions rather than general purpose i/o. notice that writes to the bus control enable bits in the pear register in emulation mode are restricted. the main difference between emulation modes and normal modes is that some of the bus control and system control signals cannot be written in emulation modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes operating modes mc9s12t64revision 1.1.1 motorola operating modes 111 emulation expanded narrow mode expanded narrow modes are intended to allow connection of single 8-bit external memory devices for lower cost systems that do not need the performance of a full 16-bit external data bus. accesses to internal resources that have been mapped external (i.e. porta, portb, ddra, ddrb, porte, ddre, pear, pucr, rdriv) will be accessed with a 16-bit data bus on ports a and b. accesses of 16-bit external words to addresses which are normally mapped external will be broken into two separate 8-bit accesses using port a as an 8-bit data bus. internal operations continue to use full 16-bit data paths. they are only visible externally as 16-bit information if ivis=1. ports a and b are configured as multiplexed address and data output ports. during external accesses, address a15, data d15 and d7 are associated with pa7, address a0 is associated with pb0, and data d8 and d0 are associated with pa0. during internal visible accesses and accesses to internal resources that have been mapped external, address a15 and data d15 are associated with pa7, and address a0 and data d0 are associated with pb0. the bus control related pins in port e (pe7/noacc, pe6/modb/ipipe1, pe5/moda/ipipe0, pe4/eclk, pe3/ lstrb/ taglo, and pe2/r/ w) are all configured to serve their bus control output functions rather than general purpose i/o. notice that writes to the bus control enable bits in the pear register in emulation mode are restricted. the main difference between emulation modes and normal modes is that some of the bus control and system control signals cannot be written in emulation modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 112 operating modes motorola special operating modes there are two special operating modes that correspond to normal operating modes. these operating modes are commonly used in factory testing and system development. special single-chip mode when the mcu is reset in this mode, the background debug mode is enabled and ?ctive? the mcu does not fetch the reset vector and execute application code as it would in other modes. instead, the active background debug mode is in control of cpu execution and bdm firmware is waiting for additional serial commands through the bkgd pin. when a serial command instructs the mcu to return to normal execution, the system will be configured as described below unless the reset states of internal control registers have been changed through background commands after the mcu was reset. there is no external expansion bus after reset in this mode. ports a and b are initially simple bidirectional i/o pins that are configured as high-impedance inputs with internal pullups disabled; however, writing to the mode select bits in the mode register (which is allowed in special modes) can change this after reset. all of the port e pins (except pe4/eclk) are initially configured as general purpose high-impedance inputs with pullups enabled. pe4/eclk is configured as the e clock output in this mode. the pins associated with port e bits 6, 5, 3, and 2 cannot be configured for their alternate functions ipipe1, ipipe0, lstrb, and r/ w while the mcu is in single chip modes. the associated control bits pipoe, lstre and rdwe are reset to zero. writing the opposite value into these bits in this mode does not change the operation of the associated port e pins. port e, bit 4 can be configured for a free-running e clock output by clearing neclk in the pear register. typically, the only use for an e clock output while the mcu is in single chip modes would be to get a constant speed clock for use in the external application system. note: when the mcu starts in the special single chip mode, the initcrm and ppage registers are overwritten by the secure bdm firmware. the cpu registers also overwritten by the firmware. these overwritten values are unknown and not guaranteed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes operating modes mc9s12t64revision 1.1.1 motorola operating modes 113 special test mode this mode is intended for motorola factory testing of the mcu. in expanded wide modes, ports a and b are configured as a 16-bit multiplexed address and data bus and port e provides bus control and status signals. in special test mode, the write protection of many control bits is lifted so that they can be thoroughly tested without needing to go through reset. test operating mode there is a test operating mode in which an external master, such as an i.c. tester, can control the on-chip peripherals. peripheral mode this mode is intended for motorola factory testing of the mcu. in this mode, the cpu is inactive and an external (tester) bus master drives address, data and bus control signals in through ports a, b and e. in effect, the whole mcu acts as if it was a peripheral under control of an external cpu. this allows faster testing of on-chip memory and peripherals than previous testing methods. since the mode control register is not accessible in peripheral mode, the only way to change to another mode is to reset the mcu into a different mode. background debugging should not be used while the mcu is in special peripheral mode as internal bus conflicts between bdm and the external master can cause improper operation of both functions. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 114 operating modes motorola mode register (mode) read: anytime (provided this register in the map) write: each bit has specific write conditions. the mode register is used to establish the operating mode and other miscellaneous functions (i.e. internal visibility and emulation of port e and k). in peripheral modes this register is not accessible but it is reset as shown to configure system features. changes to bits in the mode register are delayed one cycle after the write. this register is not in the on-chip map in emulation and peripheral modes. modc, modb, moda ?mode select bits these bits indicate the current operating mode. address offset: $000b (1) bit 7 654321 bit 0 read: modc modb moda 0 ivis 0 emk (2) eme write: reset: 00000000 special single chip reset: 00101011 emulation exp nar reset: 01001000 special tes t reset: 01101011 emulation exp wide reset: 10000000 normal single chip reset: 10100000 normal exp narrow reset: 11000000 peripheral reset: 11100000 normal exp wide = unimplemented 1. register address = base address (initrg) + address offset 2. pk[6:0] pins are not bonded out. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes operating modes mc9s12t64revision 1.1.1 motorola operating modes 115 if moda=1, then modc, modb, moda are write never. if modc=moda=0, then modc, modb, moda are write anytime except that you cannot change to or from peripheral mode. if modc=1, modb=0 and moda=0, then modc is write never, modb, moda are write once, except that you cannot change to peripheral, special test, special single chip, or emulation modes. ivis ?internal visibility (for both read and write accesses) this bit determines whether internal accesses generate a bus cycle that is visible on the external bus. refer to the page 110 about internal visibility. normal: write once emulation: write never special: write anytime table 21 modc, modb, moda write capability (1) modc modb moda mode modx write capability 0 0 0 special single chip modc, b, a write anytime but not to 110 (2) 0 0 1 emulation exp narrow no write 0 1 0 special test modc, b, a write anytime but not to 110 (2) 0 1 1 emulation exp wide no write 1 0 0 normal single chip modc write never, modb, a write once but not to 110 101 normal expanded narrow (3) no write 1 1 0 special peripheral no write 111 normal expanded wide (3) no write 1. no writes to the mod bits are allowed while operating in a secured mode. 2. if you are in a special single chip or special test mode and you write to this register, changing to normal single chip mode, then one allowed write to this register remains even if you write to a special mode. if you write to normal expanded or emulation mode, then no writes remain. 3. the external bus can not be used for memory expansion purpose with external memory devices, since this mcu does not have the pix[5:0]/xaddr[19:14] pins to indicate page number. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 116 operating modes motorola 1 = internal bus operations are visible on external bus. 0 = no visibility of internal bus operations on external bus. note: the program page window ($8000?bfff) may not be correctly monitored with this internal visibility function, since there are no indications of ppage (page index register) to the outside from the mcu. emk ?emulate port k normal: write once emulation: write never special: write anytime 1 = if in any expanded mode or special peripheral mode, portk and ddrk are removed from the memory map. 0 = portk and ddrk are in the memory map so port k can be used for general purpose i/o. in single-chip modes, portk and ddrk are always in the map regardless of the state of this bit. in peripheral modes, portk and ddrk are never in the map regardless of the state of this bit. eme ?emulate port e normal and emulation: write never special: write anytime 1 = if in any expanded mode or special peripheral mode, porte and ddre are removed from the memory map. removing the registers from the map allows the user to emulate the function of these registers externally. 0 = porte and ddre are in the memory map so port e can be used for general purpose i/o. in single-chip modes, porte and ddre are always in the map regardless of the state of this bit. background debug mode background debug mode (bdm) is an auxiliary operating mode that is used for system development. bdm is implemented in on-chip hardware f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes secured mode of operation mc9s12t64revision 1.1.1 motorola operating modes 117 and provides a full set of debug operations. some bdm commands can be executed while the cpu is operating normally. other bdm commands are firmware based, and require the bdm firmware to be enabled and active for execution. in special single-chip mode, bdm is enabled and active immediately out of reset. bdm is available in all other operating modes, but must be enabled before it can be activated. bdm should not be used in special peripheral mode because of potential bus conflicts. once enabled, background debug mode can be made active by a serial command sent via the bkgd pin or execution of a cpu12 bgnd instruction. while background debug mode is active, the cpu can interpret special debugging commands, and read and write cpu registers, peripheral registers, and locations in memory. while bdm is active, the cpu executes code located in a small on-chip rom mapped to addresses $ff20 to $ffff, and bdm control registers are accessible at addresses $ff00 to $ff06. the bdm rom replaces the regular system vectors while bdm is active. while bdm is active, the user memory from $ff00 to $ffff is not in the map except through serial bdm commands. secured mode of operation the device will make available a security feature preventing the unauthorized read and write of the memory contents. this feature allows: protection of the contents of flash, protection of the contents of calram, operation in single-chip mode, operation from external memory with internal flash and calram disabled. the user must be reminded that part of the security must lie with the user? code. an extreme example would be user? code that dumps the f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 118 operating modes motorola contents of the internal program. this code would defeat the purpose of security. at the same time the user may also wish to put a ?ack door in the user? program. an example of this is the user downloads a ?ey?through the sci which allows access to a programming routine that updates parameters stored in flash eeprom. securing the microcontroller once the user has programmed the flash, the part can be secured by programming the security bits located in the flash module. these non-volatile bits will keep the part secured through resetting the part and through powering down the part. the security byte resides in a portion of the flash array. two bits are used for security. the state of the security bits and the resulting state of security are shown in table 22 . note that there are three secured bit combinations and only one unsecured combination. the user can select any of the three combinations to secure the microcontroller. note: when the mcu is in the secured state and in the special single chip mode, reading the calram array returns $ffff for any word accesses or $ff for any byte accesses. caution: check the flash section for more details on the security configuration. table 22 : security bits sec1 sec0 secreq 0 0 1 (secured) 0 1 1 (secured) 1 0 0 (unsecured) 1 1 1 (secured) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes secured mode of operation mc9s12t64revision 1.1.1 motorola operating modes 119 operation of the secured microcontroller normal single chip mode this will be the most common usage of the secured part. everything will appear the same as if the part was not secured with the exception of bdm operation. the bdm operation will be blocked. executing from external memory the user may wish to execute from external space with a secured microcontroller. this is accomplished by resetting directly into expanded mode. the internal flash and the calram will be disabled. bdm operations will be blocked. unsecuring the microcontroller in order to unsecure the microcontroller, the internal flash must be erased. this can be done through an external program in expanded mode. once the user has erased the flash, the part can be reset into special single chip mode. this invokes a program that verifies the erasure of the internal flash. once this program completes, the user can erase and program the flash security bits to the unsecured state. this is generally done through the bdm, but the user could also change to expanded mode (by writing the mode bits through the bdm) and jumping to an external program (again through bdm commands). note that if the part goes through a reset before the security bits are reprogrammed to the unsecure state, the part will be secured again. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
operating modes mc9s12t64revision 1.1.1 120 operating modes motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 121 module mapping control (mmc) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 memory maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 overview the module mapping control (mmc) sub-block of the core performs all mapping and select operations for the on-chip and external memory blocks. the mmc also handles mapping functions for the system peripheral blocks and provides a global peripheral select to be decoded by the motorola i.p. bus when the core is addressing a portion of the peripheral register map space. all bus-related data flow and multiplexing for the core is handled within the mmc as well. finally, the mmc also contains logic to determine the state of system security. features registers for mapping of address space for on-chip ram, calram, and flash eeprom memory blocks and associated registers memory mapping control and selection based upon address decode and system operating mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 122 module mapping control (mmc) motorola core address bus control core data bus control and multiplexing core security state decoding emulation chip select signal generation ( ecs) internal memory expansion miscellaneous system control functions via the misc register block diagram the block diagram of the mmc is shown in figure 14 below. figure 14 module mapping control block diagram mmc mode information registers cpu write data bus cpu address bus cpu control stop, wait address decode cpu read data bus ebi alternate address bus ebi alternate write data bus ebi alternate read data bus security internal memory expansion clocks, reset read & write enables alternate address bus (bdm) alternate write data bus (bdm) alternate read data bus (bdm) core select (s) port k interface memory space select(s) peripheral select bus control secure bdm_unsecure mmc_secure f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) register map mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 123 register map a summary of the registers associated with the mmc sub-block is shown in figure 15 below. detailed descriptions of the registers and bits are given in the subsections that follow. register name bit 7 6 5 4321 bit 0 address offset initrm read ram15 ram14 ram13 ram12 ram11 00 ramhal $0010 write initrg read 0 reg14 reg13 reg12 reg11 000 $0011 write initcrm read cram15 cram14 cram13 cram12 cram11 00 cramon $0012 write misc read 0000 exstr1 exstr0 romhm romon $0013 write reserved for factory test read reads to this register return unpredictable values. $0014 write reserved for factory test read reads to this register return unpredictable values. $0015 write reserved for factory test read reads to this register return unpredictable values. $0016 write reserved for factory test read reads to this register return unpredictable values. $0017 write memsiz0 read reg_sw0 0 eep_sw1 eep_sw0 0 ram_sw2 ram_sw1 ram_sw0 $001c write memsiz1 read rom_sw1 rom_sw0 0 0 0 0 pag_sw1 pag_sw0 $001d write ppage read 0 0 pix5 pix4 pix3 pix2 pix1 pix0 $0030 write reserved read 00000000 $0031 write = unimplemented x = indeterminate figure 15 module mapping control register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 124 module mapping control (mmc) motorola note: register address = base address (initrg) + address offset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) register descriptions mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 125 register descriptions initialization of internal ram position register (initrm) the mc9s12t64 has 2k bytes of fully static ram that is used for storing instructions, variables, and temporary data during program execution. after reset, ram addressing begins at location $0800 but can be assigned to any 2k boundary within the standard 64k byte address space. mapping of internal ram is controlled by five bits in the initrm register and the value written in ramhal is always ignored. read: anytime. write: write once in normal and emulation modes. write anytime in special modes. note: writes to this register take one cycle to go into effect . reset: $09 (ram located from $0800 ?$0fff) ram[15:11] ?internal ram map position this register initializes the internal ram position. the ram15-ram11 bits define the 2k page the ram resides in. ramhal - ram high-align this bit can be written and read, but is ignored in determining the ram position. 1 = don? care 0 = don? care address offset: $0010 bit 7 654321 bit 0 read: ram15 ram14 ram13 ram12 ram11 00 ramhal write: reset: 00001001 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 126 module mapping control (mmc) motorola initialization of register block position register (initrg) this register initializes the internal register block position. mapping of internal registers is controlled by five bits in the initrg register. after reset the 1k byte register block resides at location $0000 but can be reassigned to any 2k byte boundary within the first 32k byte of the 64k byte address space. read: anytime. write: write once in normal and emulation modes. write anytime in special modes. note: writes to this register take one cycle to go into effect. reset to $00 (registers located from $0000 to $03ff) reg[14:11] ?internal register map position these four bits in combination with the leading zero supplied by bit 7 of initrg determine the upper five bits of the base address for the system? internal registers (i.e. the minimum base address is $0000 and the maximum is $7fff). address offset: $0011 bit 7 654321 bit 0 read: 0 reg14 reg13 reg12 reg11 000 write: reset: 00000000 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) register descriptions mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 127 initialization of calram position register (initcrm) this register initializes the calram position. mapping of calram is controlled by six bits in the initcrm register. the mc9s12t64 has 2k bytes of calram which is activated by the cramon bit in the initcrm register. after reset calram address space begins at location $1000 but can be mapped to any 2k byte boundary within the standard 64k byte address space. read: anytime. write: anytime. note: writes to this register take one cycle to go into effect. reset: $11 (calram located from $1000 ?$17ff) cram[15:11] ?internal calram map position these bits specify the upper five bits of the 16-bit calram address. read or write anytime. cramon ?internal calram on (enabled) this bit enables the calram in the memory map. read or write anytime. 1 = place calram in the memory map at the address selected by cram15?ram11. 0 = removes the calram from the map. address offset: $0012 bit 7 654321 bit 0 read: cram15 cram14 cram13 cram12 cram11 00 cramon write: reset: 00010001 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 128 module mapping control (mmc) motorola miscellaneous system control register (misc) additional mapping and external resource controls are available. to use external resources the part must be operated in one of the expanded modes. read: anytime write: refer to each bit for individual write conditions. note: writes to this register take one cycle to go into effect. exstr1, exstr0 ?external access stretch write: once in normal and emulation modes and anytime in special modes this two bit field determines the amount of clock stretch on accesses to the external address space as shown in table 23 below. in single chip and peripheral modes these bits have no meaning or effect. address offset: $0013 bit 7 6 5 4 3 2 1 bit 0 mode read: 0000 exstr1 exstr0 romhm romon write: reset: 0000110 (1) normal expanded or emulation mode reset: 00001101 peripheral or single chip mode reset: 00001100 special test mode = unimplemented 1. determined by state of pk7 pin during reset. see table 24 . table 23 exstr stretch bit de?ition stretch bit exstr1 stretch bit exstr0 number of e clocks stretched 00 0 01 1 10 2 11 3 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) register descriptions mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 129 romhm ?flash eeprom only in second half of memory map write: once in normal and emulation modes and anytime in special modes 1 = disables direct access to the 32k byte flash eeprom in location $0000 $7fff in the memory map. in special modes, the physical location of this 32k byte flash can still be accessed through the program page window. 0 = the 32k byte pages $3d(61) and $3e (62) of fixed flash eeprom in location $0000 ?$7fff can be accessed. romon ?enable flash eeprom write: once in normal and emulation modes and anytime in special modes this bit is used to enable the flash eeprom memory in the memory map. in normal expanded or emulation modes, the reset state of this bit is determined the state of the pk7 pin (port k) during reset. see table 24 . 1 = enables the flash eeprom in the memory map. 0 = disables the flash eeprom from the memory map. table 24 state of romon bit after reset state of pk7 during reset pk7=0 pk7=1 state of romon bit after reset normal expanded mode 01 emulation mode 1 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 130 module mapping control (mmc) motorola memory size register zero (memsiz0) the bits in this register provide read visibility to the system physical memory space allocations defined at system integration. table 16 ( page 79 ) in the system configuration section shows the values assigned to these bits at system integration. read: anytime write: writes have no effect reg_sw0 - allocated system register space eep_sw1:eep_sw0 - allocated system calram memory space ram_sw2:ram_sw0 - allocated system ram memory space address offset: $001c bit 7 6 5 4 3 2 1 bit 0 read: reg_sw0 0 eep_sw1 eep_sw0 0 ram_sw2 ram_sw1 ram_sw0 write: reset: 0 0 0 1 0 0 0 0 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) register descriptions mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 131 memory size register one (memsiz1) the bits in this register provide read visibility to the system physical memory space and on-chip/off-chip partitioning allocations defined at system integration. table 16 ( page 79 ) in the system configuration section shows the values assigned to these bits at system integration. read: anytime write: writes have no effect rom_sw1:rom_sw0 - allocated system flash eeprom or rom physical memory space pag_sw1:pag_sw0 - allocated off-chip flash eeprom or rom memory space address offset: $001d bit 7 6 5 4 3 2 1 bit 0 read: rom_sw1 rom_sw0 0 0 0 0 pag_sw1 pag_sw0 write: reset: 1 1 0 0 0 0 1 1 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 132 module mapping control (mmc) motorola program page index register (ppage) this register determines the 16kb active page viewed through the program page window from $8000 ?$bfff. call and rtc instructions have a special single wire mechanism to read and write this register without using the address bus. read: anytime. write: not writable in normal and emulation modes. write anytime in special modes. reset to $3c (flash eeprom page $3c located from $8000 to $bfff) pix5 ?pix0 ?program page index bits 5-0 these six page index bits are used to select which of the 64 flash eeprom array pages is to be accessed in the program page window. the 64kb address space of mc9s12t64 is divided in the four 16kb pages with their correspondent ppage values listed in table 25 . caution: proper functionality of the mcu is not guaranteed when ppage values other than the ones specified at table 25 ,are used. proper operation in normal modes is not guaranteed if ppage values other than $3c are used. note: normal writes to this register take one cycle to go into effect. writes to this register using the special single wire mechanism of the call and address offset: $0030 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 pix5 pix4 pix3 pix2 pix1 pix0 write: reset: 0 0 1 1 1 1 0 0 = reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) functional description mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 133 rtc instructions will be complete before the end of the associated instruction. functional description the mmc sub-block performs four basic functions of the core operation: bus control, address decoding and select signal generation, memory expansion, and security decoding for the system. each aspect is described in the following subsections. bus control the mmc controls the address bus and data buses that interface the core with the rest of the system. this includes the multiplexing of the input data buses to the core onto the main cpu read data bus and control of data flow from the cpu to the output address and data buses of the core. in addition, the mmc handles all cpu read data bus swapping operations. address decoding as data flows on the core address bus, the mmc decodes the address information, determines whether the internal core register or firmware space, the peripheral space or a memory register or array space is being addressed and generates the correct select signal. this decoding operation also interprets the mode of operation of the system and the state of the mapping control registers in order to generate the proper select. the mmc also generates the emulation chip select ( ecs) signal. table 25 program space page index in special modes pix5 pix4 pix3 pix2 pix1 pix0 program space selected 111100 16k flash eeprom page $3c 111101 16k flash eeprom page $3d 111110 16k flash eeprom page $3e 111111 16k flash eeprom page $3f f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 134 module mapping control (mmc) motorola select priority although internal resources such as control registers and on-chip memory have default addresses, each can be relocated by changing the default values in control registers. normally, i/o addresses, control registers, vector spaces, expansion windows, and on-chip memory are mapped so that their address ranges do not overlap. the mmc will make only one select signal active at any given time. this activation is based upon the priority outlined in table 26 below. if two or more blocks share the same address space, only the select signal for the block with the highest priority will become active. an example of this is if the registers and the ram are mapped to the same space, the registers will have priority over the ram and the portion of ram mapped in this shared space will not be accessible. the expansion windows have the lowest priority. this means that registers, vectors, and on-chip memory are always visible to a program regardless of the values in the page select registers. in expanded modes, the data registers and data directions registers for ports a and b are removed from the on-chip memory map and become external accesses. if the eme bit in the mode register is set, the data and data direction registers for port e are also removed from the on-chip memory map and become external accesses. in emulation modes, if the emk bit in the mode register is set, the data and data direction registers for port k are removed from the on-chip memory map and become external accesses. external memory accesses all address space not used by internal resources is by default external memory space in expanded modes. in mc9s12t64, internal memory resources have to be disabled so that external memory can be accessed. the flash eeprom can be disabled by clearing the romon table 26 mapping precedence precedence resource highest bdm space (internal) when bdm is active this 256 byte block of registers and rom appear at $ff00 ?$ffff ... register space ?1k bytes fully blocked for registers ... ram (internal) ?2k bytes ... calram ?2k bytes ... on-chip flash eeprom ?64k bytes lowest remaining external f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) functional description mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 135 in the misc register during reset. in particular, one can also disable access to the ?st half of the flash eeprom (locations $0000 - $7fff) by setting the romhm bit. although the calram can also be disabled, ultimately it is the enabling condition flash eeprom that determines if access will be external or internal. this is true because the flash eeprom covers all the mcu address space and has a selection priority only superior to external accesses (see ta b l e 2 6 ). ta b l e 2 7 summarizes the conditions necessary for an access to be internal/external in expanded modes. emulation chip select ( ecs) signal functionality when the emk bit in the mode register is set, port k bit 7 is used as an active-low emulation chip select signal, ecs. this signal is active when the system is in emulation mode, the emk bit is set and the flash eeprom or rom space is being addressed. when the emk bit is clear, this pin is used for general purpose i/o.the ecs signal functions based upon the assigned memory allocation. the operation of the ecs signal depends upon the state of the romhm bit in the misc register. table 28 below summarizes the functionality of these signals based upon the allocated memory configuration. table 27 access type in expanded modes romon /romhm mcu address range type of access normal mode special mode 1/0 $0000?ffff internal internal 1/1 $0000?7fff external only if internal resources cannot be accessed external only if internal resources cannot be accessed $8000?ffff internal internal (1) 1. accesses to all flash pages, even to the ones disabled ($3d,$3e) by romhm bit, are al- lowed through the program page window ($8000 <= mcu address <= $bfff). 0/x $0000?ffff external only if internal resources cannot be accessed external only if internal resources cannot be accessed table 28 64k byte physical flash/rom allocated address space romhm ecs $0000 - $7fff 00 11 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 136 module mapping control (mmc) motorola call and return from call instructions call and rtc are uninterruptable instructions that automate page switching in the program expansion window. call is similar to a jsr instruction, but the subroutine that is called can be located anywhere in the normal 64k byte address space or on any page of program expansion memory. call calculates and stacks a return address, stacks the current ppage value, and writes a new instruction-supplied value to ppage. the ppage value controls which of the 64 possible pages is visible through the 16k byte expansion window in the 64k byte memory map. execution then begins at the address of the called subroutine. note: the ppage register is not writable in normal and emulation modes. during the execution of a call instruction, the cpu: writes the old ppage value into an internal temporary register and writes the new instruction-supplied ppage value into the ppage register. calculates the address of the next instruction after the call instruction (the return address), and pushes this 16-bit value onto the stack. pushes the old ppage value onto the stack. calculates the effective address of the subroutine, refills the queue, and begins execution at the new address on the selected page of the expansion window. this sequence is uninterruptable; there is no need to inhibit interrupts during call execution. a call can be performed from any address in memory to any other address. the ppage value supplied by the instruction is part of the effective address. for all addressing mode variations except indexed-indirect $8000 - $bfff n/a 0 $c000 - $ffff table 28 64k byte physical flash/rom allocated (continued) address space romhm ecs f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) functional description mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 137 modes, the new page value is provided by an immediate operand in the instruction. in indexed-indirect variations of call, a pointer specifies memory locations where the new page value and the address of the called subroutine are stored. using indirect addressing for both the new page value and the address within the page allows values calculated at run time rather than immediate values that must be known at the time of assembly. the rtc instruction terminates subroutines invoked by a call instruction. rtc unstacks the ppage value and the return address and refills the queue. execution resumes with the next instruction after the call. during the execution of an rtc instruction, the cpu: pulls the old ppage value from the stack pulls the 16-bit return address from the stack and loads it into the pc writes the old ppage value into the ppage register refills the queue and resumes execution at the return address this sequence is uninterruptable; an rtc can be executed from anywhere in memory, even from a different page of extended memory in the expansion window. the call and rtc instructions behave like jsr and rts, except they use more execution cycles. therefore, routinely substituting call/rtc for jsr/rts is not recommended. jsr and rts can be used to access subroutines that are on the same page in expanded memory. however, a subroutine in expanded memory that can be called from other pages must be terminated with an rtc. and the rtc unstacks a ppage value. so any access to the subroutine, even from the same page, must use a call instruction so that the correct ppage value is in the stack. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 138 module mapping control (mmc) motorola memory maps the following diagrams illustrate the memory map for each mode of operation immediately after reset. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) memory maps mc9s12t64revision 1.1.1 motorola module mapping control (mmc) 139 figure 16 mc9s12t64 memory map after reset $0800 $0000 $1800 $4000 $8000 $c000 $ff00 $ffff normal single chip vectors background single chip registers (mappable to any 2k block within the first 32k) $0000 $03ff $0800 $0fff 2k byte ram (mappable to any 2k block) 16k byte fixed flash $0000 $7fff $8000 $bfff 16k byte fixed flash $ff00 $ffff bdm (if active) $1000 $1000 $17ff 2k byte calram (mappable to any 2k block) vectors extern expanded* * assuming that a ??was driven onto port k bit 7 during reset. 16k byte fixed flash page $3c (block 0) $c000 $ffff page $3f (block 0) $3fff $4000 page $3d (block 1) 16k byte fixed flash page $3e (block 1) vectors 0.5k, 1k, 2k or 4k protected boot sector 2k, 4k, 8k or 16k protected boot sector 0.5k, 1k, 2k or 4k protected boot sector 2k, 4k, 8k or 16k protected boot sector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
module mapping control (mmc) mc9s12t64revision 1.1.1 140 module mapping control (mmc) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 141 multiplexed external bus interface (mebi) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 low-power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 overview the mebi sub-block of the core serves to provide access and/or visibility to internal core data manipulation operations including timing reference information at the external boundary of the core and/or system. depending upon the system operating mode and the state of bits within the control registers of the mebi, the internal 16-bit read and write data operations will be represented in 8-bit or 16-bit accesses externally. using control information from other blocks within the system, the mebi will determine the appropriate type of data access to be generated. note: the internal flash eeprom is located in whole 64k byte memory space. therefore the flash eeprom or parts of it must be disabled to connect external memory devices with the external bus. modes of operation refer to the operating modes section. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 142 multiplexed external bus interface (mebi) motorola external pin descriptions the mebi sub-block of the core interfaces directly with external system pins. table 29 below outlines the pin names and functions and gives a brief description of their operation. table 29 external system pins associated with mebi pin name pin functions description pa7/a15/d15/d7 thru pa0/a8/d8/d0 pa7 - pa0 general purpose i/o pins, see porta and ddra registers. a15 - a8 high-order address lines multiplexed during eclk low. outputs except in special peripheral mode where they are inputs from an external tester system. d15 - d8 high-order bidirectional data lines multiplexed during eclk high in expanded wide modes, peripheral mode & visible internal accesses (ivis=1) in emulation expanded narrow mode. direction of data transfer is generally indicated by r/ w. d15/d7 thru d8/d0 alternate high-order and low-order bytes of the bidirectional data lines multiplexed during eclk high in expanded narrow modes and narrow accesses in wide modes. direction of data transfer is generally indicated by r/w. pb7/a7/d7 thru pb0/a0/d0 pb7 - pb0 general purpose i/o pins, see portb and ddrb registers. a7 - a0 low-order address lines multiplexed during eclk low. outputs except in special peripheral mode where they are inputs from an external tester system. d7 - d0 low-order bidirectional data lines multiplexed during eclk high in expanded wide modes, peripheral mode & visible internal accesses (with ivis=1) in emulation expanded narrow mode. direction of data transfer is generally indicated by r/ w. pe7/ noacc pe7 general purpose i/o pin, see porte and ddre registers. noacc cpu no access output. indicates whether the current cycle is a free cycle. only available in expanded modes. pe6/ipipe1/ modb/clkto modb at the rising edge of reset, the state of this pin is registered into the modb bit to set the mode. pe6 general purpose i/o pin, see porte and ddre registers. ipipe1 instruction pipe status bit 1, enabled by pipoe bit in pear. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) external pin descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 143 pe5/ipipe0/ moda moda at the rising edge on reset, the state of this pin is registered into the moda bit to set the mode. pe5 general purpose i/o pin, see porte and ddre registers. ipipe0 instruction pipe status bit 0, enabled by pipoe bit in pear. pe4/eclk pe4 general purpose i/o pin, see porte and ddre registers. eclk bus timing reference clock, can operate as a free-running clock at the system clock rate or to produce one low-high clock per visible access, with the high period stretched for slow accesses. eclk is controlled by the neclk bit in pear, the ivis bit in mode and the estr bit in ebictl. pe3/ lstrb/ t a glo pe3 general purpose i/o pin, see porte and ddre registers. lstrb low strobe bar, 0 indicates valid data on d7-d0. sz8 in peripheral mode, this pin is an input indicating the size of the data transfer (0=16-bit; 1=8-bit). t a glo in expanded wide mode or emulation narrow modes, when instruction tagging is on and low strobe is enabled, a 0 at the falling edge of e tags the low half of the instruction word being read into the instruction queue. pe2/r/ w pe2 general purpose i/o pin, see porte and ddre registers. r/ w read/write, indicates the direction of internal data transfers. this is an output except in peripheral mode where it is an input. pe1/ irq pe1 general purpose input-only pin, can be read even if irq enabled. irq maskable interrupt request, can be level sensitive or edge sensitive. pe0/ xirq pe0 general purpose input-only pin. xirq non-maskable interrupt input. pk7/ ecs pk7 general purpose i/o pin, see portk and ddrk registers. ecs emulation chip select table 29 external system pins associated with mebi (continued) pin name pin functions description f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 144 multiplexed external bus interface (mebi) motorola bkgd/si/modc / t a ghi modc at the rising edge on reset, the state of this pin is registered into the modc bit to set the mode. (this pin always has an internal pullup.) bkgd pseudo-open-drain communication pin for the single-wire background debug mode. there is an internal pullup resistor on this pin. si the serial data from the host system to the fbdm uses this pin in spi mode. taghi when instruction tagging is on, a 0 at the falling edge of e tags the high half of the instruction word being read into the instruction queue. table 29 external system pins associated with mebi (continued) pin name pin functions description f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register map mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 145 register map register name bit 7 6 5 4 3 2 1 bit 0 address offset porta read bit 7 6 5 4 3 2 1 bit 0 $0000 write portb read bit 7 6 5 4 3 2 1 bit 0 $0001 write ddra read bit 7 6 5 4 3 2 1 bit 0 $0002 write ddrb read bit 7 6 5 4 3 2 1 bit 0 $0003 write reserved read 0 0 0 0 0 0 0 0 $0004 write reserved read 0 0 0 0 0 0 0 0 $0005 write reserved read 0 0 0 0 0 0 0 0 $0006 write reserved read 0 0 0 0 0 0 0 0 $0007 write porte read bit 7 6 5 4 3 2 1 bit 0 $0008 write ddre read bit 7 6 5 4 3 2 0 0 $0009 write pear read noacce 0 pipoe neclk lstre rdwe 0 0 $000a write mode (1) read modc modb moda 0 ivis 0 emk eme $000b write pucr read pupke 0 0 pupee 0 0 pupbe pupae $000c write rdriv read rdpk 0 0 rdpe 0 0 rdpb rdpa $000d write ebictl read 0 0 0 0 0 0 0 estr $000e write reserved read 0 0 0 0 0 0 0 0 $000f write irqcr (2) read irqe irqen 0 0 0 0 0 0 $001e write portk read bit 7 0 0 0 0 0 0 0 $0032 write ddrk read bit 7 0 0 0 0 0 0 0 $0033 write = unimplemented x = indeterminate figure 17 mebi register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 146 multiplexed external bus interface (mebi) motorola note: register address = base address (initrg) + address offset register descriptions not all registers are visible in the mc9s12t64 memory map under certain conditions. in special peripheral mode the first 16 registers associated with bus expansion are removed from the memory map. in expanded modes, some or all of port a, port b, and port e are used for expansion buses and control signals. in order to allow emulation of the single-chip functions of these ports, some of these registers must be rebuilt in an external port replacement unit. in any expanded mode, port a, and port b, are used for address and data lines so registers for these ports, as well as the data direction registers for these ports, are removed from the on-chip memory map and become external accesses. in any expanded mode, port e pins may be needed for bus control (e.g., eclk, r/ w). to regain the single-chip functions of port e, the emulate port e (eme) control bit in the mode register may be set. in this special case of expanded mode and eme set, porte and ddre registers are removed from the on-chip memory map and become external accesses so port e may be rebuilt externally. 1. refer to the operating modes section for the mode register. 2. refer to the resets and interrupts section for the irqcr register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 147 port a register (porta) read and write: anytime (provided this register is in the map). port a bits 7 through 0 are associated with address lines a15 through a8 respectively and data lines d15/d7 through d8/d0 respectively. when this port is not used for external addresses such as in single-chip mode, these pins can be used as general purpose i/o. data direction register a (ddra) determines the primary direction of each pin. ddra also determines the source of data for a read of porta. this register is not in the on-chip map in expanded and peripheral modes. caution: to ensure that you read the value present on the porta pins, always wait at least two cycles after writing to the ddra register before reading from the porta register. address offset: $0000 bit 7 654321 bit 0 read: bit 7 654321 bit 0 write: reset: unaffected by reset single chip: pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 exp wide, emul nar with ivis & periph: addr15/ data15 addr14/ data14 addr13/ data13 addr12/ data12 addr11/ data11 addr10/ data10 addr9/ data9 addr8/ data8 expanded narrow addr15/ data15/ data7 addr14/ data14/ data6 addr13/ data13/ data5 addr12/ data12/ data4 addr11/ data11/ data3 addr10/ data10/ data2 addr9/ data9/ data1 addr8/ data8/ data0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 148 multiplexed external bus interface (mebi) motorola port a data direction register (ddra) read and write: anytime (provided this register is in the map). this register controls the data direction for port a. when port a is operating as a general purpose i/o port, ddra determines the primary direction for each port a pin. a ? causes the associated port pin to be an output and a ??causes the associated pin to be a high-impedance input. the value in a ddr bit also affects the source of data for reads of the corresponding porta register. if the ddr bit is zero (input) the buffered pin input is read. if the ddr bit is one (output) the associated port data register bit state is read. this register is not in the on-chip map in expanded and peripheral modes. it is reset to $00 so the ddr does not override the three-state control signals. ddra7? ?data direction port a 1 = configure the corresponding i/o pin as an output 0 = configure the corresponding i/o pin as an input address offset: $0002 bit 7 654321 bit 0 read: bit 7 654321 bit 0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 149 port b register (portb) read and write: anytime (provided this register is in the map). port b bits 7 through 0 are associated with address lines a7 through a0 respectively and data lines d7 through d0 respectively. when this port is not used for external addresses, such as in single-chip mode, these pins can be used as general purpose i/o. data direction register b (ddrb) determines the primary direction of each pin. ddrb also determines the source of data for a read of portb. this register is not in the on-chip map in expanded and peripheral modes. caution: to ensure that you read the value present on the portb pins, always wait at least two cycles after writing to the ddrb register before reading from the portb register. address offset: $0001 bit 7 6 5 4321 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: unaffected by reset single chip: pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 exp wide, emul nar with ivis & periph: addr7/ data7 addr6/ data6 addr5/ data5 addr4/ data4 addr3/ data3 addr2/ data2 addr1/ data1 addr0/ data0 expanded narrow addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 150 multiplexed external bus interface (mebi) motorola port b data direction register (ddrb) read and write: anytime (provided this register is in the map). this register controls the data direction for port b. when port b is operating as a general purpose i/o port, ddrb determines the primary direction for each port b pin. a ? causes the associated port pin to be an output and a ??causes the associated pin to be a high-impedance input. the value in a ddr bit also affects the source of data for reads of the corresponding portb register. if the ddr bit is zero (input) the buffered pin input is read. if the ddr bit is one (output) the associated port data register bit state is read. this register is not in the on-chip map in expanded and peripheral modes. it is reset to $00 so the ddr does not override the three-state control signals. ddrb7? ?data direction port b 1 = configure the corresponding i/o pin as an output 0 = configure the corresponding i/o pin as an input address offset: $0003 bit 7 654321 bit 0 read: bit 7 654321 bit 0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 151 port e register (porte) read and write: anytime (provided this register is in the map). port e is associated with external bus control signals and interrupt inputs. these include mode select ( xclks/noacc, modb/ipipe1, moda/ipipe0), e clock, size ( lstrb/ taglo), read / write (r/ w), irq, and xirq. when the associated pin is not used for one of these specific functions, the port e pins 7? can be used as general purpose i/o and the port e pins 1? can be used as general purpose input. the port e assignment register (pear) selects the function of each pin and ddre determines whether each pin is an input or output when it is configured to be general purpose i/o. ddre also determines the source of data for a read of porte. some of these pins have software selectable pullups (pe7, eclk, lstrb, r/ w, irq and xirq). a single control bit enables the pullups for all of these pins when they are configured as inputs. this register is not in the on-chip map in peripheral mode or in expanded modes when the eme bit is set. caution: it is unwise to write porte and drre as a word access. if you are changing port e pins from being inputs to outputs, the data may have extra transitions during the write. it is best to initialize porte before enabling as outputs. caution: to ensure that you read the value present on the porte pins, always wait at least two cycles after writing to the ddre register before reading from the porte register. address offset: $0008 bit 7 654321 bit 0 read: bit 7 6 5 4 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset alt. pin function xclks or noacc modb or ipipe1 moda or ipipe0 eclk lstrb or taglo r/ w irq xirq = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 152 multiplexed external bus interface (mebi) motorola port e data direction register (ddre) read and write: anytime (provided this register is in the map). data direction register e is associated with port e. for bits in port e that are configured as general purpose i/o lines, ddre determines the primary direction of each of these pins. a ??causes the associated bit to be an output and a ??causes the associated bit to be an input. port e bit 1 (associated with irq) and bit 0 (associated with xirq) cannot be configured as outputs. port e, bit 1, and bit 0 can be read regardless of whether the alternate interrupt function is enabled. the value in a ddr bit also affects the source of data for reads of the corresponding porte register. if the ddr bit is zero (input) the buffered pin input is read. if the ddr bit is one (output) the associated port data register bit state is read. this register is not in the on-chip map in peripheral mode. it is also not in the map in expanded modes while the eme control bit is set. ddre7? ?data direction port e 1 = configure the corresponding i/o pin as an output 0 = configure the corresponding i/o pin as an input caution: it is unwise to write porte and drre as a word access. if you are changing port e pins from being inputs to outputs, the data may have extra transitions during the write. it is best to initialize porte before enabling as outputs. address offset: $0009 bit 7 654321 bit 0 read: bit 7 6543 bit 2 bit 1 bit 0 write: reset: 00000000 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 153 port e assignment register (pear) read: anytime (provided this register in the map) write: each bit has specific write conditions. port e serves as general purpose i/o lines or as system and bus control signals. the pear register is used to choose between the general-purpose i/o functions and the alternate bus control functions. when an alternate control function is selected, the associated ddre bits are overridden. the reset condition of this register depends on the mode of operation because bus control signals are needed immediately after reset in some modes. in normal single chip mode, no external bus control signals are needed so all of port e is configured for general purpose i/o. in normal expanded modes, only the e clock is configured for its alternate bus control function and the other bits of port e are configured for general purpose i/o. as the reset vector is located in external memory, the e clock is required for this access. r/ w is only address offset: $000a bit 7 654321 bit 0 read: noacce 0 pipoe neclk lstre rdwe 00 write: reset: 00000000 special single chip reset: 00101100 special test reset: 00000000per ipheral reset: 10101100 emulation exp nar reset: 10101100 emulation exp wide reset: 00010000 normal single chip reset: 00000000 normal exp nar reset: 00000000 normal exp wide = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 154 multiplexed external bus interface (mebi) motorola needed by the system when there are external writable resources. if the normal expanded system needs any other bus control signals, pear would need to be written before any access that needed the additional signals. in special test and emulation modes, ipipe1, ipipe0, e, lstrb and r/ w are configured out of reset as bus control signals. noacce ?cpu no access output enable normal: write once emulation: write never special: write anytime 1 = the associated pin (port e bit 7) is output and indicates whether the cycle is a cpu free cycle. 0 = the associated pin (port e bit 7) is general purpose i/o. this bit has no effect in single chip or peripheral modes. pipoe ?pipe status signal output enable normal: write once emulation: write never special: write anytime. 1 = the associated pins (port e bits 6:5) are outputs and indicate the state of the instruction queue 0 = the associated pins (port e bits 6:5) are general purpose i/o. this bit has no effect in single chip or peripheral modes. neclk ?no external e clock normal and special: write anytime emulation: write never 1 = the associated pin (port e bit 4) is a general purpose i/o pin. 0 = the associated pin (port e bit 4) is the external e clock pin. external e clock is free-running if estr=0. external e clock is available as an output in all modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 155 lstre ?low strobe ( lstrb) enable normal: write once emulation: write never special: write anytime. 1 = the associated pin (port e bit 3) is configured as the lstrb bus control output. if bdm tagging is enabled, taglo is multiplexed in on the rising edge of eclk and lstrb is driven out on the falling edge of eclk. 0 = the associated pin (port e bit 3) is a general purpose i/o pin. this bit has no effect in single chip, peripheral or normal expanded narrow modes. note: lstrb is used during external writes. after reset in normal expanded mode, lstrb is disabled to provide an extra i/o pin. if lstrb is needed, it should be enabled before any external writes. external reads do not normally need lstrb because all 16 data bits can be driven even if the mcu only needs 8 bits of data rdwe ?read / write enable normal: write once emulation: write never special: write anytime 1 = the associated pin (port e bit 2) is configured as the r/ w pin. 0 = the associated pin (port e bit 2) is a general purpose i/o pin. this bit has no effect in single chip or peripheral modes. note: r/ w is used for external writes. after reset in normal expanded mode, r/ w is disabled to provide an extra i/o pin. if r/ w is needed it should be enabled before any external writes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 156 multiplexed external bus interface (mebi) motorola pull-up control register (pucr) read and write: anytime (provided this register is in the map). this register is used to select pullup resistors for the pins associated with the a, b, e, k ports. pullups are assigned on a per-port basis and apply to any pin in the corresponding port that is currently configured as an input. this register is not in the on-chip map in emulation and peripheral modes. pupke ?pull-up port k enable 1 = enable pull-up devices for port k input pins. 0 = port k pull-ups are disabled. pupee ?pull-up port e enable 1 = enable pull-up devices for port e input pin bits 7, 4?. 0 = port e pull-ups on bit 7, 4? are disabled. pupbe ?pull-up port b enable 1 = enable pull-up devices for all port b input pins. 0 = port b pull-ups are disabled. pupae ?pull-up port a enable 1 = enable pull-up devices for all port a input pins. 0 = port a pull-ups are disabled. address offset: $000c bit 7 654321 bit 0 read: pupke 00 pupee 00 pupbe pupae write: reset: 1 0010000 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 157 reduced drive of i/o lines (rdriv) read and write: anytime (provided this register is in the map). this register is used to select reduced drive for the pins associated with the a, b, e, k ports. this gives reduced power consumption and reduced rfi with a slight increase in transition time (depending on loading). this feature would be used on ports which have a light loading. the reduced drive function is independent of which function is being used on a particular port. this register is not in the on-chip map in emulation and peripheral modes. rdpk ?reduced drive of port k 1 = all port k output pins have reduced drive enabled. 0 = all port k output pins have full drive enabled. rdpe ?reduced drive of port e 1 = all port e output pins have reduced drive enabled. 0 = all port e output pins have full drive enabled. rdpb ?reduced drive of port b 1 = all port b output pins have reduced drive enabled. 0 = all port b output pins have full drive enabled. rdpa ?reduced drive of port a 1 = all port a output pins have reduced drive enabled. 0 = all port a output pins have full drive enabled. address offset: $000d bit 7 6 54321 bit 0 read: rdpk 00 rdpe 00 rdpb rdpa write: reset: 0 0 000000 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 158 multiplexed external bus interface (mebi) motorola external bus interface control (ebictl) read: anytime (provided this register is in the map). write: refer to individual bit descriptions the ebictl register is used to control miscellaneous functions (i.e. stretching of external e clock). this register is not in the on-chip map in peripheral mode. estr ?e stretches this control bit determines whether the e clock behaves as a simple free-running clock or as a bus control signal that is active only for external bus cycles. normal and emulation: write once special: write anytime 1 = e stretches high during stretch cycles and low during non-visible internal accesses. 0 = e never stretches (always free running). this bit has no effect in single chip modes. address offset: $000e bit 7 6 54321 bit 0 read: 0000000 estr write: reset: 00000000per ipheral reset: 00000001 all other modes = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) register descriptions mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 159 port k data register (portk) read and write anytime this port is associated with the internal memory expansion emulation pins. when the port is not enabled to emulate the internal memory expansion, the port pins are used as general-purpose i/o. when port k is operating as a general purpose i/o port, ddrk determines the primary direction for each port k pin. a ? causes the associated port pin to be an output and a ??causes the associated pin to be a high-impedance input. the value in a ddr bit also affects the source of data for reads of the corresponding portk register. if the ddr bit is zero (input) the buffered pin input is read. if the ddr bit is one (output) the output of the port data register is read.this register is not in the map in peripheral or expanded modes while the emk control bit in mode register is set. when inputs, these pins can be selected to be high impedance or pulled up, based upon the state of the pupke bit in the pucr register. bit 7?port k bit 7. this bit is used as an emulation chip select signal for the emulation of the internal memory expansion, or as general purpose i/o, depending upon the state of the emk bit in the mode register. while this bit is used as a chip select, the external bit will return to its de-asserted state (vdd) for approximately 1/4 cycle just after the negative edge of address offset: $0032 bit 7 6 5 4 3 2 1 bit 0 read: bit 7 0 0 0 0 0 0 0 write reset: unaffected by reset alt. pin function ecs / romone 0 0 0 0 0 0 0 = reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 160 multiplexed external bus interface (mebi) motorola eclk, unless the external access is stretched and eclk is free-running (estr bit in ebictl = 0). for the details see emulation chip select (ecs) signal functionality in page 135 . port k data direction register (ddrk) read and write: anytime. this register determines the primary direction for each port k pin configured as general-purpose i/o. this register is not in the map in peripheral or expanded modes while the emk control bit in mode register is set. bit 7 ?the data direction select for port k 1 = associated pin is an output. 0 = associated pin is a high-impedance input. caution: it is unwise to write portk and ddrk as a word access . if you are changing port k pins from inputs to outputs, the data may have extra transitions during the write . it is best to initialize portk before enabling as outputs . caution: to ensure that you read the correct value from the portk pins, always wait at least two cycles after writing to the ddrk register before reading from the portk register. address offset: $0033 bit 7 6 5 4 3 2 1 bit 0 read: ddk7 0 0 0 0 0 0 0 write: reset: 0 0 0 0 0 0 0 0 = reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) functional description mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 161 functional description there are four main sub-blocks within the mebi: external bus control, external data bus interface, control and registers. external bus control the external bus control generates the miscellaneous control functions (pipe signals, eclk, lstrb and r/ w) that will be sent external on port e, bits 6-2. it also generates the external addresses. external data bus interface the external data bus interface block manages data transfers from/to the external pins to/from the internal read and write data buses. this block selectively couples 8-bit or 16-bit data to the internal data bus to implement a variety of data transfers including 8-bit, 16-bit, 16-bit swapped and 8-bit external to 16-bit internal accesses. modes, addresses, chip selects, etc. affect the type of accesses performed during each bus cycle. control the control block generates the register read/write control signals and miscellaneous port control signals. registers the register block includes the fourteen 8-bit registers and five reserved register locations associated with the mebi sub-block. detecting access type from external signals the external signals lstrb, r/ w, and a0 indicate the type of bus access that is taking place. accesses to the internal ram module are the only type of access that produce lstrb = a0 = 1, because the internal ram (except calram) is specifically designed to allow misaligned 16-bit accesses in a single cycle. in these cases the data for the address that was accessed is on the low half of the data bus and the data for address + 1 is on the high half of the data bus. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 162 multiplexed external bus interface (mebi) motorola stretched bus cycles in order to allow fast internal bus cycles to coexist in a system with slower external memory resources, the hcs12 supports the concept of stretched bus cycles (module timing reference clocks for timers and baud rate generators are not affected by this stretching). control bits in the misc register specify the amount of stretch (0, 1, 2, or 3 periods of the internal bus-rate clock). while stretching, the cpu state machines are all held in their current state. at this point in the cpu bus cycle, write data would already be driven onto the data bus so the length of time write data is valid is extended in the case of a stretched bus cycle. read data would not be captured by the mcu until the e clock falling edge. in the case of a stretched bus cycle, read data is not required until the specified setup time before the falling edge of the stretched e clock. the external address and r/w signals remain valid during the period of stretching (throughout the stretched e high time). internal visibility internal visibility is available when the system is operating in expanded wide modes, special test mode, or emulation narrow mode. it is not available in single-chip, peripheral or normal expanded narrow modes. internal visibility is enabled by setting the ivis bit in the mode register. if an internal access is made while e, r/ w, and lstrb are configured as bus control outputs and internal visibility is off (ivis=0), e will remain low for the cycle, r/ w will remain high, and address, data and the lstrb pins will remain at their previous state. table 30 access type vs. bus control pins lstrb a0 r/ w type of access 1 0 1 8-bit read of an even address 0 1 1 8-bit read of an odd address 1 0 0 8-bit write of an even address 0 1 0 8-bit write of an odd address 0 0 1 16-bit read of an even address 111 16-bit read of an odd address (low/high data swapped) 0 0 0 16-bit write to an even address 110 16-bit write to an odd address (low/high data swapped) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) functional description mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 163 when internal visibility is enabled (ivis=1), certain internal cycles will be blocked from going external to prevent possible corruption of external devices. specifically, during cycles when the bdm is selected, r/ w will remain high, data will maintain its previous state, and address and lstrb pins will be updated with the internal value. during cpu no access cycles when the bdm is not driving, r/ w will remain high, and address, data and the lstrb pins will remain at their previous state. external visibility of instruction queue the instruction queue buffers program information and increases instruction throughput. the queue consists of three 16-bit stages. program information is always fetched in aligned 16-bit words. normally, at least three bytes of program information are available to the cpu when instruction execution begins. program information is fetched and queued a few cycles before it is used by the cpu. in order to monitor cycle-by-cycle cpu activity, it is necessary to externally reconstruct what is happening in the instruction queue. two external pins, ipipe[1:0], provide time-multiplexed information about data movement in the queue and instruction execution. to complete the picture for system debugging, it is also necessary to include program information and associated addresses in the reconstructed queue. the instruction queue and cycle-by-cycle activity can be reconstructed in real time or from trace history captured by a logic analyzer. however, neither scheme can be used to stop the cpu at a specific instruction. by the time an operation is visible outside the system, the instruction has already begun execution. a separate instruction tagging mechanism is provided for this purpose. a tag follows the information in the queue as the queue is advanced. during debugging, the cpu enters active background debug mode when a tagged instruction reaches the head of the queue, rather than executing the tagged instruction. for more information about tagging, refer to instruction tagging in page 544 . instruction queue status signals the ipipe[1:0] signals carry time-multiplexed information about data movement and instruction execution during normal operation. the f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 164 multiplexed external bus interface (mebi) motorola signals are available on two multifunctional device pins. during reset, the pins are mode-select inputs moda and modb. after reset, information on the pins does not become valid until an instruction reaches stage two of the queue. to reconstruct the queue, the information carried by the status signals must be captured externally. in general, data-movement and execution-start information are considered to be distinct two-bit values, with the low bit on ipipe0 and the high bit on ipipe1. data-movement information is available when e clock is high or on falling edges of the e clock; execution-start information is available when e clock is low or on rising edges of the e clock, as shown in figure 18 . data-movement information refers to data on the bus. execution-start information is delayed one bus cycle to guarantee the indicated opcode is in stage three. table 31 summarizes the information encoded on the ipipe[1:0] pins. figure 18 queue status signal timing data movement status is valid when the e clock is high and is represented by two states: no movement ?there is no data shifting in the queue. cpu clock e clock data[15:0] t2 t4 t2 t4 t4 t2 ex ex ex dm dm pipe[1:0] none sev sod none ald program data operand or free cycle program data dm ald stage three stage two stage one a a b b c c a data 00 10 11 00 10 10 ald ?advance and load data sev ?start even instruction sod ?start odd instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) functional description mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 165 advance and load from data bus the queue shifts up one stage with stage one being filled with the data on the read data bus. execution start status is valid when the e clock is low and is represented by four states: no start ?execution of the current instruction continues. start interrupt ?an interrupt sequence has begun. note: the start-interrupt state is indicated when an interrupt request or tagged instruction alters program flow. swi and trap instructions are part of normal program flow and are indicated as start even or start odd depending on their alignment. since they are present in the queue, they can be tracked in an external queue rebuild. an external event that interrupts program flow is indeterministic. program data is not present in the queue until after the vector jump. start even instruction the current opcode is in the high byte of stage three of the queue. start odd instruction ?the current opcode is in the low byte of stage three of the queue. table 31 ipipe[1:0] decoding when e clock is high data movement (capture at e fall) mnemonic meaning 0:0 no movement 0:1 reserved 1:0 ald advance queue and load from bus 1:1 reserved table 32 ipipe[1:0] decoding when e clock is low execution start (capture at e rise) mnemonic meaning 0:0 no start 0:1 int start interrupt sequence 1:0 sev start even instruction 1:1 sod start odd instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 166 multiplexed external bus interface (mebi) motorola the execution-start status signals are delayed by one e clock cycle to allow a lagging program fetch and queue advance. therefore the execution-start status always refers to the data in stage three of the queue. the advance and load from bus signal can be used as a load-enable to capture the instruction word on the data bus. this signal is effectively the queue advance signal inside the cpu. program data is registered into stage one on the rising edge of t4 when queue advance is asserted. no movement (0:0) the 0:0 state at the falling edge of e indicates that there is no data movement in the instruction queue during the current cycle. the 0:0 state at the rising edge of e indicates continuation of an instruction or interrupt sequence during the previous cycle. ald ?advance and load from data bus (1:0) the three-stage instruction queue is advanced by one word and stage one is refilled with a word of program information from the data bus. the cpu requested the information two bus cycles earlier but, due to access delays, the information was not available until the e cycle immediately prior to the ald. int ?start interrupt (0:1) this state indicates program flow has changed to an interrupt sequence. normally this cycle is a read of the interrupt vector. however, in systems that have interrupt vectors in external memory and an 8-bit data bus, this cycle reads only the lower byte of the 16-bit interrupt vector. sev ?start even instruction (1:0) this state indicates that the instruction is in the even (high) half of the word in stage three of the instruction queue. the queue treats the $18 prebyte of an instruction on page two of the opcode map as a special one-byte, one-cycle instruction. however, interrupts are not recognized at the boundary between the prebyte and the rest of the instruction. sod ?start odd instruction (1:1) this state indicates that the instruction in the odd (low) half of the word in stage three of the instruction queue. the queue treats the $18 prebyte of an instruction on page two of the opcode map as a special one-byte, one-cycle instruction. however, interrupts are not recognized at the boundary between the prebyte and the rest of the instruction. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) low-power options mc9s12t64revision 1.1.1 motorola multiplexed external bus interface (mebi) 167 low-power options the mebi does not contain any user-controlled options for reducing power consumption. the operation of the mebi in low-power modes is discussed in the following subsections. run mode the mebi does not contain any options for reducing power in run mode; however, the external addresses are conditioned with expanded mode to reduce power in single chip modes. wait mode the mebi does not contain any options for reducing power in wait mode. stop mode the mebi will cease to function during execution of a cpu stop instruction. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
multiplexed external bus interface (mebi) mc9s12t64revision 1.1.1 168 multiplexed external bus interface (mebi) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola resets and interrupts 169 resets and interrupts contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 exception priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 maskable interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 latching of interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 effects of reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 introduction hcs12 exceptions include resets and interrupts. each exception has an associated 16-bit vector, which points to the memory location where the routine that handles the exception is located. vectors are stored in the upper 128 bytes of the standard 64k byte address map. the six highest vector addresses are used for resets and non-maskable interrupt sources. the remainder of the vectors are used for maskable interrupts, and all must be initialized to point to the address of the appropriate service routine. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 170 resets and interrupts motorola register map note: register address = base address (initrg) + address offset register name bit 7 6 5 4 3 2 1 bit 0 addr. offset irqcr read: irqe irqen 000000 $001e write: hprio read: psel7 psel6 psel5 psel4 psel3 psel2 psel1 0 $001f write: = reserved or unimplemented figure 19 resets and interrupts register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts exception priority mc9s12t64revision 1.1.1 motorola resets and interrupts 171 exception priority a hardware priority hierarchy determines which reset or interrupt is serviced first when simultaneous requests are made. six sources are not maskable. the remaining sources are maskable, and any one of them can be given priority over other maskable interrupts. the priorities of the non-maskable sources are: 1. lvd reset, por or reset pin 2. clock monitor reset 3. cop watchdog reset 4. unimplemented instruction trap 5. software interrupt instruction (swi) 6. xirq signal (if x bit in ccr = 0) maskable interrupts maskable interrupt sources include on-chip peripheral systems and external interrupt service requests. interrupts from these sources are recognized when the global interrupt mask bit (i) in the ccr is cleared. the default state of the i bit out of reset is one, but it can be written at any time. interrupt sources are prioritized by default but any one maskable interrupt source may be assigned the highest priority by means of the hprio register. the relative priorities of the other sources remain the same. an interrupt that is assigned highest priority is still subject to global masking by the i bit in the ccr, or by any associated local bits. interrupt vectors are not affected by priority assignment. hprio can only be written while the i bit is set (interrupts inhibited). table 33 lists interrupt sources and vectors in default order of priority. before masking an interrupt by clearing the corresponding local enable bit, it is required to set the i-bit to avoid an swi (software interrupt). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 172 resets and interrupts motorola latching of interrupts xirq is always level triggered and irq can be selected as a level triggered interrupt. these level triggered interrupt pins should only be released during the appropriate interrupt service routine. generally the interrupt service routine will handshake with the interrupting logic to release the pin. in this way, the mcu will never start the interrupt service sequence only to determine that there is no longer an interrupt source. in event that this does occur the trap vector will be taken. if irq is selected as an edge triggered interrupt, the hold time of the level after the active edge is independent of when the interrupt is serviced. as long as the minimum hold time is met, the interrupt will be latched inside the mcu. in this case the irq edge interrupt latch is cleared automatically when the interrupt is serviced. all of the remaining interrupts are latched by the mcu with a flag bit. these interrupt flags should be cleared during an interrupt service routine or when interrupts are masked by the i bit. by doing this, the mcu will never get an unknown interrupt source and take the trap vector. table 33 interrupt vector table vector address interrupt source ccr mask local enable hprio value to elevate $fffe, $ffff reset (lvd, por and reset pin) none none $fffc, $fffd crg clock monitor fail reset none pllctl (cme, scme) $fffa, $fffb crg cop failure reset none copctl (cr2-0) $fff8, $fff9 unimplemented instruction trap none none $fff6, $fff7 swi none none $fff4, $fff5 xirq x-bit none $fff2, $fff3 irq i-bit irqcr (irqen) $f2 $fff0, $fff1 crg real time interrupt i-bit crgint (rtie) $f0 $ffee, $ffef ect channel 0 i-bit tie (c0i) $ee $ffec, $ffed ect channel 1 i-bit tie (c1i) $ec $ffea, $ffeb ect channel 2 i-bit tie (c2i) $ea $ffe8, $ffe9 ect channel 3 i-bit tie (c3i) $e8 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts latching of interrupts mc9s12t64revision 1.1.1 motorola resets and interrupts 173 $ffe6, $ffe7 ect channel 4 i-bit tie (c4i) $e6 $ffe4, $ffe5 ect channel 5 i-bit tie (c5i) $e4 $ffe2, $ffe3 ect channel 6 i-bit tie (c6i) $e2 $ffe0, $ffe1 ect channel 7 i-bit tie (c7i) $e0 $ffde, $ffdf ect over?w i-bit tscr2 (toi) $de $ffdc, $ffdd ect pulse accumulator a over?w i-bit pactl (paovi) $dc $ffda, $ffdb ect pulse accumulator a input edge i-bit pactl (pai) $da $ffd8, $ffd9 spi i-bit spicr1 (spie, sptie) $d8 $ffd6, $ffd7 sci 0 i-bit sci0cr2 (tie, tcie, rie, ilie) $d6 $ffd4, $ffd5 sci 1 i-bit sci1cr2 (tie, tcie, rie, ilie) $d4 $ffd2, $ffd3 atd i-bit atdctl2 (ascie) $d2 $ffd0, $ffd1 intd0 reserved for future use i-bit $d0 $ffce, $ffcf intce reserved for future use i-bit $ce $ffcc, $ffcd intcc reserved for future use i-bit $cc $ffca, $ffcb ect modulus down counter under?w i-bit mcctl(mczi) $ca $ffc8, $ffc9 ect pulse accumulator b over?w i-bit pbctl(pbovi) $c8 $ffc6, $ffc7 crg pll lock i-bit crgint (lockie) $c6 $ffc4, $ffc5 crg self clock mode i-bit crgint (scmie) $c4 $ffc2, $ffc3 intc2 reserved for future use i-bit $c2 $ffc0, $ffc1 intc0 reserved for future use i-bit $c0 $ffbe, $ffbf intbe reserved for future use i-bit $be $ffbc, $ffbd intbc reserved for future use i-bit $bc $ffba, $ffbb intba reserved for future use i-bit $ba $ffb8, $ffb9 flash i-bit fctl(ccie, cbeie) $b8 $ffb6, $ffb7 intb6 reserved for future use i-bit $b6 $ffb4, $ffb5 intb4 reserved for future use i-bit $b4 $ffb2, $ffb3 intb2 reserved for future use i-bit $b2 $ffb0, $ffb1 intb0 reserved for future use i-bit $b0 $ffae, $ffaf intae reserved for future use i-bit $ae $ffac, $ffad intac reserved for future use i-bit $ac $ffaa, $ffab intaa reserved for future use i-bit $aa $ffa8, $ffa9 inta8 reserved for future use i-bit $a8 $ffa6, $ffa7 inta6 reserved for future use i-bit $a6 $ffa4, $ffa5 inta4 reserved for future use i-bit $a4 $ffa2, $ffa3 inta2 reserved for future use i-bit $a2 $ffa0, $ffa1 inta0 reserved for future use i-bit $a0 $ff9e, $ff9f int9e reserved for future use i-bit $9e $ff9c, $ff9d int9c reserved for future use i-bit $9c table 33 interrupt vector table (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 174 resets and interrupts motorola $ff9a, $ff9b int9a reserved for future use i-bit $9a $ff98, $ff99 int98 reserved for future use i-bit $98 $ff96, $ff97 int96 reserved for future use i-bit $96 $ff94, $ff95 int94 reserved for future use i-bit $94 $ff92, $ff93 int92 reserved for future use i-bit $92 $ff90, $ff91 int90 reserved for future use i-bit $90 $ff8e, $ff8f int8e reserved for future use i-bit $8e $ff8c, $ff8d pwm emergency shutdown i-bit pwmsdn(pwmie) $8c $ff8a, $ff8b int8a reserved for future use i-bit $8a $ff88, $ff89 int88 reserved for future use i-bit $88 $ff86, $ff87 int86 reserved for future use i-bit $86 $ff84, $ff85 int84 reserved for future use i-bit $84 $ff82, $ff83 int82 reserved for future use i-bit $82 $ff80, $ff81 int80 reserved for future use i-bit $80 $ff10 - $ff7f reserved for future use (1) $ff00 - $ff0f flash protection/security field (refer to ta b l e 3 7 in page 202 for more information) 1. this area can be used for both data and program space, however bdm firmware commands can not be used to debug the area. table 33 interrupt vector table (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts register descriptions mc9s12t64revision 1.1.1 motorola resets and interrupts 175 register descriptions interrupt control and priority register read: refer to individual bit descriptions write: refer to individual bit descriptions irqe ?irq select edge sensitive only special modes: read or write anytime normal & emulation modes: read anytime, write once 1 = irq configured to respond only to falling edges. falling edges on the irq pin will be detected anytime irqe = 1 and will be cleared only upon a reset or the servicing of the irq interrupt. 0 = irq configured for low-level recognition. irqen ?external irq enable normal, emulation, and special modes: read or write anytime 1 = external irq pin is connected to interrupt logic. 0 = external irq pin is disconnected from interrupt logic. note: when irqen=0, the edge detect latch is disabled. irqcr ?irq control register address offset: $001e bit 7 654321 bit 0 read: irqe irqen 000000 write: reset: 01000000 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 176 resets and interrupts motorola read: anytime write: only if i mask in ccr = 1 determines which i maskable interrupt will be promoted to highest priority (of the i maskable interrupts). to promote an interrupt the user writes the least significant byte of the associated interrupt vector address to this register. if an unimplemented vector address or a non i-masked vector address (value higher than $f2) is written, then fff2 will be the default highest priority interrupt. hprio ?highest priority i interrupt address offset: $001f bit 7 654321 bit 0 read: psel7 psel6 psel5 psel4 psel3 psel2 psel1 0 write: reset: 11110010 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts resets mc9s12t64revision 1.1.1 motorola resets and interrupts 177 resets there are four possible sources of reset. lvd (low voltage detector) reset, power-on reset (por), and external reset on the reset pin share the normal reset vector. the computer operating properly (cop) reset and the clock monitor reset each has a vector. entry into reset is asynchronous and does not require a clock but the mcu cannot sequence out of reset without a system clock. power-on and lvd resets refer to the clocks and reset generator (crg) and the low-voltage detector (lvd) sections. external reset refer to the clocks and reset generator (crg) section. cop reset refer to the clocks and reset generator (crg) section. clock monitor reset refer to the clocks and reset generator (crg) section. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 178 resets and interrupts motorola effects of reset when a reset occurs, mcu registers and control bits are changed to known start-up states, as follows. operating mode and memory map operating mode and default memory mapping are determined by the states of the bkgd, moda, and modb pins during reset. the moda, modb, and modc bits in the mode register reflect the status of the mode-select inputs at the rising edge of reset. operating mode and default maps can subsequently be changed according to strictly defined rules. clock and watchdog control logic the cop watchdog system is enabled, with cr[2:0]=%011. the clock monitor is enabled. the rtif flag is cleared and the real time interrupt is disabled. the rtr bits in the rtictl are cleared, and must be initialized before the rti system is used. interrupts psel is initialized in the hprio register with the value $f2, causing the external irq pin to have the highest i-bit interrupt priority. the irq pin is configured for level-sensitive operation. however, the interrupt mask bits in the cpu12 ccr are set to mask x- and i-related interrupt requests. parallel i/o if the mcu comes out of reset in a single-chip mode, all ports are configured as general-purpose high-impedance inputs. if the mcu comes out of reset in an expanded mode, port a and port b are used for the address/data bus, and port e pins are normally used to control the external bus. out of reset, port k, port e, port t, port s, port p and port ad are all configured as general-purpose inputs. central processing unit after reset, the cpu fetches a vector from the appropriate address, then begins executing instructions. the stack pointer and other cpu registers are initialized immediately after reset. the ccr x and i interrupt mask f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts effects of reset mc9s12t64revision 1.1.1 motorola resets and interrupts 179 bits are set to mask any interrupt requests. the s bit is also set to inhibit the stop instruction. memory after reset, the internal register block is located from $0000 to $03ff, ram is at $0800 to $0fff and calram is at $1000 to $17ff. in single chip mode 64k byte flash eeprom module is located from $0000 to $ffff. other resources the enhanced capture timer (ect), pulse width modulation timer (pwm), serial communications interfaces (sci0 and sci1), serial peripheral interfaces (spi), and analog-to-digital converters (atd) are off after reset. note: when the mcu starts in the special single chip mode, the initcrm and ppage registers are overwritten by the secure bdm firmware. the cpu registers also overwritten by the firmware. these overwritten values are unknown and not guaranteed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
resets and interrupts mc9s12t64revision 1.1.1 180 resets and interrupts motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola voltage regulator (vreg) 181 voltage regulator (vreg) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 overview the voltage regulator (vreg) converts the external vddr (5v 5%) supply to vdd and vddpll (2.5v 10%) used to supply the internal core logic as well as pll and clock system. features dual linear voltage regulator with nmos output transistors standby mode to minimize power consumption voltage reference derived from vdda/vssa power on reset generator modes of operation the voltage regulator has three operating modes: run, standby and disabled. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
voltage regulator (vreg) mc9s12t64revision 1.1.1 182 voltage regulator (vreg) motorola normal operation run mode in run mode, both regulating loops of the voltage regulator are active. this mode is selected whenever the cpu is neither in stop mode nor in pseudo stop mode, and vregen is externally connected to vdda. special operation standby mode standby mode is selected when the cpu is in stop mode or in pseudo stop mode, and vregen is externally connected to vdda. in standby mode, the gates of the power transistors are directly connected to the reference voltage v ref ((vdda - vssa)/2), the loop amplifiers are switched off. in this case, the voltage regulator acts as a voltage clamp. in standby mode, the source resistance of the regulator is increased, but power consumption is significantly decreased. shutdown mode shutdown mode can be selected by connecting vregen to vssa. in this case, vdd and vddpll (2.5v 10%)must be supplied externally. in shutdown mode, vreg will also generate the power on reset signal. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
voltage regulator (vreg) block diagram mc9s12t64revision 1.1.1 motorola voltage regulator (vreg) 183 block diagram figure 20 vreg block diagram + vdd1,2 vss1,2 vddpll vdda vssa vddr = por + + r r v ref v por f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
voltage regulator (vreg) mc9s12t64revision 1.1.1 184 voltage regulator (vreg) motorola functional description the voltage regulator module generates the supply voltage needed for the core logic as well as for the oscillator/pll section. the reference for the regulation loops are derived from a voltage divider connected between vdda and vssa. both regulation loops, vdd and vddpll, consist of an operational amplifier driving an nmos power transistor in unit gain configuration. if there is no significant demand of output current (the cpu is in stop or pseudo stop mode) the voltage regulator is brought into standby mode, to decrease power consumption of the voltage regulator itself. the voltage regulator can be enabled/disabled by the logic level on the vregen pin. please note vdda, vddr and vssx are internally connected by anti parallel diodes. reset initialization on system power up, the voltage regulator is started in run mode if vregen is connected to vdda. the lvd monitors vdda to ensure that the mcu is not executing code while the power supply is out of specification limits to avoid erroneous operation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola low-voltage detector (lvd) 185 low-voltage detector (lvd) contents glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 glossary v lvrr the release voltage for the lvd module. if a low voltage condition is detected, the mcu remains in reset until vddr rises above v lvrr . v lvr the trip voltage for the lvd module. depending on its configuration, various actions can be taken by the lvd module if vddr falls to v lvr level and remains at or below that level. overview the low-voltage detector (lvd) module monitors the voltage on the vddr pin and can force a reset when the vddr voltage falls to v lvr level and remains at or below that level. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) mc9s12t64revision 1.1.1 186 low-voltage detector (lvd) motorola features programmable lvd reset. programmable power consumption. digital filtering of vddr pin level detection modes of operation run mode normal mode of operation. the lvd module can generate a reset. wait mode not applicable stop mode not applicable f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) block diagram mc9s12t64revision 1.1.1 motorola low-voltage detector (lvd) 187 block diagram figure 21 lvd block diagram + vddr vssr bandgap reference lvde lvdf lvdre lvd reset circuit to lvdsr from lvdcr from lvdcr comparator digital filter (>16 bus clocks) bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) mc9s12t64revision 1.1.1 188 low-voltage detector (lvd) motorola register map the register map for the lvd appears below. note: register address = base address (initrg) + address offset register name bit 7 6 54321 bit 0 addr. offset lvdcr read: lvde lvdre 000000 $00f8 write: reserved read: 00000000 $00f9 write: lvdsr read: lvdf 0000000 $00fa write: reserved read: 00000000 $00fb write: = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) register descriptions mc9s12t64revision 1.1.1 motorola low-voltage detector (lvd) 189 register descriptions lvd control register (lvdcr) read anytime. write anytime. lvde ?lvd enable bit this lvde bit controls whether the lvd is enabled. 1 = lvd enabled 0 = lvd disabled lvdre ?lvd reset enable the lvdre bit controls the lvd reset if lvde is set. 1 = lvd reset enabled 0 = lvd reset disabled address offset: $00f8 bit 7 6 5 4 3210 read: lvde lvdre 000000 write: power-on reset: 1 (1) 1 (1) 000000 = unimplemented or reserved 1. lvde and lvdre bits are set when a power on reset (por) occurs. unaffected by non-por resets. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) mc9s12t64revision 1.1.1 190 low-voltage detector (lvd) motorola lvd status register (lvdsr) read anytime. write anytime. lvdf ?low voltage detection flag the lvdf flag indicates the low voltage detect status when lvde is set. the lvdf flag is cleared when a power on reset (por) occurred. the lvdf flag is set when the vddr voltage falls below the v lvr voltage for 17 bus clock cycles (refer to table 34 ). unaffected by non-por resets. this flag can only be cleared by writing a 1. writing a 0 has no effect. 1 = low voltage has been detected. 0 = low voltage has not been detected. address offset: $00fa bit 7 6 5 4 3210 read: lvdf 0000000 write: power-on reset: 0 (1) 0000000 = unimplemented or reserved 1. lvdf is cleared when a power on reset (por) occurs. unaffected by non-por resets. table 34 lvdf flag indication vddr lvdf at level for number of bus clock cycles vddr > v lvrr any keeps previous value vddr v lv r < 16 bus clock cycles keeps previous value between 16 and 17 bus clock cycles keeps previous value or becomes ? > 17 bus clock cycles becomes ? v lv r < vddr < v lvrr any keeps previous value f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) functional description mc9s12t64revision 1.1.1 motorola low-voltage detector (lvd) 191 functional description figure 21 shows the structure of the lvd module. the lvd enable bit (lvde) in the lvd control register (lvdcr) is set out of power-on reset, enabling the lvd to monitor the vddr voltage. the lvd monitors the voltage on the vddr pin by means of the bandgap reference circuit and the comparator.the lvdf flag in the lvd status register (lvdsr) is set whenever the vddr voltage falls to v lvr level and remains at or below that level for 17 or more consecutive bus clock cycles. under such condition, the part is reset if the lvd reset enable bit (lvdre) in lvdcr is logical 1. once an lvd reset occurs, the mcu remains in reset until vddr rises above the voltage v lvrr . an lvd reset also drives the reset pin low to provide low-voltage protection to external peripheral devices. polled lvd operation in applications that can operate at vddr levels below the v lvr level, software can monitor vddr by polling the lvdf bit. in the control register, the lvde bit must be at logic 1 to enable the lvd module, and the lvdre bit must be at logic 0 to disable lvd resets. forced reset operation in applications that require vddr to remain above the v lvr level, enabling lvd resets allows the lvd module to reset the mcu when vddr falls to the v lvr level and remains at or below that level.in the control register, lvde and lvdre bits must be at logic 1 to enable the lvd module and to enable lvd resets. false reset protections the lvd module has two false reset protections. 1. the lvd module contains a hysteresis circuit to reduce the possibility of false resets due to power supply noise. 2. the vddr pin level is digitally filtered to reduce false resets due to power supply noise. in order for the lvd module to reset the mcu, vddr must fall to the v lvr level and remains at or below that level for 17 or more consecutive bus clock cycles. vddr must be above v lvrr for only one bus clock cycle to bring the mcu out f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
low-voltage detector (lvd) mc9s12t64revision 1.1.1 192 low-voltage detector (lvd) motorola of reset. interrupts the lvd module does not generate interrupt requests. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola flash eeprom 64k 193 flash eeprom 64k contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 module memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 flash security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 overview this section describes the flash eeprom module which is a 64k byte flash (non-volatile) memory. the flash array is organized as 2 blocks of 32k bytes. each block is organized as 512 rows of 64 bytes. the flash block? erase sector size is 8 rows (512 bytes). the flash memory may be read as either bytes, aligned words or misaligned words. read access time is one bus cycle for byte and aligned word, and two bus cycles for misaligned words. program and erase functions are controlled by a command driven interface. both sector erase and mass erase of the entire 64k byte flash block are supported. an erased bit reads ? and a programmed bit reads f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 194 flash eeprom 64k motorola ?? the high voltage required to program and erase is generated internally by on-chip charge pumps. all flash blocks can be programmed or erased at the same time, however it is not possible to read from a flash block while it is being erased or programmed. the flash is ideal for program and data storage for single-supply applications allowing for field reprogramming without requiring external programming voltage sources. warning: a word must be erased before being programmed. cumulative programming of bits within a word is not allowed. glossary banked register a register operating on one flash block which shares the same register address as the equivalent registers for the other flash blocks. the active register bank is selected by a bank-select bit in the unbanked register space. common register a register which operates on all flash blocks. command sequence a three-step mcu instruction sequence to program, erase or erase-verify a flash block. erase sector 512 bytes of flash (8 rows of 32 words) flash block 32k byte flash macro organized as 16k by 16bit words. includes high voltage generation and parametric test features. flash module includes bus interface, command control and two flash blocks of 32k bytes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k features mc9s12t64revision 1.1.1 motorola flash eeprom 64k 195 flash page 16k bytes of flash located in address range $0000?3fff, $4000?7fff, $8000?ffff or $c000?ffff. flash super user mode the flash super user mode allows the user to use erasing/programming sequences with faddr/fdata registers. unbanked register a register which operates on all flash blocks. features 64k bytes of flash memory comprising two 32k byte blocks each block in the flash module can be read, programmed or erased concurrently. automated program and erase algorithm. interrupts on flash command completion and command buffer empty. fast sector erase and word program operation. 2-stage command pipeline. flexible protection scheme for protection against accidental program or erase. single power supply program and erase. security feature. modes of operation secured mode the flash module provides the necessary security information to the rest of the chip. this information is stored within a byte in the flash block 0 ($ff0f). this byte is read automatically after each reset and stored in a volatile register - fsec. this information also protects the flash f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 196 flash eeprom 64k motorola module from intrusive reads via the external bus interface or the background debug mode. the customer can disable the security by executing a mass erase command or by providing a 64 bit key. flash super user mode when in flash super user mode faddr (faddrhi and faddrlo) and fdata (fdatahi and fdatalo) registers can be used to program flash array area which is overlapped by the calram. refer to section calram 2k in page 235 for details. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k block diagram mc9s12t64revision 1.1.1 motorola flash eeprom 64k 197 block diagram figure 22 flash 64k block diagram flash eeprom 64k oscillator clock divider clock command interface command pipelines comm2 command complete interrupt command buffer empty interrupt common eeclk addr2 data2 comm1 addr1 data1 flash-0 array 16k * 16 bits row0 row1 row512 flash-1 array 16k * 16 bits row0 row1 row512 flash 0-1 registers banked registers protection security f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 198 flash eeprom 64k motorola external pin descriptions this module contains no signals that connect off-chip. module memory map figure 23 shows the flash memory map in normal modes. figure 24 shows the flash memory map in special modes. the hcs12 architecture places the flash memory address between $0000 and $ffff. shown within the blocks are a protection/options field and user defined flash protected sectors. the fpopen bit in the fprot register (see page 211 ) can globally protect the entirety of the memory block. however, two protected areas in each block, one starting from the flash starting block address (called lower) towards higher addresses and the other one growing downward from the flash block end address (called higher) can be activated. the high flash block is mainly targeted to hold the boot loader code since it covers the vector space. all the other areas may be used to keep critical parameters. the flash module register space covers the addresses initrg (base address) + $100 to initrg + $10f. flash data memory map in normal modes in normal modes, two blocks are mapped to fixed address since the ppage register always points to the page $3c and cannot be changed. see table 35 and figure 23 . table 35 flash memory mapping in normal modes mcu address range page flash block flash relative address $0000?3fff $3d 1 $0000?3fff $4000?7fff $3e 1 $4000?7fff $8000?bfff $3c (ppage) 0 $8000?bfff $c000?ffff $3f 0 $c000?ffff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k module memory map mc9s12t64revision 1.1.1 motorola flash eeprom 64k 199 figure 23 flash data memory map in normal modes $0000 flash control register (initrg +$100?10f) $4000 $8000 $c000 flash protect low area 0.5k, 1k, 2k, 4k bytes flash protect high area 2k, 4k, 8k, 16k bytes $ffff $ff00?ff0f, access key, protection, security $3f $3e $3c block page 1 0 $3d and $3e $3c and $3f flash protect low area 0.5k, 1k, 2k, 4k bytes flash protect high area 2k, 4k, 8k, 16k bytes $3d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 200 flash eeprom 64k motorola flash data memory map in special modes in special modes, the blocks will be mapped through an address window from $8000?bfff in 16k byte blocks. the additional address bits are located in the ppage register. see table 36 and figure 24 . table 36 flash memory mapping in special modes mcu address range page flash block flash relative address $0000?3fff $3d 1 $0000?3fff $4000?7fff $3e 1 $4000?7fff $8000?bfff ppage=$3d 1 $0000?3fff ppage=$3e 1 $4000?7fff ppage=$3c 0 $8000?bfff ppage=$3f 0 $c000?ffff $c000?ffff $3f 0 $c000?ffff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k module memory map mc9s12t64revision 1.1.1 motorola flash eeprom 64k 201 figure 24 flash data memory map in special modes $0000 flash control register (initrg +$100?10f) $4000 $8000 $c000 flash protect high area 2k, 4k, 8k, 16k bytes $ffff $ff00?ff0f, access key, protection, security $3f block page 1 0 $3d and $3e $3c and $3f flash protect low area 0.5k, 1k, 2k, 4k bytes flash protect high area 2k, 4k, 8k, 16k bytes 16k bytes paged memory $3e $3d $3c $3f block 1 block 0 $3f $3e $3d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 202 flash eeprom 64k motorola flash protection option fields security information that allows the mcu to prevent intrusive access to the flash module is stored in the flash block? flash protection/options field. a description of the 16 bytes used in this field is given in table 37 . the flash module has hardware interlocks which protect data from accidental corruption by sectors as shown in table 38 . flash block 0 has a protected sector located at the higher address end, just below $ffff, and another protected sector located at the lower address end, starting at address $8000. flash block 1 has a protected sector located at the higher address end, just below $7fff, and another protected sector located at the lower address end, starting at address $0000.the high address protected sectors in each flash block can be sized from 2k table 37 flash protection/security field address size description $ff00?ff07 8 backdoor comparison key $ff08?ff0b 4 reserved $ff0c 1 protection byte for flash block 1 (the byte is loaded into fprot banked register during reset) $ff0d 1 protection byte for flash block 0 (the byte is loaded into fprot banked register during reset) $ff0e 1 reserved $ff0f 1 security byte (the byte is loaded into fsec register during reset) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k module memory map mc9s12t64revision 1.1.1 motorola flash eeprom 64k 203 bytes to 16k bytes. the low address protected sectors in each flash block can be sized from 0.5k bytes to 4k bytes. note: the use of backdoor keys $0000 and $ffff is not allowed. table 38 memory map summary in normal modes mcu address range page protectable low range protectable high range flash block $0000-$7fff $3d $0000-$01ff n.a. 1 $0000-$03ff $0000-$07ff $0000-$0fff $3e n.a. $7800-$7fff $7000-$7fff $6000-$7fff $4000-$7fff $8000-$ffff $3c $8000-$81ff n.a. 0 $8000-$83ff $8000-$87ff $8000-$8fff $3f n.a. $f800-$7fff $f000-$7fff $e000-$7fff $c000-$7fff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 204 flash eeprom 64k motorola register memory map the flash module also contains a set of 16 control and status registers located in address space initrg + $100 to initrg + $10f. in order to accommodate two flash blocks with a minimum register address space, a set of registers (initrg+$104 to initrg+$10b) is duplicated in two banks. the active bank is selected by the bksel bit in the unbanked flash configuration register (fcnfg). a summary of these registers is given in figure 25 . register name bit 7 654321 bit 0 addr. offset fclkdiv read: fdivld prdiv8 fdiv5 fdiv4 fdiv3 fdiv2 fdiv1 fdiv0 $0100 write: fsec read: keyen nv6 nv5 nv4 nv3 nv2 sec1 sec0 $0101 write: ftstmod read: reads to this register return unpredictable values in normal modes. $0102 write: fcnfg read: cbeie ccie keyacc 0000 bksel $0103 write: unbanked registers banked registers fprot read: fpopen nv6 fphdis fphs1 fphs0 fpldis fpls1 fpls0 $0104 write: fstat read: cbeif ccif pviol accerr 0 blank 0 0 $0105 write: fcmd read: 0 cmdb6 cmdb5 00 cmdb2 0 cmdb0 $0106 write: reserved for factory test read: reads to this register return unpredictable values. $0107 write: faddrhi read: 0 ab15 ab14 ab13 ab12 ab11 ab10 ab9 $0108 write: faddrlo read: ab8 ab7 ab6 ab5 ab4 ab3 ab2 ab1 $0109 write: = unimplemented or reserved figure 25 flash control register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k module memory map mc9s12t64revision 1.1.1 motorola flash eeprom 64k 205 note: register address = base address (initrg) + address offset fdatahi read: dhi7 dhi6 dhi5 dhi4 dhi3 dhi2 dhi1 dhi0 $010a write: fdatalo read: dlo7 dlo6 dlo5 dlo4 dlo3 dlo2 dlo1 dlo0 $010b write: reserved read: 00000000 $010c write: reserved read: 00000000 $010d write: reserved read: 00000000 $010e write: reserved read: 00000000 $010f write: register name bit 7 654321 bit 0 addr. offset = unimplemented or reserved figure 25 flash control register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 206 flash eeprom 64k motorola register descriptions note: all bits of all registers in this module are completely synchronous to internal clocks during a register read. fclkdiv ?flash clock divider register the fclkdiv register is used to control timed events in program and erase algorithms. this register is unbanked. read: anytime write: once in normal mode, anytime in special mode note: access to this register during flash super user mode (fsum=1) will cause the accerr bit set. fdivld ?flash clock divider loaded 1 = register has been written to since the last reset. 0 = register has not been written. prdiv8 ?enable prescaler by 8 1 = enables a prescaler by 8, to divide the flash module input oscillator clock before feeding into the fclkdiv divider. 0 = the input oscillator clock is directly fed into the fclkdiv divider fdiv[5:0] ?flash clock divider bits the combination of prdiv8 and fdiv[5:0] effectively divides the flash module input oscillator clock down to a frequency of 150-200 khz. the maximum divide ratio is 512. table 35 show some fclkdiv settings. please refer to writing the fclkdiv register in page 220 for details about how to calculate these values. address offset: $0100 bit 7 6 5 4 3 2 1 bit 0 read: fdivld prdiv8 fdiv5 fdiv4 fdiv3 fdiv2 fdiv1 fdiv0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 207 table 39 example fclkdiv settings oscillator frequency bus clock prdiv8 fdiv[5:0] fclk frequency fclk period 1.0mhz 1.0 mhz 2.0 mhz 4.0 mhz 8.0 mhz 16.0 mhz 0 000101 166.66 khz 6us 2.0mhz 1.0 mhz 0 001011 166.66 khz 6us 2.0 mhz 4.0 mhz 8.0 mhz 16.0 mhz 0 001010 181.81 khz 5.5us 4.0mhz 2.0 mhz 0 010101 181.81 khz 5.5us 4.0 mhz 8.0 mhz 16.0 mhz 0 010100 190.47 khz 5.25us 16.0 mhz 8.0 mhz 16.0 mhz 1 001010 181.81 khz 5.5us 32.0 mhz 16.0 mhz 1 010100 190.47 khz 5.25us f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 208 flash eeprom 64k motorola fsec ?flash security register this fsec register holds all bits associated with the device security. this register is unbanked. read: anytime write: never note: access to this register during flash super user mode (fsum=1) will cause the accerr bit set. the fsec register is loaded from the flash protection/options field byte at $ff0f during the reset sequence, indicated by ? in the reset row of the register description. keyen ?enable backdoor key to security 1 = backdoor to flash is enabled 0 = backdoor to flash is disabled nv[6:2] ?non volatile flag bits these 5 bits are available to the user as non-volatile flags. sec[1:0] ?memory security bits the sec[1:0] bits define the security state of the device as shown in table 40 . if the flash is unsecured using the backdoor key access, the sec bits are forced to 10. address offset: $0101 bit 7 6 5 4 3 2 1 bit 0 read: keyen nv6 nv5 nv4 nv3 nv2 sec1 sec0 write: reset: f f f f f f f f = reserved or unimplemented table 40 security states sec[1:0] description 00 secured 01 secured 10 unsecured 11 secured f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 209 the security function in the flash module is described in page 231 . ftstmod ?flash test mode register the unbanked ftstmod register is used primarily to control the flash test modes. in normal modes, all bits in the ftstmod register read zero and are not writable. the wrall bit is writable only in special modes. the purpose of this bit is to launch a command on all blocks in parallel. this can be useful for mass erase and blank check operations. all other bits in this register must be written to zero at all times. wrall ?rite to all register banks. if this bit is set, all banked registers sharing the same address will be written simultaneously. 1 = write to all register banks. 0 = write only to the bank selected via bksel. fcnfg ?flash configuration register the fcnfg register enables the flash interrupts, gates the security backdoor writes and selects the register bank to be operated on. this register is not banked. read: anytime write: anytime address offset: $0102 bit 7 6 5 4 3 2 1 bit 0 read: n/a n/a n/a wrall 000 n/a write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented address offset: $0103 bit 7 6 5 4 3 2 1 bit 0 read: cbeie ccie keyacc 0000 bksel write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 210 flash eeprom 64k motorola note: access to this register during flash super user mode (fsum=1) will cause the accerr bit set. cbeie ?command buffer empty interrupt enable the cbeie bit enables the interrupts in case of an empty command buffer in the flash. 1 = an interrupt will be requested whenever the cbeif flag is set 0 = command buffer empty interrupts disabled ccie ?command complete interrupt enable the ccie bit enables the interrupts in case of all commands being completed in the flash. 1 = an interrupt will be requested whenever the ccif flag is set 0 = command complete interrupts disabled keyacc ?enable security key writing 1 = writes to flash array are interpreted as keys to open the backdoor. reads of the flash array return invalid data 0 = flash writes are interpreted as the start of a program or erase sequence. bksel ?register bank select the bksel bit is used to select one among all available register banks. the register bank associated with flash 0 is the default out of reset. the bank selection is according to table 41 . table 41 register bank selects bksel selected register bank 0 flash block 0 1 flash block 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 211 fprot flash protection register the fprot register defines which flash sectors are protected against program or erase. this register is banked. the fprot register is readable in normal and special modes. bit nv6 is not writable. fpopen, fphdis and fpldis bits in the fprot register can only be written to the protected state (i.e. 0). fpls[1:0] can be written anytime until bit fpldis is cleared. fphs[1:0] bits can be written anytime until bit fphdis is cleared. if the fpopen bit is cleared, then the state of the fphdis, fphs[1:0], fpldis and fpls[1:0] bits is irrelevant. the fprot register is loaded from flash array during reset according to the following table. note: access to this register during flash super user mode (fsum=1) will cause the accerr bit set. to change the flash protection that will be loaded on reset, the upper sector of flash must be unprotected, then the flash protect/security byte located as described in table 37 must be written to. a protected flash sector is disabled by the bits fphdis and fpldis while the size of the protected sector is defined by fphs[1:0] and fpls[1:0] in the fprot register. address offset: $0104 bit 7 6 5 4 3 2 1 bit 0 read: fpopen nv6 fphdis fphs1 fphs0 fpldis fpls1 fpls0 write: reset: f f f f f f f f = reserved or unimplemented table 42 loading of the protection register from flash flash address protection byte for $ff0d flash block 0 $ff0c flash block 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 212 flash eeprom 64k motorola trying to alter any of the protected areas will result in a protect violation error and bit pviol will be set in the flash status register fstat. a mass erase of a whole flash block is only possible when protection is fully disabled by setting fpldis and fphdis bits. fpopen ?opens the flash for program or erase. 1 = the flash sectors not protected are enabled for program or erase. 0 = the whole flash array is protected. in this case the fphdis, fphs[1:0], fpldis and fpls[1:0] bits within the protection register are don? care. fphdis ?flash protection higher address range disable the fphdis bit determines whether there is a protected area in the higher space of the flash address map. 1 = protection disabled 0 = protection enabled fphs[1:0] ?flash protection higher address size the fphs[1:0] bits determine the size of the protected sector. refer to table 43 . fpldis ?flash protection lower address range disable the fpldis bit determines whether there is a protected sector in the lower space of the flash address map. 1 = protection disabled 0 = protection enabled table 43 higher address range protection fphs[1:0] protected address range protected size (bytes) block 0 block 1 00 $f800?ffff $7800?7fff 2k 01 $f000?ffff $7000?7fff 4k 10 $e000?ffff $6000?7fff 8k 11 $c000?ffff $4000?7fff 16k f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 213 fpls[1:0] ?flash protection lower address size the fpls[1:0] bits determine the size of the protected sector. refer to table 44 . nv6 ?non volatile flag bit this bit is available as non-volatile flag. fstat ?flash status register the fstat register defines the flash state machine command status and flash array access, protection and blank verify status. this register is banked. read: anytime write: anytime to clear flags cbeif ?command buffer empty interrupt flag the cbeif flag indicates that the address, data and command buffers are empty so that a new command sequence can be started. the cbeif flag is cleared by writing a ??to cbeif. writing a ??to the table 44 lower address range protection fpls[1:0] protected address range protected size (bytes) block 0 block 1 00 $8000?81ff $0000?01ff 512 bytes 01 $8000?83ff $0000?03ff 1k 10 $8000?87ff $0000?07ff 2k 11 $8000?8fff $0000?0fff 4k address offset: $0105 bit 7 6 5 4 3 2 1 bit 0 read: cbeif ccif pviol accerr 0 blank 00 write: reset: 1 1 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 214 flash eeprom 64k motorola cbeif flag has no effect on cbeif but sets accerr, which can be used to abort a command sequence. this bit, cbeif, is used together with the enable bit cbeie, to generate the interrupt request. 1 = buffers are ready to accept a new command. 0 = buffers are full. ccif ?command complete interrupt flag the ccif flag indicates that there are no more commands pending. the ccif flag is cleared when cbeif is clear and sets automatically upon completion of all active and pending commands. the ccif flag does not set when an active commands completes and a pending command is fetched from the command buffer. writing to the ccif flag has no effect. this bit, ccif, is used together with the enable bit ccie, to generate the interrupt request. 1 = all commands are completed 0 = command in progress pviol ?protection violation the pviol flag indicates an attempt was made to program or erase an address in a protected flash memory area. the pviol flag is cleared by writing a ? to pviol. writing a ? to the pviol flag has no effect on pviol. while pviol is set, it is not possible to launch another command. refer to pviol flag set condition in page 229 for more information. 1 = a protection violation has occurred. 0 = no failure accerr ?flash access error the accerr flag indicates an illegal access to the flash array. this can be either a violation of the command sequence, issuing an illegal command (illegal combination of the cmdbx bits in the fcmd register) or the execution of a cpu stop instruction while a command is executing (ccif=0). the accerr flag is cleared by writing a ??to accerr. writing a ??to the accerr flag has no effect on accerr.while accerr is set, it is not possible to launch another command. refer to accerr flag set condition in page 228 1 = access error has occurred. 0 = no failure f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 215 blank ?array has been verified as erased the blank flag indicates that an erase verify command has checked the flash block and found it to be blank. the blank flag is cleared by hardware when cbeif is cleared as part of a new valid command sequence. writing to the blank flag has no effect on blank. 1 = flash block verifies as erased. 0 = if an erase verify command has been requested, and the ccif flag is set, then a zero in blank indicates the block is not erased f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 216 flash eeprom 64k motorola fcmd ?flash command register the fcmd register defines the flash commands. this register is banked. read: anytime write: only writable during a command sequence cmdb6, 5, 2 and 0 valid flash user mode commands are shown in table 45 . any command other than those mentioned in table 45 sets the accerr bit in the fstat register. address offset: $0106 bit 7 6 5 4 3 2 1 bit 0 read: 0 cmdb6 cmdb5 00 cmdb2 0 cmdb0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented table 45 valid user mode commands command meaning remarks $05 erase verify verify all memory bytes of the flash block are erased. if the array is erased the blank bit will set in the fstat register upon command completion. $20 memory program program a word (two bytes) $40 sector erase erase 512 bytes of flash $41 mass erase erase all the flash array of the flash block. a mass erase of the full block is only possible when fpldis, fphdis and fpopen are set. other illegal generate an access error f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 217 faddr ?16-bit address register faddrhi and faddrlo are the flash address registers. these registers are banked. flash address high (faddrhi) register flash address low (faddrlo) register read: only in the flash super user mode. in user modes, the faddr (faddrhi, faddrlo) register reads zeros. write: only in the flash super user mode. for sector erase, the mcu address bits ab[8:0] are don? care. for mass erase, any address within the block is valid to start the command. ab[15:1] ?64k byte relative address of flash array these address bits are used in the program/erase sequence in the flash super user mode. refer to low power options in page 229 for the program/erase sequence. the mapping of the address information in the faddr register to the flash relative address is shown in figure 26 . address offset: $0108 bit 7 6 5 4 3 2 1 bit 0 read: 0 ab15 ab14 ab13 ab12 ab11 ab10 ab9 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented address offset: $0109 bit 7 6 5 4 3 2 1 bit 0 read: ab8 ab7 ab6 ab5 ab4 ab3 ab2 ab1 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 218 flash eeprom 64k motorola note: the address bit ab0 is not stored, since no byte access from this register is possible. for sector erase, the mcu address bits ab[8:0] are don? care. for mass erase, any address within the block is valid to start the command. figure 26 faddr address mapping to flash relative address faddrlo[7:0] faddrhi[6:0] 0 faddr register flash relative address 0 faddrlo[7:0] faddrhi[6:0] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k register descriptions mc9s12t64revision 1.1.1 motorola flash eeprom 64k 219 fdata ?flash 16-bit data buffer and register fdatahi and fdatalo are the flash data registers. these registers are banked. flash data high (fdatahi) register flash data low (fdatalo) register read: only in the flash super user mode. in user modes, all fdata bits read zero write: only in the flash super user mode. all fdata(fdatahi and fdatalo) bits read zero and are not writable when the flash eeprom module is not in the flash super user mode. dhi[7:0] and dlo[7:0] ?16-bit data register in flash super user mode, all fdata bits are readable and writable when writing to an address within the flash address range. address offset: $010a bit 7 6 5 4 3 2 1 bit 0 read: dhi7 dhi6 dhi5 dhi4 dhi3 dhi2 dhi1 dhi0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented address offset: $010b bit 7 6 5 4 3 2 1 bit 0 read: dlo7 dlo6 dlo5 dlo4 dlo3 dlo2 dlo1 dlo0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 220 flash eeprom 64k motorola functional description program and erase operation write and read operations are both used for the program and erase algorithms described in this section. these algorithms are controlled by a state machine whose timebase fclk is derived from the oscillator clock via a programmable divider. the command register as well as the associated address and data registers operate as a buffer and a register (2-stage fifo), so that a new command along with the necessary data and address can be stored to the buffer while the previous command is still in progress. this pipelined operation allows a time optimization when programming more than one word on a specific row, as the high voltage generation can be kept on in between two programming commands. the pipelined operation also allows a simplification of command launching. buffer empty as well as command completion are signalled by flags in the flash status register. interrupts for the flash will be generated if enabled. the next four subsections describe: how to write the fclkdiv register. the write sequences used to program, erase and erase-verify the flash. valid flash commands. errors resulting from illegal flash operations. writing the fclkdiv register prior to issuing any program or erase command, it is first necessary to write the fclkdiv register to divide the oscillator down to within the 150khz to 200khz range.the program and erase timings are also a function of the bus clock, such that the fclkdiv determination must take this information into account. if we define: fclk as the clock of the flash timing control block tbus as the period of the bus clock int(x) as taking the integer part of x (e.g. int(4.323)=4), then fclkdiv register bits prdiv8 and fdiv[5:0] are to be set as described in figure 27 . for example, if the oscillator clock frequency is 4mz and the bus clock is 25mhz, fclkdiv bits fdiv[5:0] should be set to 20 (010100) and bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k functional description mc9s12t64revision 1.1.1 motorola flash eeprom 64k 221 prdiv8 set to 0. the resulting fclk is then 190khz. as a result, the flash algorithm timings are increased over optimum target by: note: command execution time will increase proportionally with the period of fclk. warning: because of the impact of clock synchronization on the accuracy of the functional timings, programming or erasing the flash cannot be performed if the bus clock runs at less than 1 mhz. programming or erasing the flash with an input clock < 150khz should be avoided. setting fclkdiv to a value such that fclk < 150khz can destroy the flash due to overstress. setting fclkdiv to a value such that (1/fclk+1/(bus clock) ) < 5 s can result in incomplete programming or erasure of the memory array cells. if the fclkdiv register is written, the bit fdivld is set automatically. if this bit is zero, the register has not been written since the last reset. program and erase commands will not be executed if this register has not been written to. ? () ? ? = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 222 flash eeprom 64k motorola figure 27 prdiv8 and fdiv bits determination procedure (1/fclk + 1/busclock) [ s] > 5 and fclk > 0.15mhz ? fdiv[5:0]> 4? prdiv8=1 yes no prdiv8=0 (reset) 12.8mhz? fclk=(prdclk)/(1+fdiv[5:0]) prdclk=oscillator clock prdclk=oscillator clock/8 prdclk[mhz]*(5+(1/busclock) [ s] ) no fdiv[5:0] =prdclk[mhz]*(5+(1/busclock) [ s] ) - 1 yes start tbus < 1 s? an integer? fdiv[5:0] =int(prdclk[mhz]*(5+(1/busclock)[ s])) end yes no program/erase impossible yes no program/erase impossible no try to increase busclock yes oscillator clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k functional description mc9s12t64revision 1.1.1 motorola flash eeprom 64k 223 program and erase sequence in normal mode a command state machine is used to supervise the write sequencing for program and erase. the erase-verify command follows the same flow. before starting a command sequence, it is necessary to verify that there is no pending access error or protection violation (the accerr and pviol flags should be cleared in the fstat register). it is then required to set the ppage register when in special modes. the procedure is as follows: 1. verify that all accerr and pviol flags in the fstat register are cleared in all banks. this requires to check the fstat content for all combinations of the bksel bit in the fcnfg register. 2. write to bit bksel in the fcnfg register to select the bank of registers corresponding to the 32k flash block to be programmed or erased (i.e. flash 0 or 1). see figure 23 , 24 for further details. 3. in special modes, write to the core ppage register ($x030) to select one of the 16k pages to be programmed if programming in the $8000?bfff address range. there is no need to set ppage when programming in the $4000-$7fff or $c000-$ffff address ranges or when operating in normal modes. after this possible initialization step the cbeif flag should be tested to ensure that the address, data and command buffers are empty. if so, the program/erase command write sequence can be started. the following 3-step command write sequence must be strictly adhered to and no intermediate writes to the flash module are permitted between the 3 steps. it is possible to read any flash register during a command sequence. the command sequence is as follows: 1. write the aligned data word (16-bits) to be programmed to the valid flash address space between $0000 and $ffff. the address and data will be stored in internal buffers. for program, all address bits are valid. for erase, the value of the data bytes is don? care. for mass erase the address can be anywhere in the available address space of the 32k byte block to be erased. for sector erase the address bits 8:0 are ignored for the flash. 2. write the program or erase command to the command buffer. these commands are listed in table 45 . 3. clear the cbeif flag by writing a ? to it to launch the command. when the cbeif flag is cleared, the ccif flag is cleared by hardware indicating that the command was successfully launched. the accerr and pviol flags should be tested to f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 224 flash eeprom 64k motorola ensure the command sequence was valid. the cbeif flag will be set again indicating the address, data and command buffers are ready for a new command sequence to begin. the completion of the command is indicated by the ccif flag setting (command complete interrupt flag). the ccif flag only sets when all active and pending commands have been completed. note: the command state machine will flag errors in program or erase write sequences by means of the accerr (access error) and pviol (protection violation) flags in the fstat register. an erroneous command write sequence will abort and set the appropriate flag. if set, the user must clear the accerr or pviol flags before commencing another command write sequence. by writing a 0 to the cbeif flag the command sequence can be aborted after the word write to the flash address space or after writing a command to the fcmd register and before the command is launched. writing a ? to the cbeif flag in this way will set the accerr flag. a summary of the program algorithm is shown in figure 28 . for the erase algorithm, the user writes either a mass or sector erase command to the fcmd register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k functional description mc9s12t64revision 1.1.1 motorola flash eeprom 64k 225 figure 28 example program algorithm write: register fclkdiv read: register fclkdiv bit fdivld set? write: array address and write: register fcmd program command $20 write: register fstat yes no clear bit cbeif $80 cbeif set? bit yes clock register written check 1. 2. 3. clear bit accerr $10 write: register fstat no yes no protection violation check access error check read: register fstat ccif set? bit no no address, data, command buffer empty check next write? yes finish no program data clear bit pviol $20 write: register fstat yes pviol set? bit accerr set? bit bit polling for command completion check read: register fstat yes note: command sequence aborted by writing $00 to fstat register. note: command sequence aborted by writing $00 to fstat register. read: register fstat are accerr or all flash banks clear accerr and/or pviol no no yes yes checked ? pviol set? change bksel start f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 226 flash eeprom 64k motorola program and erase sequence in flash super user mode the flash eeprom module requires that the user program/erase operations be allowed via programming the address (faddr) and data (fdata) registers. the operation is controlled via the fsum bit in the calcfg register (refer to page 241 ). super user operation is indicated when this bit is set. when fsum = 1, a register write to the address register will start the monitor state machine for the operation. during this sequence the address presented on the core data bus is monitored for protection violation and operation sequence is monitored for access errors. the access error is set if the strict sequence of, address register access followed by the data register access is not observed. address alignment is also checked for access error indications. the operation sequence is shown below: 1. write the address word to be programmed to the valid flash address space, shown in table 35 , to the faddr register. the address will be stored in internal buffers. 2. write the data word to the fdata register. the data will be stored in internal buffers. note: for program, all address bits are valid. for erase, the value of the data bytes is don? care. for mass erase, the address can be anywhere in the available address space of the block to be erased. for sector erase the address bits[8:0] are ignored for the flash. 3. write the program or erase command to the command buffer. these commands are described in fcmd ?flash command register and listed in table 45 in page 216 . 4. clear the cbeif flag by writing a ? to it to launch the command. when the cbeif flag is cleared, the ccif flag is cleared by hardware indicating that the command was successfully launched. the cbeif flag will be set again indicating the address, data and command buffers are ready for a new command sequence to begin. a summary of the program algorithm is shown in figure 29 . for the erase algorithm, the user writes either a mass or sector erase command to the fcmd register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k functional description mc9s12t64revision 1.1.1 motorola flash eeprom 64k 227 write: register fclkdiv read: register fclkdiv bit fdivld set? write: array address to write: register fcmd program command $20 write: register fstat yes no clear bit cbeif $80 cbeif set? bit yes clock register written check 1. 2. 3. clear bit accerr $10 write: register fstat no yes no protection violation check access error check read: register fstat ccif set? bit no no address, data, command buffer empty check next write? finish faddr register clear bit pviol $20 write: register fstat yes pviol set? bit accerr set? bit bit polling for command completion check read: register fstat yes note: command sequence aborted by writing $00 to fstat register. note: command sequence aborted by writing $00 to fstat register. write: array data to fdata register 4. write: register fcnfg select bksel write: register calcfg (1) set bit fsum $80 enter flash write: register calcfg (1) clear bit fsum $00 exit flash (1) the register calcfg is in calram. super user mode super user mode yes no are accerr or all flash banks clear accerr and/or pviol no yes checked ? pviol set? yes no change bksel read: register fstat start figure 29 example program algorithm in flash super user mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 228 flash eeprom 64k motorola valid flash commands figure 45 in page 216 summarizes the valid flash user commands. also shown are the effects of the commands on the flash warning: it is not permitted to program a flash word without first erasing the sector in which that word resides. illegal flash operations this subsection describes the conditions that set accerr and pviol flags. accerr flag set condition the accerr flag will be set during the command write sequence if any of the following illegal operations are performed, causing the command write sequence to immediately abort: 1. writing to the flash address space before initializing fclkdiv. 2. writing to the flash address space in the range $8000?bfff when ppage register does not select a 16k bytes page in the flash block selected by the bksel bit in special modes. 3. writing to the flash address space $0000?7fff or $8000?ffff with the bksel bit in the fcnfg register not selecting the flash block in normal modes. 4. writing a misaligned word or a byte to the valid flash address space. 5. writing to the flash address space while cbeif is not set. 6. writing a second word to the flash address space before executing a program or erase command on the previously written word. 7. writing to any flash register other than fcmd after writing a word to the flash address space. 8. writing a second command to the fcmd register before executing the previously written command. 9. writing an invalid user command to the fcmd register in user mode. 10. writing to any flash register other than fstat (to clear cbeif) after writing to the command register fcmd. 11. the part enters stop mode and a program or erase command is in progress. the command is aborted and any pending command is killed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k low power options mc9s12t64revision 1.1.1 motorola flash eeprom 64k 229 12. when security is enabled, a command other than mass-erase or erase-verify originating from a non-secure memory or from the background debug mode is written to fcmd. 13. a ??is written to the cbeif bit in the fstat register. 14. violating the register write sequence (faddr followed by fdata) in flash super user mode. the accerr flag will not be set if any flash register is read during the command sequence. if the flash array is read during execution of an algorithm (i.e. ccif bit in the fstat register is low) the read will return non valid data and the accerr flag will not be set. if an accerr flag is set in any of the banked fstat registers, the command state machine is locked. it is not possible to launch another command on any block until the accerr flag is cleared. pviol flag set condition the pviol flag will be set during the command write sequence after the word write to the flash address space if any of the following illegal operations are performed, causing the command sequence to immediately abort: 1. writing a flash address to program in a protected area of the flash. 2. writing a flash address to erase in a protected area of the flash. 3. writing the mass erase command to fcmd while any protection is enabled. if a pviol flag is set in any of the banked fstat registers, the command state machine is locked. it is not possible to launch another command on any block until the pviol flag is cleared. low power options when the array or the registers are not being accessed clocking to the register block is shut off to save power. the only exceptions to this are f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 230 flash eeprom 64k motorola the flag bits in the fstat registers which are updated by internal state machines. run mode no special current saving modes available. wait mode when the mcu enters wait mode and any command is active (ccif = 0) the command will be completed. if enabled, interrupts can be used to wake the mcu out of wait mode. stop mode no low power options exist for this module in stop mode. if a command is active (ccif = 0) when the mcu enters the stop mode, the command will be aborted and the high voltage circuitry to the flash array will be switched off. ccif and accerr flags will be set. if commands are active in more than one block when stop occurs, then all the corresponding ccif and accerr flags will be set. upon exit from stop the cbeif flag is set and any pending command will not be executed. the accerr flag must be cleared before returning to normal operation. warning: as active commands are immediately aborted when the mcu enters stop mode, it is strongly recommended that the user does not use the stop command during program and erase execution. background debug mode in background debug mode (bdm), the fprot registers are writable. if the chip is unsecured then all flash commands listed in table 45 in 216 can be executed. in special single chip mode if the chip is secured then the only possible command to execute is mass erase. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k flash security mc9s12t64revision 1.1.1 motorola flash eeprom 64k 231 flash security the flash module provides the necessary security information to the rest of the chip. after each reset, the flash module determines the security state of the microcontroller as defined in section fsec flash security register in page 208 . the contents of the flash protection/options byte at $ff0f in the flash protection/options field must be changed directly by programming $ff0f when the device is unsecured and the higher address sector is unprotected. if the flash protection/options byte is left in the secure state, any reset will cause the microcontroller to return to the secure operating mode reset initialization out of reset the module holds core activity while the protection and security registers are loaded from flash 0. thereafter, the flash module is immediately accessible, operating in read mode. if a reset occurs while any command is in progress that command will be immediately aborted. the state of the word being programmed or the sector / block being erased is not guaranteed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 232 flash eeprom 64k motorola interrupts general this module can generate an interrupt when all commands are completed or the address, data and command buffers are empty. description of interrupt operation figure 30 shows the logic used for generating interrupt via the relevant block. this system uses the cbeif and ccif flags in combination with the enable bits cbie and ccie in addition to the bksel bit, to discriminate for the interrupt generation. by taking account of the possible selected bank, the system is prevented from generating false interrupts when the command buffer is empty in an unselected bank. figure 30 flash interrupt implementation. table 46 flash interrupt sources interrupt source interrupt flag local enable global (ccr) mask flash address, data and command buffers empty cbeif flash block 0 or 1 cbeie i bit all commands are completed ccif flash block 0 or 1 ccie i bit block0 cbeif block0 select block1 cbeif block1 select block0 ccif block0 select block1 ccif block1 select cbeie ccie flash interrupt request f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k interrupts mc9s12t64revision 1.1.1 motorola flash eeprom 64k 233 caution: when programming or erasing flash block 0 the interrupt vectors are not readable. therefore, it is not recommended to program or erase the flash block 0 with interrupts enabled. recovery from stop or wait the module can recover the part from wait, if the interrupts are enabled. there is no capability to recover from stop. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
flash eeprom 64k mc9s12t64revision 1.1.1 234 flash eeprom 64k motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola calram 2k 235 calram 2k contents glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 modes of operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 module memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 glossary calram module includes bus interface, calibration control and a 2k byte ram block. flash super user mode the flash super user mode allows the user to use erasing/programming sequences with faddr/fdata registers. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 236 calram 2k motorola overview the 2k byte calram (calibration ram) module can overlap with the flash eeprom array, and cpu can access data in the calram instead of in the flash eeprom array. during overlapping, the flash eeprom array can be erased or programmed by entering the flash super user mode. the calram may be read or written as either bytes, aligned words or misaligned words. for compatibility with flash eeprom, access time is one bus cycle for byte and aligned word accesses, and two bus cycles for misaligned word accesses. when the mcu is in the secured state and in the special single chip mode, reading the calram array returns $ffff for any word accesses or $ff for any byte accesses instead of returning actual values stored in the array. features 2k bytes of calram 2k byte calibration block over flash eeprom access cycle compatible to flash eeprom flash eeprom erase or program possible while the calram overlaps with the flash eeprom re-mappable to any 2k byte boundary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k modes of operations mc9s12t64revision 1.1.1 motorola calram 2k 237 modes of operations secured mode the flash module provides the necessary security information to the rest of the chip. this information is stored within a byte in the flash block 0. this byte is read automatically after each reset and stored in a volatile register in the flash module. this information also protects the calram module from intrusive reads via the external bus interface or the background debug mode. run mode normal mode of operation. wait mode the calram modules operates normally during wait mode if the bus clock is enable. stop mode all clocks are stopped. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 238 calram 2k motorola block diagram figure 31 calram 2k byte block diagram calram block 2k bytes module bus interface hcs12 bus control registers flash eeprom module flash super user mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k external pin descriptions mc9s12t64revision 1.1.1 motorola calram 2k 239 external pin descriptions this module does not have external pins relevant for the user. module memory map overview the memory data is accessible in the address range $1000 - $17ff after reset and can be re-mapped to any 2k byte boundary within the mcu address space. the calram module contains a control register in the same address space initrg +$0fc - initrg +$0ff. data memory map calram array can be mapped to any 2k byte boundary within the 64k byte address space. the calram array address can be changed anytime through the initcrm register. figure 32 calram data memory map $0000 $ffff mappable to any 2k byte 64k byte address space 2k bytes calram boundary (re-mappable) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 240 calram 2k motorola register memory map . note: register address = base address (initrg) + address offset register name bit 7 654321 bit 0 addr. offset calcfg read: fsum 0000000 $00fc write: reserved read: 00000000 $00fd- $00ff write: = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k register descriptions mc9s12t64revision 1.1.1 motorola calram 2k 241 register descriptions calcfg calibration configuration register read: anytime write: anytime the fsum bit is used to establish the operating mode for the flash module. setting this bit will put the flash module in the flash super user mode. fsum ?flash super user mode bit when this bit is cleared, the flash eeprom module enters in normal mode. when this bit is set, the flash eeprom module enters in flash super user mode and faddr (faddrhi and faddrlo) and fdata (fdatahi and fdatalo) registers can be used to program flash array area which is overlapped by the calram. see flash eeprom section in page 193 for more information. 1 = flash module is in flash super user mode 0 = flash module is in normal mode address offset: $00fc bit 7 654321 bit 0 read: fsum 0000000 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 242 calram 2k motorola functional description the calram is designed to replace data in the flash eeprom for calibration purposes without stopping the user? control program. this function is controlled by the register initcrm (see module mapping control (mmc) in page 121) and the calcfg register. calibration block specified by initcrm calram can be mapped to any 2k byte boundary within the 64k byte memory space. the cram[15:11] bits in the register initcrm are used to map the calram to a 2k byte boundary. these write-anytime bits have to be written in order to choose the calibration block area in the flash eeprom. since data in the calram array is undefined after reset, data may be written in the array before mapping to the calibration area to prevent reading unpredictable values. table 47 shows example calram mapping. there is another bit called cramon in the register initcrm. this write-anytime bit makes the calram array visible in the address specified by the cram bits. if this bit is set the calram is used, otherwise the flash memory is used. flash super user mode control the fsum bit in the register calcfg determines if the flash eeprom module enters the flash super user mode. when fsum is set, the flash table 47 example calram mapping cram[15:11] address 00000 $0000 ?$07ff 00001 $0800 ?$0fff 00010 $1000 ?$17ff ..... ..... 11101 $e800 ?$efff 11110 $f000 ?$f7ff 11111 $f800 ?$ffff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k functional description mc9s12t64revision 1.1.1 motorola calram 2k 243 eeprom module is in the flash super user mode and the faddr (faddrhi and faddrlo) and fdata (fdatahi and fdatalo) become visible in the memory map. these registers are used to erase or to program the flash eeprom array which is overlapped by the calram. if the user needs to erase or to program a flash eeprom block while the cpu is running, it is necessary to make sure that cpu is running from another flash eeprom block or from another memory (e.g. ram). during erasing or programming a flash eeprom block, the block cannot be read due to flash eeprom limitations. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 244 calram 2k motorola recommended calibration flow following flow is recommended to calibrate the 2k byte flash eeprom array area. it is assumed that this flow is executed after reset without initialization of the registers initcrm and calcfg. 1. copy a 2k byte block of data from the flash eeprom into the 2k byte calram array. figure 33 shows an example. this is the first step for calibration, but this step may be skipped when initialization for calibration block is not needed. the data to be calibrated in flash eeprom has to be located within the 2k byte area which is overlapped by the calram. figure 33 copy data from flash eeprom to calram 2k bytes $0000 $ffff data to be calibrated flash eeprom copy data from flash eeprom to calram block 1 flash eeprom block 0 2k bytes calram mcu control program is running from this block $8000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k functional description mc9s12t64revision 1.1.1 motorola calram 2k 245 2. initialize the cram[15:11] bits and set the cramon bit in the register initcrm to overlap the 2k byte calram array with the flash eeprom. figure 34 shows an example of how to map the calram over the flash eeprom. note: writes to the initcrm register take one cycle to go into effect. figure 34 map calram over flash eeprom 3. calibrate data in the calram the user can start to change data in the calram array for calibration purposes. $0000 $ffff flash eeprom calram is mapped over a 2k area of flash eeprom block 1 flash eeprom block 0 2k bytes calram mcu control program is running from this block $8000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 246 calram 2k motorola 4. set fsum in the register calcfg. after calibration is done, the fsum bit is written to erase and to program the flash eeprom. setting the fsum bit enables the flash super user mode and the faddr (faddrhi and faddrlo) and fdata (fdatahi and fdatalo) registers become visible in the memory map. erase/program sequences in the flash super user mode must be used, since writing calibration data area only causes the calram array to be written. see the erase/program sequence in the flash super user mode in page 229. note that during erasing/programming a flash eeprom block, the data contained into the correspondent block cannot be read regardless if it is been overlapped by the calram or not. figure 35 an example memory map when erase/program flash eeprom 5. erase data in the flash eeprom. $0000 $ffff flash eeprom remaining flash eeprom cannot be correctly read during erasing or block 1 flash eeprom block 0 2k bytes calram mcu control program is running from this block programming $8000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k functional description mc9s12t64revision 1.1.1 motorola calram 2k 247 6. program data contained in the calram with the flash eeprom. 7. clear fsum in the register calcfg and clear cramon in the register initcrm. after the fsum bit is cleared, the flash eeprom module exits the flash super user mode and the registers faddr and fdata become invisible in the memory map. when the cramon bit is cleared, the calram array disappears from the 64k byte address space and the calibrated data can be read from flash eeprom directly. figure 36 shows the memory map obtained after calibration. note: writes to the initcrm register take one cycle to go into effect. figure 36 remove calram from memory mapping 8. if needed, continue calibration by repeating from the step 2. $0000 $ffff flash eeprom calibrated data programmed into the flash eeprom is shown block 1 flash eeprom block 0 2k bytes calibrated data mcu control program is running from this block $8000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
calram 2k mc9s12t64revision 1.1.1 248 calram 2k motorola note: during flash program or erase, data cannot be read from a flash eeprom block that is under a erase or program operation. however, it is possible to read from a different block. for example: during erasing or programming the flash block 1, the flash block 1 should not be read while the flash block 0 could still be used for mcu control program storage. reset initialization all registers get set/reset asynchronously. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola port integration module (pim) 249 port integration module (pim) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 overview the port integration module establishes the interface between the peripheral modules and the i/o pins for all ports except a, b, e and k. ports a, b, e and k are handled by the hc12 multiplexed bus interface and described in multiplexed external bus interface (mebi) section on page 141, due to their tight link with the external bus interface and special modes. the 8-bit port associated with the atd is included in the atd module due to their sensitivity to electrical noise, requiring special care on routing and design. this section covers port t connected to the timer module, the serial port s associated with 2 sci and 1 spi module and port p connected to the pwm. each i/o pin is associated with a set of registers which configure items like input/output selection, drive strength reduction, and pull resistors enable and selection. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 250 port integration module (pim) motorola the port integration module is device dependant which is reflected in its naming. a standard port has the following minimum features: input/output selection 5v output drive with two selectable drive strength 5v digital and analog input input with selectable pull-up or pull-down device optional features: open drain for wired-or connections f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) block diagram mc9s12t64revision 1.1.1 motorola port integration module (pim) 251 block diagram figure 37 pim block diagram port t pt0 pt1 pt2 pt3 pt4 pt5 pt6 pt7 ect ioc0 ioc1 ioc2 ioc3 ioc4 ioc5 ioc6 ioc7 port p pp0 pp1 pp2 pp3 pp4 pp5 pp6 pp7 pwm pw0 pw1 pw2 pw3 pw4 pw5 pw6 pw7 port s ps0 ps1 ps2 ps3 ps4 ps5 ps6 ps7 rxd0 txd0 rxd1 txd1 miso mosi sck ss sci0 sci1 spi port integration ip-bus module f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 252 port integration module (pim) motorola external pin descriptions all ports start up as general purpose inputs on reset. table 48 port reset state and priority summary port reset states priority data direction pull mode red. drive wired-or mode inter- rupt t input hiz disabled n/a n/a ect > gpio s input pull-up disabled disabled n/a sci, spi > gpio p input hiz disabled n/a n/a pwm > gpio f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register map mc9s12t64revision 1.1.1 motorola port integration module (pim) 253 register map register name bit 7 654321 bit 0 addr. offset ptt read: ptt7 ptt6 ptt5 ptt4 ptt3 ptt2 ptt1 ptt0 $00e0 write: ptit read: ptit7 ptit6 ptit5 ptit4 ptit3 ptit2 ptit1 ptit0 $00e1 write: ddrt read: ddrt7 ddrt6 ddrt5 ddrt4 ddrt3 ddrt2 ddrt1 ddrt0 $00e2 write: rdrt read: rdrt7 rdrt6 rdrt5 rdrt4 rdrt3 rdrt2 rdrt1 rdrt0 $00e3 write: pert read: pert7 pert6 pert5 pert4 pert3 pert2 pert1 pert0 $00e4 write: ppst read: ppst7 ppst6 ppst5 ppst4 ppst3 ppst2 ppst1 ppst0 $00e5 write: reserved read: 00000000 $00e6 write: reserved read: 00000000 $00e7 write: pts read: pts7 pts6 pts5 pts4 pts3 pts2 pts1 pts0 $00e8 write: ptis read: ptis7 ptis6 ptis5 ptis4 ptis3 ptis2 ptis1 ptis0 $00e9 write: ddrs read: ddrs7 ddrs6 ddrs5 ddrs4 ddrs3 ddrs2 ddrs1 ddrs0 $00ea write: rdrs read: rdrs7 rdrs6 rdrs5 rdrs4 rdrs3 rdrs2 rdrs1 rdrs0 $00eb write: pers read: pers7 pers6 pers5 pers4 pers3 pers2 pers1 pers0 $00ec write: = unimplemented or reserved figure 38 pim9t64 register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 254 port integration module (pim) motorola note: register address = base address (initrg) + address offset ppss read: ppss7 ppss6 ppss5 ppss4 ppss3 ppss2 ppss1 ppss0 $00ed write: woms read: woms7 woms6 woms5 woms4 woms3 woms2 woms1 woms0 $00ee write: reserved read: 00000000 $00ef write: ptp read: ptp7 ptp6 ptp5 ptp4 ptp3 ptp2 ptp1 ptp0 $00f0 write: ptip read: ptip7 ptip6 ptip5 ptip4 ptip3 ptip2 ptip1 ptip0 $00f1 write: ddrp read: ddrp7 ddrp6 ddrp5 ddrp4 ddrp3 ddrp2 ddrp1 ddrp0 $00f2 write: rdrp read: rdrp7 rdrp6 rdrp5 rdrp4 rdrp3 rdrp2 rdrp1 rdrp0 $00f3 write: perp read: perp7 perp6 perp5 perp4 perp3 perp2 perp1 perp0 $00f4 write: ppsp read: ppsp7 ppsp6 ppsp5 ppsp4 ppsp3 ppsp2 ppsp1 ppsp0 $00f5 write: reserved read: 00000000 $00f6 write: reserved read: 00000000 $00f7 write: register name bit 7 654321 bit 0 addr. offset = unimplemented or reserved figure 38 pim9t64 register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 255 register descriptions the following table summarizes the effect on the various configuration bits, data direction (ddr), output level (i/o), reduced drive (rdr), pull enable (pe), and polarity select (ps) for the ports. the configuration bit ps is used for the purposing of selecting either a pull-up or pull-down device if pe is active. note: all bits of all registers in this module are completely synchronous to internal clocks during a register read. table 49 pin con?uration summary ddr i/o rdr pe ps function pull device 0 x x 0 x input disabled 0 x x 1 0 input pull up 0 x x 1 1 input pull down 1 0 0 x x output, full drive to 0 disabled 1 1 0 x x output, full drive to 1 disabled 1 0 1 x x output, reduced drive to 0 disabled 1 1 1 x x output, reduced drive to 1 disabled f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 256 port integration module (pim) motorola port t i/o register (ptt) read: anytime. write: anytime. if the data direction bits of the associated i/o pins are set to 1, a read returns the value of the port register, otherwise the value at the pins is read. port t input register (ptit) read: anytime. write: never; writes to this register have no effect. this register always reads back the status of the associated pins. this can also be used to detect overload or short circuit conditions on output pins. address offset: $00e0 bit 7 654321 bit 0 read: ptt7 ptt6 ptt5 ptt4 ptt3 ptt2 ptt1 ptt0 write: ect: i/oc7 i/oc6 i/oc5 i/oc4 i/oc3 i/oc2 i/oc1 i/oc0 reset: 00000000 = reserved or unimplemented address offset: $00e1 bit 7 654321 bit 0 read: ptit7 ptit6 ptit5 ptit4 ptit3 ptit2 ptit1 ptit0 write: reset: - - - ----- = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 257 port t data direction register (ddrt) read: anytime. write: anytime. this register configures each port t pin as either input or output. the ect forces the i/o state to be an output for each timer port associated with an enabled output compare. in these cases the data direction bits will not change. the ddrt bits revert to controlling the i/o direction of a pin when the associated timer output compare is disabled. the timer input capture always monitors the state of the pin. ddrt[7:0] ?data direction port t 1 = associated pin is configured as output. 0 = associated pin is configured as input. due to internal synchronization circuits, it can take up to 2 bus cycles until the correct value is read on ptt or ptit registers, when changing the ddrt register. address offset: $00e2 bit 7 654321 bit 0 read: ddrt7 ddrt6 ddrt5 ddrt4 ddrt3 ddrt2 ddrt1 ddrt0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 258 port integration module (pim) motorola port t reduced drive register (rdrt) read: anytime. write: anytime. this register configures the drive strength of each port t output pin as either full or reduced. if the port is used as input this bit is ignored. rdrt[7:0] ?reduced drive port t 1 = associated pin drives at about 1/3 of the full drive strength. 0 = full drive strength at output. port t pull device enable register (pert) read: anytime. write: anytime. this register configures whether a pull-up or a pull-down device is activated, if the port is used as input. this bit has no effect if the port is used as output. out of reset no pull device is enabled. pert[7:0] ?pull device enable port t 1 = either a pull-up or pull-down device is enabled. 0 = pull-up or pull-down device is disabled. address offset: $00e3 bit 7 654321 bit 0 read: rdrt7 rdrt6 rdrt5 rdrt4 rdrt3 rdrt2 rdrt1 rdrt0 write: reset: 00000000 = reserved or unimplemented address offset: $00e4 bit 7 654321 bit 0 read: pert7 pert6 pert5 pert4 pert3 pert2 pert1 pert0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 259 port t polarity select register (ppst) read: anytime. write: anytime. this register selects whether a pull-down or a pull-up device is connected to the pin. ppst[7:0] ?pull select port t 1 = a pull-down device is connected to the associated port t pin, if enabled by the associated bit in register pert and if the port is used as input. 0 = a pull-up device is connected to the associated port t pin, if enabled by the associated bit in register pert and if the port is used as input. port s i/o register (pts) read: anytime. write: anytime. if the data direction bits of the associated i/o pins are set to 1, a read returns the value of the port register, otherwise the value at the pins is read. address offset: $00e5 bit 7 654321 bit 0 read: ppst7 ppst6 ppst5 ppst4 ppst3 ppst2 ppst1 ppst0 write: reset: 00000000 = reserved or unimplemented address offset: $00e8 bit 7 654321 bit 0 read: pts7 pts6 pts5 pts4 pts3 pts2 pts1 pts0 write: spi/sci: ss sck mosi miso txd1 rxd1 txd0 rxd0 reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 260 port integration module (pim) motorola the spi pins (ps[7:4]) configuration is determined by several status bits in the spi module. see serial peripheral interface (spi) section on page 457 for details. the sci pins associated with transmit pins 3 and 1 are configured as outputs if the transmitter is enabled. the sci pins associated with receive pins 2 and 0 are configured as inputs if the receiver is enabled. see serial communications interface (sci) section on page 419 for details. port s input register (ptis) read: anytime. write: never; writes to this register have no effect. this register always reads back the status of the associated pins. this also can be used to detect overload or short circuit conditions on output pins. port s data direction register (ddrs) read: anytime. write: anytime. address offset: $00e9 bit 7 654321 bit 0 read: ptis7 ptis6 ptis5 ptis4 ptis3 ptis2 ptis1 ptis0 write: reset: - - - ----- = reserved or unimplemented address offset: $00ea bit 7 654321 bit 0 read: ddrs7 ddrs6 ddrs5 ddrs4 ddrs3 ddrs2 ddrs1 ddrs0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 261 this register configures each port s pin as either input or output. if spi is enabled, the spi determines the pin direction. for details see serial peripheral interface (spi) section on page 457. if the associated sci transmit or receive channel is enabled this register has no effect on the pins. the pin is forced to be an output if a sci transmit channel is enabled, it is forced to be an input if the sci receive channel is enabled. the ddrs bits revert to controlling the i/o direction of a pin when the associated channel is disabled. ddrs[7:0] ?data direction port s 1 = associated pin is configured as output. 0 = associated pin is configured as input. due to internal synchronization circuits, it can take up to 2 bus cycles until the correct value is read on pts or ptis registers, when changing the ddrs register. port s reduced drive register (rdrs) read: anytime. write: anytime. this register configures the drive strength of each port s output pin as either full or reduced. if the port is used as input this bit is ignored. rdrs[7:0] ?reduced drive port s 1 = associated pin drives at about 1/3 of the full drive strength. 0 = full drive strength at output. address offset: $00eb bit 7 654321 bit 0 read: rdrs7 rdrs6 rdrs5 rdrs4 rdrs3 rdrs2 rdrs1 rdrs0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 262 port integration module (pim) motorola port s pull device enable register (pers) read: anytime. write: anytime. this register configures whether a pull-up or a pull-down device is activated, if the port is used as input or as output in wired-or (open drain) mode. this bit has no effect if the port is used as push-pull output. out of reset a pull-up device is enabled. pers[7:0] ?pull device enable port s 1 = either a pull-up or pull-down device is enabled. 0 = pull-up or pull-down device is disabled. port s polarity select register (ppss) read: anytime. write: anytime. this register selects whether a pull-down or a pull-up device is connected to the pin. address offset: $00ec bit 7 654321 bit 0 read: pers7 pers6 pers5 pers4 pers3 pers2 pers1 pers0 write: reset: 11111111 = reserved or unimplemented address offset: $00ed bit 7 654321 bit 0 read: ppss7 ppss6 ppss5 ppss4 ppss3 ppss2 ppss1 ppss0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 263 ppss[7:0] ?pull select port s 1 = a pull-down device is connected to the associated port s pin, if enabled by the associated bit in register pers and if the port is used as input. 0 = a pull-up device is connected to the associated port s pin, if enabled by the associated bit in register pers and if the port is used as input or as wired-or output. port s wired-or mode register (woms) read: anytime. write: anytime. this register configures the output pins as wired-or. if enabled the output is driven active low only (open-drain). a logic level of ? is not driven. it applies also to the spi and sci outputs and allows a multipoint connection of several serial modules. this bit has no influence on pins used as inputs. woms[7:0] ?wired-or mode port s 1 = output buffers operate as open-drain outputs. 0 = output buffers operate as push-pull outputs. address offset: $00ee bit 7 654321 bit 0 read: woms7 woms6 woms5 woms4 woms3 woms2 woms1 woms0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 264 port integration module (pim) motorola port p i/o register (ptp) read: anytime. write: anytime. if the data direction bits of the associated i/o pins are set to 1, a read returns the value of the port register, otherwise the value at the pins is read. the pwm function takes precedence over the general purpose i/o function if the associated pwm channel is enabled. while channels 6? are output only if the respective channel is enabled, channel 7 can be pwm output or input if the shutdown feature is enabled. see pulse width modulator (pwm8b8c) section on page 249 for details. port p input register (ptip) read: anytime. write: never; writes to this register have no effect. this register always reads back the status of the associated pins. this can be also used to detect overload or short circuit conditions on output pins. address offset: $00f0 bit 7 654321 bit 0 read: ptp7 ptp6 ptp5 ptp4 ptp3 ptp2 ptp1 ptp0 write: pwm: pwm7 pwm6 pwm5 pwm4 pwm3 pwm2 pwm1 pwm0 reset: 00000000 = reserved or unimplemented address offset: $00f1 bit 7 654321 bit 0 read: ptip7 ptip6 ptip5 ptip4 ptip3 ptip2 ptip1 ptip0 write: reset: - - - ----- = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) register descriptions mc9s12t64revision 1.1.1 motorola port integration module (pim) 265 port p data direction register (ddrp) read: anytime. write: anytime. this register configures each port p pin as either input or output. if the associated pwm channel is enabled this register has no effect on the pins. the pwm forces the i/o state to be an output for each port line associated with an enabled pwm7? channel. channel 7 can force the pin to input if the shutdown feature is enabled. the ddrp bits revert to controlling the i/o direction of a pin when the associated pwm channel is disabled. ddrp[7:0] ?data direction port p 1 = associated pin is configured as output. 0 = associated pin is configured as input. due to internal synchronization circuits, it can take up to 2 bus cycles until the correct value is read on ptp or ptip registers, when changing the ddrp register. address offset: $00f2 bit 7 654321 bit 0 read: ddrp7 ddrp6 ddrp5 ddrp4 ddrp3 ddrp2 ddrp1 ddrp0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 266 port integration module (pim) motorola port p reduced drive register (rdrp) read: anytime. write: anytime. this register configures the drive strength of each port p output pin as either full or reduced. if the port is used as input this bit is ignored. rdrp[7:0] ?reduced drive port p 1 = associated pin drives at about 1/3 of the full drive strength. 0 = full drive strength at output. port p pull device enable register (perp) read: anytime. write: anytime. this register configures whether a pull-up or a pull-down device is activated, if the port is used as input. this bit has no effect if the port is used as output. out of reset no pull device is enabled. perp[7:0] ?pull device enable port p 1 = either a pull-up or pull-down device is enabled. 0 = pull-up or pull-down device is disabled. address offset: $00f3 bit 7 654321 bit 0 read: rdrp7 rdrp6 rdrp5 rdrp4 rdrp3 rdrp2 rdrp1 rdrp0 write: reset: 00000000 = reserved or unimplemented address offset: $00f4 bit 7 654321 bit 0 read: perp7 perp6 perp5 perp4 perp3 perp2 perp1 perp0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) functional description mc9s12t64revision 1.1.1 motorola port integration module (pim) 267 port p polarity select register (ppsp) read: anytime. write: anytime. this register selects a pull-up or a pull-down device if enabled. ppsp[7:0] ?polarity select port p 1 = a pull-down device is connected to the associated port p pin, if enabled by the associated bit in register perp and if the port is used as input. 0 = a pull-up device is connected to the associated port p pin, if enabled by the associated bit in register perp and if the port is used as input. functional description general each pin can act as general purpose i/o. in addition the pin can act as an output or as an input of a peripheral module. a set of configuration registers is common to all ports. all registers can be written at any time, however certain configurations might not become active. example: selecting a pull-up resistor. this resistor does not become active while the port is used as a push-pull output. i/o register this register holds the value driven out to the pin if the port is used as a general purpose i/o. writing to this register has only an effect on the pin address offset: $00f5 bit 7 654321 bit 0 read: ppsp7 ppsp6 ppsp5 ppsp4 ppsp3 ppsp2 ppsp1 ppsp0 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 268 port integration module (pim) motorola if the port is used as general purpose output. when reading this address, the value of the pins is returned if the data direction register bits are set to 0. if the data direction register bits are set to 1, the contents of the i/o register is returned. this is independent of any other configuration. input register this is a read-only register and always returns the value of the pin. data direction register this register defines whether the pin is used as an input or an output. if a peripheral module controls the pin the contents of the data direction register is ignored. figure 39 illustration of i/o pin functionality reduced drive register if the port is used as an output the register allows the configuration of the drive strength. pull device enable register this register turns on a pull-up or pull-down device. it becomes only active if the pin is used as an input or as a wired-or output. polarity select register this register selects either a pull-up or pull-down device if enabled. it becomes only active if the pin is used as an input. a pull-up device can be activated if the pin is used as a wired-or output. i/o ddr mod do obe mod_en pt pti 1 0 1 1 0 0 pad f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) low power options mc9s12t64revision 1.1.1 motorola port integration module (pim) 269 port t this port is associated with the enhanced capture timer module. in all modes, port t pins pt[7:0] can be used for either general-purpose i/o, or with the channels of the enhanced capture timer. during reset, port t pins are configured as high-impedance inputs. port s this port is associated with the serial sci and spi modules. in all modes, port s pins ps[7:0] can be used either for general-purpose i/o, or with the sci and spi subsystems. during reset, port s pins are configured as inputs with pull-up. port p this port is associated with the pwm module. in all modes, port p pins pp[7:0] can be used for either general purpose i/o or with the pwm subsystem. if the pwm is enabled the pins become pwm output channels with the exception of pin 7 which can be pwm input or output. during reset, port p pins are configured as high-impedance inputs. low power options run mode no low power options exist for this module in run mode. wait mode no low power options exist for this module in wait mode. stop mode all clocks are stopped. reset initialization all registers including the data registers get set/reset asynchronously. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
port integration module (pim) mc9s12t64revision 1.1.1 270 port integration module (pim) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 271 clocks and reset generator (crg) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 operation modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 reset description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 overview this specification describes the function of the clocks and reset generator (crg) and oscillator (osc) modules. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 272 clocks and reset generator (crg) motorola features the main features of this block are: crystal (or ceramic resonator) oscillator (osc) user selectable oscillator type: colpitts (low power) or pierce clock monitor (cm) startup counter phase locked loop (pll) frequency multiplier reference divider automatic bandwidth control mode for low-jitter operation automatic frequency lock detector cpu interrupt on entry or exit from locked condition self clock mode in absence of reference clock system clock generator (cgen) external clock mode clock switch for either oscillator or pll based system clocks user selectable disabling of clocks during wait mode for reduced power consumption. computer operating properly (cop) watchdog timer with time-out clear window. system reset generation from the following possible sources power on reset cop reset loss of clock reset external pin reset real-time interrupt (rti) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) modes of operation mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 273 modes of operation this subsection lists and briefly describes all crg operating modes supported by the crg. this is a high level description only, detailed descriptions of operating modes are contained in later sections. run mode all functional parts of the crg are running during run mode. if rti or cop functionality is required the individual bits of the associated rate select registers (copctl, rtictl) have to be set to a non zero value 1 . wait mode depending on the configuration of the individual bits in the clksel register this mode allows to disable the system and core clocks. stop mode depending on the setting of the pstp bit stop mode can be differentiated between full stop mode (pstp=0) and pseudo stop mode (pstp=1). full stop mode the oscillator is disabled and thus all system and core clocks are stopped. the cop and the rti remain frozen. pseudo stop mode the oscillator continues to run and most of the system and core clocks are stopped. if the respective enable bits are set the cop and rti will continue to run, else they remain frozen. self clock mode self clock mode will be entered if the clock monitor enable bit (cme) and the self clock mode enable bit (scme) are both asserted and the clock monitor detects a loss of clock (external oscillator or crystal). as soon as self clock mode is entered the crg starts to perform a clock check. self clock mode remains active until the clock check indicates the required quality of the incoming clock signal is met (frequency and amplitude). self clock mode should be used for safety purposes only. it 1. copctl register is write once only f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 274 clocks and reset generator (crg) motorola provides reduced functionality to the mcu in case a loss of clock is causing severe system conditions. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) block diagram mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 275 block diagram the block diagram below shows a high level view of the crg and osc modules. figure 40 block diagram of crg crg registers clock and reset cop reset rti pll xfc vddpll vsspll osc extal xtal control bus clock system reset oscillator clock pllclk oscclk core clock clock monitor cm fail clock quality checker reset generator vreg / lvd xclks power on reset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 276 clocks and reset generator (crg) motorola external pin descriptions overview this section lists and describes the signals that connect off chip. detailed signal descriptions vddpll, vsspll theses pins provides operating voltage (vddpll) and ground (vsspll) for the pll circuitry. this allows the supply voltage to the pll to be independently bypassed. even if pll usage is not required vddpll and vsspll must be connected to properly. xfc a passive external loop filter must be placed on the xfc pin. the filter is a second-order, low-pass filter to eliminate the vco input ripple. the value of the external filter network and the reference frequency determines the speed of the corrections and the stability of the pll. if pll usage is not required the xfc pin must be tied to vddpll. figure 41 pll loop filter connections extal, xtal these pins provide the interface for either a crystal or a cmos compatible clock to control the internal clock generator circuitry. extal is the external clock input or the input to the crystal oscillator amplifier. xtal is the output of the crystal oscillator amplifier. all the mcu internal system clocks are derived from the extal input frequency. mcu xfc r s c s vddpll c p f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) external pin descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 277 note: crystal circuit is changed from standard! figure 42 colpitts crystal connections ( xclks=1) figure 43 pierce oscillator connections ( xclks=0) mcu c 2 extal xtal crystal or vsspll ceramic resonator c 1 c dc * * due to the nature of a translated ground colpitts oscillator a dc voltage bias is applied to the crystal bias conditions and recommended capacitor value c dc . . .please contact the crystal manufacturer for crystal dc mcu extal xtal r s * r b vsspll crystal or ceramic resonator c 2 c 1 * rs can be zero (shorted) when use with higher frequency crystals. refer to manufacturer? data. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 278 clocks and reset generator (crg) motorola figure 44 external clock connections ( xclks=0) reset reset is an active low bidirectional reset pin. as an input it initializes the mcu asynchronously to a known start-up state. as an open-drain output it indicates that an system reset (internal to mcu) has been triggered. xclks the xclks is an input signal which controls whether a crystal in combination with the internal colpitts (low power) oscillator is used or whether pierce oscillator/external clock circuitry is used. the xclks pin is sampled during reset with the rising edge of reset. table 50 lists the state coding of the sampled xclks signal. mcu extal xtal cmos-compatible external oscillato r not connected (vddpll-level) table 50 clock selection based on xclks at reset xclks description 1 colpitts oscillator selected 0 pierce oscillator / external clock selected f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register map mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 279 register map the register map for the crg appears below. register name bit 7 6 54321 bit 0 address offset synr read: 0 0 syn5 syn4 syn3 syn2 syn1 syn0 $0034 write: refdv read: 0 0 0 0 refdv3 refdv2 refdv1 refdv0 $0035 write: reserved for factory test read: reads to this register return unpredictable values $0036 write: crgflg read: rtif porlvdrf 0 lockif lock track scmif scm $0037 write: crgint read: rtie 00 lockie 00 scmie 0 $0038 write: clksel read: pllsel pstp syswai roawai pllwai cwai rtiwai copwai $0039 write: pllctl read: cme pllon auto acq 0 pre pce scme $003a write: rtictl read: 0 rtr6 rtr5 rtr4 rtr3 rtr2 rtr1 rtr0 $003b write: copctl read: wcop rsbck 000 cr2 cr1 cr0 $003c write: reserved for factory test read: reads to this register return unpredictable values $003d write: = reserved or unimplemented figure 45 crg register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 280 clocks and reset generator (crg) motorola note: register address = base address (initrg) + address offset register descriptions note: all bits of all registers in this module are completely synchronous to internal clocks during a register read. crg synthesizer register (synr) the synr register controls the multiplication factor of the pll. if the pll is on, the count in the loop divider (synr) register effectively multiplies up the pllclk from the reference frequency by 2 x (synr+1). pllclk will not be below the minimum vco frequency (f scm ). note: if pll is selected (pllsel=1)pllclk, bus clock =pllclk/2. bus clock must not exceed the maximum operating system frequency . reserved for factory test read: reads to this register return unpredictable values $003e write: armcop read: 0 0 000000 $003f write: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register name bit 7 6 54321 bit 0 address offset = reserved or unimplemented figure 45 crg register map (continued) 
 ?

?   ? + ()     ? + () ------------------------------ = address offset: $0034 bit 7 6543210 read: 0 0 syn5 syn4 syn3 syn2 syn1 syn0 write: reset: 00000000 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 281 read: anytime. write: anytime except if pllsel = 1. note: write to this register initializes the lock detector bit and the track detector bit. crg reference divider register (refdv) the refdv register provides a finer granularity for the pll multiplier steps. the count in the reference divider divides oscclk frequency by refdv+1. read: anytime. write: anytime except when pllsel = 1. note: write to this register initializes the lock detector bit and the track detector bit. crg flags register (crgflg) this register provides crg status bits and flags. address offset: $0035 bit 7 6543210 read: 0000 refdv3 refdv2 refdv1 refdv0 write: reset: 00000000 = unimplemented or reserved address offset: $0037 bit 7 6543210 read: rtif porlvdrf 0 lockif lock track scmif scm write: reset: 0 (1) 000000 = unimplemented or reserved 1. porlvdrf set to 1 when a power on reset or low-voltage detection reset occurs. unaffected by non-por resets. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 282 clocks and reset generator (crg) motorola read: anytime. write: refer to each bit for write conditions. rtif ?real time interrupt flag rtif is set to 1 at the end of every rti period. this flag can only be cleared by writing a 1. writing a 0 has no effect. if enabled (rtie=1), rtif causes an interrupt request. 1 = rti time-out has occurred. 0 = rti time-out has not yet occurred. porlvdrf ?power on reset / low-voltage-detector reset flag porlvdrf is set to 1 when a power on reset or low-voltage reset occurs. this flag can only be cleared by writing a 1. writing a 0 has no effect. 1 = power on reset or a low voltage reset has occurred 0 = neither power on reset nor low voltage reset has occurred lockif ?pll lock interrupt flag lockif is set to 1 when lock status bit changes. this flag can only be cleared by writing a 1. writing a 0 has no effect.if enabled (lockie=1), lockif causes an interrupt request. 1 = lock bit has changed. 0 = no change in lock bit lock ?lock status bit lock reflects the current state of pll lock condition. this bit is cleared in self clock mode. writes have no effect. 1 = pll vco is within the desired tolerance of the target frequency. 0 = pll vco is not within the desired tolerance of the target frequency. track ?track status bit track reflects the current state of pll track condition. this bit is cleared in self clock mode. writes have no effect. see acquisition and tracking modes in page 296 for more information. 1 = tracking mode status. 0 = acquisition mode status. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 283 scmif ?self-clock mode interrupt flag scmif is set to 1 when scm status bit changes. this flag can only be cleared by writing a 1. writing a 0 has no effect. if enabled (scmie=1), scmif causes an interrupt request. 1 = scm condition has changed, either entered or exited self-clock mode. 0 = no change in scm bit. scm ?self-clock mode status bit scm reflects the current clocking mode. writes have no effect. 1 = mcu is operating in self clock mode with oscclk in an unknown state. all clocks are derived from pllclk running at its minimum frequency f scm . see table 118 in page 582 for the actual value of this parameter. 0 = mcu is operating normally with oscclk available. crg interrupt enable register (crgint) this register enables crg interrupt requests. read: anytime write: anytime. rtie ?real time interrupt enable bit 1 = interrupt will be requested whenever rtif is set. 0 = interrupt requests from rti are disabled. lockie ?lock interrupt enable bit 1 = interrupt will be requested whenever lockif is set. 0 = lock interrupt requests are disabled. address offset: $0038 bit 7 6543210 read: rtie 00 lockie 00 scmie 0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 284 clocks and reset generator (crg) motorola scmie ?self-clock mode interrupt enable bit 1 = interrupt will be requested whenever scmif is set. 0 = scm interrupt requests are disabled. crg clock select register (clksel) this register controls crg clock selection. read: anytime. write: refer to each bit for individual write conditions. pllsel ?pll select bit write: anytime writing a one when lock=0 and auto=1, or track=0 and auto=0 has no effect. this prevents the selection of an unstable pllclk as sysclk. pllsel bit is cleared when the mcu enters self clock mode, stop mode or wait mode with pllwai bit set. 1 = sysclk is derived from pllclk. (bus clock=pllclk/2) 0 = sysclk is derived from oscclk. (bus clock=oscclk/2) pstp ?pseudo stop bit write: anytime this bit controls the functionality of the oscillator during stop mode. 1 = oscillator continues to run in stop mode (pseudo stop). the oscillator amplitude is reduced. 0 = oscillator is disabled in stop mode. note: pseudo-stop allows for faster stop recovery and reduces the mechanical stress and aging of the resonator in case of frequent stop conditions at the expense of a slightly increased power consumption. address offset: $0039 bit 7 6543210 read: pllsel pstp syswai roawai pllwai cwai rtiwai copwai write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 285 lower oscillator amplitude exhibits lower power consumption but could have adverse effects during any electro-magnetic susceptibility (ems) tests. syswai ?system clocks stop in wait mode bit write: anytime this bit controls the bus clock during wait mode. 1 = in wait mode, the system clocks stop. 0 = in wait mode, the system clocks continue to run. note: rti and cop are not affected by syswai bit. roawai ?reduced oscillator amplitude in wait mode bit write: anytime this bit controls oscillator amplitude during wait mode. 1 = reduced oscillator amplitude in wait mode. 0 = normal oscillator amplitude in wait mode. note: lower oscillator amplitude exhibit lower power consumption but could have adverse effects during any electro-magnetic susceptibility (ems) tests. pllwai ?pll stops in wait mode bit write: anytime if pllwai is set, the crg will clear the pllsel bit before entering wait mode. the pllon bit remains set during wait mode but the pll is powered down. upon exiting wait mode, the pllsel bit has to be set manually if pll clock is required. while the pllwai bit is set the auto bit is set to 1 in order to allow the pll to automatically lock on the selected target frequency after exiting wait mode. 1 = pll stops in wait mode. 0 = pll keeps running in wait mode. cwai ?core stops in wait mode bit write: anytime this bit controls the core clock in wait mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 286 clocks and reset generator (crg) motorola 1 = core clock stops in wait mode. 0 = core clock keeps running in wait mode. rtiwai ?rti stops in wait mode bit write: anytime 1 = rti stops and initializes the rti dividers whenever the part goes into wait mode. 0 = rti keeps running in wait mode. copwai ?cop stops in wait mode bit write: once 1 = cop stops and initializes the cop dividers whenever the part goes into wait mode. 0 = cop keeps running in wait mode. crg pll control register (pllctl) this register controls the pll functionality. read: anytime. write: refer to each bit for individual write conditions. cme ?clock monitor enable bit write: anytime except when scm = 1 cme enables the clock monitor. 1 = clock monitor is enabled. slow or stopped clocks will cause a clock monitor reset sequence or self clock mode. 0 = clock monitor is disabled. note: operating with cme=0 will not detect any loss of clock. in case of poor clock quality this could cause unpredictable operation of the mcu! address offset: $003a bit 7 6543210 read: cme pllon auto acq 0 pre pce scme write: reset: 11110001 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 287 in stop mode (pstp=0) the clock monitor is disabled independently of the cme bit setting and any loss of clock will not be detected. pllon ?phase lock loop on bit write: anytime except when pllsel = 1. pllon turns on the pll circuitry. in self clock mode, the pll is turned on, but the pllon bit reads the last latched value. 1 = pll is turned on. if auto bit is set, the pll will lock automatically. 0 = pll is turned off. auto ?automatic bandwidth control bit write: anytime except when pllwai=1, because pllwai sets the auto bit to 1 auto selects either the high bandwidth (acquisition) mode or the low bandwidth (tracking) mode depending on how close to the desired frequency the vco is running. 1 = automatic mode control is enabled and acq bit has no effect. 0 = automatic mode control is disabled and the pll is under software control, using acq bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 288 clocks and reset generator (crg) motorola acq ?acquisition bit write: anytime. if auto =1 this bit has no effect. 1 = high bandwidth filter is selected 0 = low bandwidth filter is selected pre ?rti enable during pseudo stop mode bit pre enables the rti during pseudo stop mode. 1 = rti continues running during pseudo stop mode. 0 = rti stops during pseudo stop mode. note: if the pre bit is cleared the rti dividers will go static while pseudo stop mode is active. the rti dividers will not initialize like in wait mode with rtiwai bit set. pce ?cop enable during pseudo stop mode bit pce enables the cop during pseudo stop mode. 1 = cop continues running during pseudo stop mode. 0 = cop stops during pseudo stop mode. note: if the pce bit is cleared the cop dividers will go static while pseudo stop mode is active. the cop dividers will not initialize like in wait mode with copwai bit set. scme ?self-clock mode enable scme can not be cleared while operating in self clock mode (scm=1). write: once 1 = detection of crystal clock failure forces the mcu in self-clock mode only. 0 = detection of crystal clock failure causes clock monitor reset. crg rti control register (rtictl) this register selects the timeout period for the real time interrupt. address offset: $003b bit 7 6 5 4 3 2 1 0 read: 0 rtr6 rtr5 rtr4 rtr3 rtr2 rtr1 rtr0 write: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 289 read: anytime write: anytime. note: a write to this register will initialize the rti counter. rtr[6:4] ?real time interrupt prescale rate select bits these bits select the prescale rate for the rti. see table 51 . rtr[3:0] ?real time interrupt modulus counter select these bits select the modulus counter target value to provide additional granularity. see table 51 . table 51 shows all possible divide values selectable by the rtictl register. the source clock for the rti is oscclk. reset: 0 0 0 0 0 0 0 0 address offset: $003b bit 7 6 5 4 3 2 1 0 table 51 rti frequency divide rates rtr[3:0] rtr[6:4] = 000 (off) 001 (2 10 ) 010 (2 11 ) 011 (2 12 ) 100 (2 13 ) 101 (2 14 ) 110 (2 15 ) 111 (2 16 ) 0 ( 1) off (1)(2) 2 10 2 11 2 12 2 13 2 14 2 15 2 16 1 ( 2) off (2) 2x2 10 2x2 11 2x2 12 2x2 13 2x2 14 2x2 15 2x2 16 2 ( 3) off (2) 3x2 10 3x2 11 3x2 12 3x2 13 3x2 14 3x2 15 3x2 16 3 ( 4) off (2) 4x2 10 4x2 11 4x2 12 4x2 13 4x2 14 4x2 15 4x2 16 4 ( 5) off (2) 5x2 10 5x2 11 5x2 12 5x2 13 5x2 14 5x2 15 5x2 16 5 ( 6) off (2) 6x2 10 6x2 11 6x2 12 6x2 13 6x2 14 6x2 15 6x2 16 6 ( 7) off (2) 7x2 10 7x2 11 7x2 12 7x2 13 7x2 14 7x2 15 7x2 16 7 ( 8) off (2) 8x2 10 8x2 11 8x2 12 8x2 13 8x2 14 8x2 15 8x2 16 8 ( 9) off (2) 9x2 10 9x2 11 9x2 12 9x2 13 9x2 14 9x2 15 9x2 16 9 ( 10) off (2) 10x2 10 10x2 11 10x2 12 10x2 13 10x2 14 10x2 15 10x2 16 10 ( 11) off (2) 11x2 10 11x2 11 11x2 12 11x2 13 11x2 14 11x2 15 11x2 16 11 ( 12) off (2) 12x2 10 12x2 11 12x2 12 12x2 13 12x2 14 12x2 15 12x2 16 12 ( 13) off (2) 13x2 10 13x2 11 13x2 12 13x2 13 13x2 14 13x2 15 13x2 16 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 290 clocks and reset generator (crg) motorola 13 ( 14) off (2) 14x2 10 14x2 11 14x2 12 14x2 13 14x2 14 14x2 15 14x2 16 14 ( 15) off (2) 15x2 10 15x2 11 15x2 12 15x2 13 15x2 14 15x2 15 15x2 16 15 ( 16) off (2) 16x2 10 16x2 11 16x2 12 16x2 13 16x2 14 16x2 15 16x2 16 1. denotes default value out of reset 2. these values should be used to disable the rti to ensure future backwards compatibility. table 51 rti frequency divide rates (continued) rtr[3:0] rtr[6:4] = 000 (off) 001 (2 10 ) 010 (2 11 ) 011 (2 12 ) 100 (2 13 ) 101 (2 14 ) 110 (2 15 ) 111 (2 16 ) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 291 crg cop control register (copctl) this register controls the cop (computer operating properly) watchdog. read: anytime. write: once wcop ?window cop mode bit when set, a write to the armcop register must occur in the last 25% of the selected period. a write during the first 75% of the selected period will reset the part. as long as all writes occur during this window, $55 can be written as often as desired. once $aa is written after the $55, the time-out logic restarts and the user must wait until the next window before writing to armcop. table 52 shows the exact duration of this window for the seven available cop rates. 1 = window cop operation 0 = normal cop operation rsbck ?cop and rti stop in active bdm bit 1 = stops the cop and rti counters whenever the part is in active background debug mode. 0 = allows the cop and rti to keep running in active background debug mode. cr[2:0] ?cop watchdog timer rate select these bits select the cop time-out rate (see table 52 ). the cop time-out period is oscclk period divided by cr[2:0] value. writing a nonzero value to cr[2:0] enables the cop counter and starts the time-out period. a cop counter time-out causes a system reset. this can be avoided by periodically (before time-out) re-initializing the cop counter via the armcop register. address offset: $003c bit 7 6543210 read: wcop rsbck 000 cr2 cr1 cr0 write: reset: 01000011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 292 clocks and reset generator (crg) motorola crg cop timer arm/reset register (armcop) this register is used to restart the cop time-out period. read: always reads $00. write: anytime when the cop is disabled (cr[2:0] = ?00? writing to this register has no effect. when the cop is enabled by setting cr[2:0] nonzero, the following applies: table 52 cop watchdog rates (1) 1. times are referenced from the previous cop time-out reset (writing $55/$aa to the armcop register) cr2 cr1 cr0 divide oscclk by 0 0 0 off 001 2 14 010 2 16 011 2 18 100 2 20 101 2 22 110 2 23 111 2 24 address offset: $003f bit 7 6543210 read: 00000000 write: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) register descriptions mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 293 writing any value other than $55 or $aa causes a cop reset. to restart the cop time-out period you must write $55 followed by a write of $aa. other instructions may be executed between these writes but the sequence ($55, $aa) must be completed prior to cop end of time-out period to avoid a cop reset. sequences of $55 writes or sequences of $aa writes are allowed. when the wcop bit is set, $55 and $aa writes must be done in the last 25% of the selected time-out period; writing any value in the first 75% of the selected period will cause a cop reset. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 294 clocks and reset generator (crg) motorola functional description general this section provides a complete functional description of the crg. it gives detailed informations on the internal operation of the design. functional blocks oscillator (osc) the oscillator block has two external pins, extal and xtal. the oscillator input pin, extal, is intended to be connected to either a crystal or an external clock source. the selection of colpitts oscillator or pierce oscillator/external clock depends on the xclks signal which is sampled during reset. the xtal pin is an output signal that provides crystal circuit feedback and can be buffered to drive other devices with same voltage amplitude. a buffered extal signal, oscclk, becomes the internal reference clock. the oscillator is enabled based on the pstp bit, and the stop condition. the oscillator is disabled when the part is in stop mode except when pseudo-stop mode is enabled. to improve noise immunity, the oscillator is powered by the vddpll and vsspll power supply pins. the colpitts oscillator is equipped with a feedback system which does not waste current generating harmonics. its configuration is ?olpitts oscillator with translated ground? the transconductor used is driven by a current source under the control of a peak detector which will measure the amplitude of the ac signal appearing on extal node in order to implement an amplitude limitation control (alc) loop. the alc loop is in charge of reducing the quiescent current in the transconductor as a result of an increase in the oscillation amplitude. the pierce oscillator can be used for higher frequencies than possible with the colpitts oscillator. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) functional description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 295 phase locked loop (pll) the pll is used to run the mcu from a different time base than the incoming oscclk. for increased flexibility, oscclk can be divided in a range of 1 to 16 to generate the reference frequency. this offers a finer multiplication granularity. the pll can multiply this reference clock by a multiple of 2, 4, 6, ...,126,128 based on the synr register. note: although it is possible to set the two dividers to command a very high clock frequency, do not exceed the specified bus frequency limit for the mcu. if pllsel=1, bus clock = pllclk/2. the pll is a frequency generator that operates in either acquisition mode or tracking mode, depending on the difference between the output frequency and the target frequency. the pll can change between acquisition and tracking modes either automatically or manually. the vco has a minimum operating frequency, which corresponds to the self clock mode frequency f scm . figure 46 pll functional diagram pll operation the oscillator output clock signal (oscclk) is fed through the reference programmable divider and is divided in a range of 1 to 16 (refdv+1) to 
 

   ? + []     ? + [] ------------------------------ = reduced consumption oscillator extal xtal oscclk pllclk reference programmable divider pdet phase detector refdv <3:0> loop programmable divider syn <5:0> cpump vco lock loop filter xfc pin up down lock detector reference feedback vddpll vddpll/vsspll clock monitor vddpll/vsspll vdd/vss supplied by: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 296 clocks and reset generator (crg) motorola output the reference clock. the vco output clock, (pllclk) is fed back through the programmable loop divider and is divided in a range of 2 to 128 in increments of [2 x (synr +1)] to output the feedback clock. see figure 46 . the phase detector then compares the feedback clock, with the reference clock. correction pulses are generated based on the phase difference between the two signals. the loop filter then slightly alters the dc voltage on the external filter capacitor connected to xfc pin, based on the width and direction of the correction pulse. the filter can make fast or slow corrections depending on its mode, as described in the next subsection. the values of the external filter network and the reference frequency determine the speed of the corrections and the stability of the pll. acquisition and tracking modes the lock detector compares the frequencies of the feedback clock, and the reference clock. therefore, the speed of the lock detector is directly proportional to the final reference frequency. the circuit determines the mode of the pll and the lock condition based on this comparison 1 . the pll filter can be manually or automatically configured into one of two possible operating modes: acquisition mode in acquisition mode, the filter can make large frequency corrections to the vco. this mode is used at pll start-up or when the pll has suffered a severe noise hit and the vco frequency is far off the desired frequency. when in acquisition mode, the track status bit is cleared in the crgflg register. tracking mode 1. see table 118 in page 582 for actual values of the parameters men- tioned in this section. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) functional description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 297 in tracking mode, the filter makes only small corrections to the frequency of the vco. pll jitter is much lower in tracking mode, but the response to noise is also slower. the pll enters tracking mode when the vco frequency is nearly correct and the track bit is set in the crgflg register. the pll can change the bandwidth or operational mode of the loop filter manually or automatically. in automatic bandwidth control mode (auto = 1), the lock detector automatically switches between acquisition and tracking modes. automatic bandwidth control mode also is used to determine when the pll clock (pllclk) is safe to use as the source for the system and core clocks. if pll lock interrupt requests are enabled, the software can wait for an interrupt request and then check the lock bit. if cpu interrupts are disabled, software can poll the lock bit continuously (during pll start-up, usually) or at periodic intervals. in either case, only when the lock bit is set, is the pllclk clock safe to use as the source for the system and core clocks. if the pll is selected as the source for the system and core clocks and the lock bit is clear, the pll has suffered a severe noise hit and the software must take appropriate action, depending on the application. the following conditions apply when the pll is in automatic bandwidth control mode (auto=1): the track bit is a read-only indicator of the mode of the filter. the lock bit is a read-only indicator of the locked state of the pll. cpu interrupts can occur if enabled (lockie = 1) when the lock condition changes, toggling the lock bit. the pll can also operate in manual mode (auto = 0). manual mode is used by systems that do not require an indicator of the lock condition for proper operation. such systems typically operate well below the maximum system frequency (f sys ) and require fast start-up. the following conditions apply when in manual mode: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 298 clocks and reset generator (crg) motorola acq is a writable control bit that controls the mode of the filter. before turning on the pll in manual mode, the acq bit should be asserted to configure the filter in acquisition mode. after turning on the pll by setting the pllon bit software must wait a given time before entering tracking mode (acq = 0). after entering tracking mode software must wait a given time before selecting the pllclk as the source for system and core clocks (pllsel = 1). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) functional description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 299 system clocks generator figure 47 clock generator the clock generator creates the clocks used in the mcu (see figure 47 ). the gating condition placed on top of the individual clock gates indicates the dependencies of different modes (stop, wait) and the setting of the respective configuration bits. for example, a wait(syswai) gating condition states that when the syswai bit is set, the correspondent gate will be disabled during wait mode. oscillator phase lock loop extal xtal sysclk rti oscclk pllclk clock phase generator bus clock clock monitor 1 0 pllsel or scm 2 core clock cop oscillator oscillator * = clock gate gating condition wait(cwai,syswai), stop wait(rtiwai), stop( pstp, pre), rti enable wait(copwai), stop( pstp, pce), cop enable wait(syswai), stop stop( pstp) 1 0 scm wait(syswai), stop clock clock (running during pseudo stop mode * this clock is not used in the current mcu. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 300 clocks and reset generator (crg) motorola the peripheral modules use the bus clock. some peripheral modules also use the oscillator clock. the memory blocks use the bus clock. if the mcu enters self clock mode (see self clock mode in page 305 ) oscillator clock source is switched to pllclk running at its minimum frequency f scm . the bus clock is used to generate the clock visible at the eclk pin. the core clock signal is the clock for the hcs12 core.the core clock is twice the bus clock as shown in figure 48 . but note that a cpu cycle corresponds to one bus clock. pll clock mode is selected with pllsel bit in the clksel register. when selected, the pll output clock drives sysclk for the main system including the cpu and peripherals. the pll cannot be turned off by clearing the pllon bit, if the pll clock is selected. when pllsel is changed, it takes a maximum of 4 oscclk plus 4 pllclk cycles to make the transition. during the transition, all clocks freeze and cpu activity ceases. figure 48 core clock and bus clock relationship clock monitor (cm) the clock monitor circuit is based on an internal resistor-capacitor (rc) time delay so that it can operate without any mcu clocks. if no oscclk edges are detected within this rc time delay, the clock monitor indicates failure which asserts self clock mode or generates a system reset depending on the state of scme bit in the pllctl register (page 286 ). if the scme bit is cleared, crg generates a clock monitor reset; otherwise, it enters self clock mode. if the clock monitor is disabled or the presence of clocks is detected no failure is indicated.the clock monitor function is enabled/disabled by the cme control bit. core clock: bus clock / eclk f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) functional description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 301 clock quality checker the clock monitor performs a coarse check on the incoming clock signal. the clock quality checker provides a more accurate check in addition to the clock monitor. the clock quality checker expects a valid osclk to have 4096 rising oscclk edges within a time window of 50 000 vco clock cycles 1 (see figure 49 ). this time window is called check window . if the requested number of 4096 rising oscclk edges occur within the check window, the quality of the oscclk is considered to be valid and the oscclk becomes the source for systems and core clocks. note that if 4096 oscclk edges are counted within the check window, the check window is immediately terminated. . figure 49 check window definition a clock quality check is triggered by any of the following events: power-on reset ( por ) low voltage detection reset ( lvdr ) wake-up from full stop mode ( exit_full_stop ) clock monitor fail indication ( cm_fail ) 1. vco clock cycles are generated by the pll when running at minimum frequency f scm . 12 49999 50000 vco clock check window 12345 4095 4096 3 oscclk oscclk ok f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 302 clocks and reset generator (crg) motorola figure 50 sequence for clock quality check note: remember that in parallel to additional actions caused by self clock mode or clock monitor reset 1 handling the clock quality checker continues to check the oscclk signal. note: the clock quality checker enables the pll and the voltage regulator (vreg) anytime a clock check has to be performed. an ongoing clock quality check could also cause a running pll (f scm ) and an active vreg during pseudo-stop mode or wait mode oscclk ok? check window scm active? switch to oscclk exit scm num=0 num<50 ? num=num+1 yes no yes scme=1 ? no scm active? yes no yes no num=50 yes no num: number of check windows performed. clock ok enter scm clock monitor reset por | lvdr or exit_full_stop cm_fail 1. a clock monitor reset will always set the scme bit to logical? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) functional description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 303 computer operating properly watchdog (cop) figure 51 clock chain for cop the cop (free running watchdog timer) enables the user to check that a program is running and sequencing properly. when the cop is being used, software is responsible for keeping the cop from timing out. if the cop times out it is an indication that the software is no longer being executed in the intended sequence; thus a system reset is initiated (see computer operating properly watchdog (cop) reset in page 321 ). the cop runs with a gated oscclk (see figure 51 ). three control bits in the copctl register allow selection of seven cop time-out periods. when cop is enabled, the program must write $55 and $aa (in this order) to the armcop register during the selected time-out period. once this is done, the cop time-out period is restarted. if the program fails to do this and the cop times out, the part will reset. also, if any value other than $55 or $aa is written, the part is immediately reset. window cop operation is enabled by setting wcop in the copctl register. in this mode, writes to the armcop register to clear the cop timer must occur in the last 25% of the selected time-out period. a premature write will immediately reset the part. oscclk cr[2:0] cop timeout 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 4 4 2 4 2 16384 4 cr[2:0] = clock gate wait(copwai), stop( pstp, pce), cop enable gating condition f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 304 clocks and reset generator (crg) motorola if pce bit is set, the cop will continue to run in pseudo-stop mode. real time interrupt (rti) the rti can be used to generate a hardware interrupt at a fixed periodic rate. if enabled (by setting rtie=1), this interrupt will occur at the rate selected by the rtictl register. the rti runs with a gated oscclk (see figure 52 ). at the end of the rti time-out period the rtif flag is set to one and a new rti time-out period starts immediately. a write to the rtictl register restarts the rti time-out period. if the pre bit is set, the rti will continue to run in pseudo-stop mode. figure 52 clock chain for rti oscclk rtr[6:4] 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 2 2 2 2 2 2 counter (rtr[3:0]) 4-bit modulus 1024 rti timeout = clock gate wait(rtiwai), stop( pstp, pre), rti enable gating condition f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) operation modes mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 305 operation modes normal mode the crg module behaves as described within this specification in all normal modes. self clock mode the vco has a minimum operating frequency, f scm . if the external clock frequency is not available due to a failure or due to long crystal start-up time, the bus clock and the core clock are derived from the vco running at minimum operating frequency; this mode of operation is called self clock mode. this requires cme=1 and scme=1. if the mcu was clocked by the pll clock prior to entering self clock mode, the pllsel bit will be cleared. if the external clock signal has stabilized again, the crg will automatically select oscclk to be the system clock and return to normal mode. see clock quality checker in page 301 for more information on entering and leaving self clock mode. note: in order to detect a potential clock loss the cme bit should be always enabled (cme=1)! if cme bit is disabled and the mcu is configured to run on pll clock (pllclk), a loss of external clock (oscclk) will not be detected and will cause the system clock to drift towards the vco? minimum frequency f scm . as soon as the external clock is available again the system clock ramps up to its pll target frequency. if the mcu is running on external clock any loss of clock will cause the system to go static. low power options this section summarizes the low power options available in the crg. run mode the rti can be stopped by setting the associated rate select bits to zero. the cop can be stopped by setting the associated rate select bits to zero. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 306 clocks and reset generator (crg) motorola wait mode the wai instruction puts the mcu in a low power consumption stand-by mode depending on setting of the individual bits in the clksel register. all individual wait mode configuration bits can be superposed. this provides enhanced granularity in reducing the level of power consumption during wait mode. table 53 lists the individual configuration bits and the parts of the mcu that are affected in wait mode. after executing the wai instruction the core requests the crg to switch mcu into wait mode. the crg then checks whether the pllwai, cwai and syswai bits are asserted (see figure 53 ). depending on the configuration the crg switches the system and core clocks to oscclk by clearing the pllsel bit, disables the pll, disables the core clocks and finally disables the remaining system clocks. as soon as all clocks are switched off wait mode is active. table 53 mcu con?uration during wait mode pllwai cwai syswai rtiwai copwai roawai pll stopped ----- core - stopped stopped - - - system - - stopped - - - rti - - - stopped - - cop ---- stopped - oscillator ----- reduced f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 307 figure 53 wait mode entry/exit sequence enter wait mode pllwai=1 ? exit wait w. cmr exit wait w. ext.reset exit wait mode enter scm exit wait mode core req? wait mode. cwai or syswai=1 ? syswai=1 ? clear pllsel, disable pll disable core clocks disable system clocks cme=1 ? int ? cm fail ? scme=1 ? scmie=1 ? continue w. normal op no no no no no no no yes yes yes yes yes no yes yes yes wait mode left due to external reset generate scm interrupt (wakeup from wait) scm=1 ? enter scm no yes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 308 clocks and reset generator (crg) motorola there are five different scenarios for the crg to restart the mcu from wait mode: external reset clock monitor reset cop reset real time interrupt (rti) wake-up interrupt 1 if the mcu gets an external reset during wait mode active, the crg asynchronously restores all configuration bits in the register space to its default settings and starts the reset generator. after completing the reset sequence processing begins by fetching the normal reset vector. wait mode is left and the mcu is in run mode again. if the clock monitor is enabled (cme=1) the mcu is able to leave wait-mode when loss of oscillator/external clock is detected by a clock monitor fail. if the scme bit is not asserted the crg generates a clock monitor fail reset (cmr). the crg? behavior for cmr is the same compared to external reset, but another reset vector is fetched after completion of the reset sequence. in case the scme bit is asserted the crg generates a scm interrupt if enabled (scmie=1). after generating the interrupt the crg enters self-clock mode and starts the clock quality checker (see clock quality checker in page 301 ). then the mcu continues with normal operation. in case the scm interrupt is blocked by scmie=0, the scmif flag will be asserted and clock quality checks will be performed but the mcu will not wake-up from wait-mode. if any other interrupt source (e.g. rti) triggers exit from wait mode, the mcu immediately continues with normal operation. if the pll has been powered-down during wait-mode the pllsel bit is cleared and the mcu runs on oscclk after leaving wait-mode. the software must manually set the pllsel bit again, in order to switch system and core clocks to the pllclk. 1. interrupts generated by other modules of the mcu (e.g. sci, atd, spi, etc.) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 309 if wait mode is entered from self-clock mode the crg will continue to check the clock quality until clock check is successful. the pll and voltage regulator (vreg) will remain enabled. table 54 summarizes the outcome of a clock loss while in wait mode. table 54 outcome of clock loss in wait mode cme scme scmie crg actions 0xx clock failure --> no action, clock loss not detected. 10x clock failure --> crg performs clock monitor reset immediately f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 310 clocks and reset generator (crg) motorola 110 clock failure --> scenario 1: oscclk recovers prior to exiting wait mode. - mcu remains in wait mode, - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - set scmif interrupt ?g. some time later oscclk recovers. - cm no longer indicates a failure, - 4096 oscclk cycles later clock quality check indicates clock o.k., - scm deactivated, - pll disabled depending on pllwai, - vreg remains enabled (never gets disabled in wait mode) . - mcu remains in wait mode. s ome time later either a wakeup interrupt occurs (no scm interrupt) - exit wait mode using oscclk as system clock (sysclk), - continue normal operation. or an external reset is applied. - exit wait mode using oscclk as system clock, - start reset sequence. scenario 2: oscclk does not recover prior to exiting wait mode. - mcu remains in wait mode, - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - set scmif interrupt ?g, - keep performing clock quality checks (could continue in?itely) while in wait mode. s ome time later either a wakeup interrupt occurs (no scm interrupt) - exit wait mode in scm using pll clock (f scm ) as system clock, - continue to perform additional clock quality checks until oscclk is o.k. again. or an external reset is applied. - exit wait mode in scm using pll clock (f scm ) as system clock, - start reset sequence, - continue to perform additional clock quality checks until oscclk is o.k.again. table 54 outcome of clock loss in wait mode (continued) cme scme scmie crg actions f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 311 cpu stop mode all clocks are stopped in stop mode, dependent of the setting of the pce, pre and pstp bit. the oscillator is disabled in stop mode unless the pstp bit is set. all counters and dividers remain frozen but do not initialize. if the pre or pce bits are set, the rti or cop continues to run in pseudo-stop mode. in addition to disabling system and core clocks the crg requests other functional units of the mcu (e.g. voltage-regulator) to enter their individual powersaving modes (if available). this is the main difference between pseudo-stop mode and wait mode. after executing the stop instruction the core requests the crg to switch the mcu into stop mode. if the pllsel bit is still set when entering stop-mode, the crg will switch the system and core clocks to oscclk by clearing the pllsel bit. then the crg disables the pll, disables the core clock and finally disables the remaining system clocks. as soon as all clocks are switched off stop-mode is active. if pseudo-stop mode (pstp=1) is entered from self-clock mode the crg will continue to check the clock quality until clock check is successful. the pll and the voltage regulator (vreg) will remain enabled. if full-stop mode (pstp=0) is entered from self-clock mode an ongoing clock quality check will be stopped. a complete timeout window check will be started when stop mode is left again. 111 clock failure --> - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - scmif set. scmif generates self clock mode wakeup interrupt. - exit wait mode in scm using pll clock (f scm ) as system clock, - continue to perform a additional clock quality checks until oscclk is o.k. again. table 54 outcome of clock loss in wait mode (continued) cme scme scmie crg actions f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 312 clocks and reset generator (crg) motorola wake-up from stop-mode also depends on the setting of the pstp bit. figure 54 stop mode entry/exit sequence exit stop w. cmr exit stop mode enter scm exit stop mode core req? stop mode. clear pllsel, disable pll cme=1 ? int ? cm fail ? scme=1 ? scmie=1 ? continue w. normal op no no no no yes yes yes yes yes generate scm interrupt (wakeup from stop) enter stop mode exit wait w. ext.reset wait mode left due to external reset clock ok ? scme=1 ? enter scm yes no yes exit stop w. cmr no no no pstp=1 ? int ? yes no yes exit stop mode exit stop mode scm=1 ? enter scm no yes clocks ok ? stands for a clock quality check f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 313 wake-up from pseudo-stop (pstp=1) wake-up from pseudo-stop is the same as wake-up from wait-mode. there are also five different scenarios for the crg to restart the mcu from pseudo-stop mode: external reset clock monitor fail wake-up interrupt if the mcu gets an external reset during pseudo-stop mode active, the crg asynchronously restores all configuration bits in the register space to its default settings and starts the reset generator. after completing the reset sequence processing begins by fetching the normal reset vector. pseudo-stop mode is left and the mcu is in run mode again. if the clock monitor is enabled (cme=1) the mcu is able to leave pseudo-stop mode when loss of oscillator/external clock is detected by a clock monitor fail. if the scme bit is not asserted the crg generates a clock monitor fail reset (cmr). the crg? behavior for cmr is the same compared to external reset, but another reset vector is fetched after completion of the reset sequence. if the scme bit is asserted the crg generates a scm interrupt if enabled (scmie=1). after generating the interrupt the crg enters self-clock mode and starts the clock quality checker (see clock quality checker in page 301 ). then the mcu continues with normal operation. if the scm interrupt is blocked by scmie=0, the scmif flag will be asserted but the crg will not wake-up from pseudo-stop mode. if any other interrupt source (e.g. rti) triggers exit from pseudo-stop mode, the mcu immediately continues with normal operation. because the pll has been powered-down during stop-mode the pllsel bit is cleared and the mcu runs on oscclk after leaving stop-mode. the software must set the pllsel bit again, in order to switch system and core clocks to the pllclk. table 55 summarizes the outcome of a clock loss while in pseudo-stop mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 314 clocks and reset generator (crg) motorola table 55 outcome of clock loss in pseudo-stop mode cme scme scmie crg actions 0xx clock failure --> no action, clock loss not detected. 10x clock failure --> crg performs clock monitor reset immediately f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 315 110 clock monitor failure --> scenario 1: oscclk recovers prior to exiting pseudo-stop mode. - mcu remains in pseudo-stop mode, - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - set scmif interrupt ?g. some time later oscclk recovers. - cm no longer indicates a failure, - 4096 oscclk cycles later clock quality check indicates clock o.k., - scm deactivated, - pll disabled, - vreg disabled. - mcu remains in pseudo-stop mode. s ome time later either a wakeup interrupt occurs (no scm interrupt) - exit pseudo-stop mode using oscclk as system clock (sysclk), - continue normal operation. or an external reset is applied. - exit pseudo-stop mode using oscclk as system clock, - start reset sequence. scenario 2: oscclk does not recover prior to exiting pseudo-stop mode. - mcu remains in pseudo-stop mode, - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - set scmif interrupt ?g, - keep performing clock quality checks (could continue in?itely) while in pseudo-stop mode. s ome time later either a wakeup interrupt occurs (no scm interrupt) - exit pseudo-stop mode in scm using pll clock (f scm ) as system clock - continue to perform additional clock quality checks until oscclk is o.k. again. or an external reset is applied. - exit pseudo-stop mode in scm using pll clock (f scm ) as system clock - start reset sequence, - continue to perform additional clock quality checks until oscclk is o.k.again. table 55 outcome of clock loss in pseudo-stop mode (continued) cme scme scmie crg actions f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 316 clocks and reset generator (crg) motorola wake-up from full stop (pstp=0) the mcu requires an external interrupt or an external reset in order to wake-up from stop-mode. if the mcu gets an external reset during full stop mode active, the crg asynchronously restores all configuration bits in the register space to its default settings and will perform a maximum of 50 clock check windows (see clock quality checker in page 301 ). after completing the clock quality check the crg starts the reset generator. after completing the reset sequence processing begins by fetching the normal reset vector. full stop-mode is left and the mcu is in run mode again. if the mcu is woken-up by an interrupt, the crg will also perform a maximum of 50 clock check window s (see clock quality checker in page 301 ). if the clock quality check is successful, the crg will release all system and core clocks and will continue with normal operation. if all clock checks within the timeout-window are failing, the crg will switch to self-clock mode or generate a clock monitor reset (cmr) depending on the setting of the scme bit in the pllctl register (page 286 ). if the scme bit is cleared, crg generates a clock monitor reset; otherwise, it enters self clock mode. because the pll has been powered-down during stop-mode the pllsel bit is cleared and the mcu runs on oscclk after leaving stop-mode. the software must manually set the pllsel bit again, in order to switch system and core clocks to the pllclk. 111 clock failure --> - vreg enabled, - pll enabled, - scm activated, - start clock quality check, - scmif set. scmif generates self clock mode wakeup interrupt. - exit pseudo-stop mode in scm using pll clock (f scm ) as system clock, - continue to perform a additional clock quality checks until oscclk is o.k. again. table 55 outcome of clock loss in pseudo-stop mode (continued) cme scme scmie crg actions f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) low power options mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 317 note: in full stop mode the clock monitor is disabled and any loss of clock will not be detected. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 318 clocks and reset generator (crg) motorola reset description general this section describes how to reset the crg and how the crg itself controls the reset of the mcu. it explains all special reset requirements. since the reset generator for the mcu is part of the crg this section also describes all automatic actions that occur during or as a result of individual reset conditions. the reset values of registers and signals are provided in register descriptions in page 280 . all reset sources are listed in table 56 . refer to mcu specification for related vector addresses and priorities. description of reset operation the reset sequence is initiated by any of the following events: low level is detected at the reset pin (external reset). power-on is detected. (power-on reset - por) low voltage condition is detected. (low voltage detection reset lvdr) cop watchdog times out. (cop reset - copr) clock monitor failure is detected and self-clock mode was disabled (scme=0). (clock monitor reset - cmr) upon detection of any reset event, an internal circuit drives the reset pin low for 128 sysclk cycles (see figure 55 ). since entry into reset is asynchronous it does not require a running sysclk. however, the internal reset circuit of the crg cannot sequence out of current reset condition without a running sysclk. the number of 128 sysclk cycles might be increased by n=3 to 6 additional sysclk cycles table 56 reset summary vector address reset source local enable $fffe, $ffff power-on reset none lvd reset lvdcr (lvde=1 and lvdre=1) external reset none $fffc, $fffd clock monitor reset pllctl (cme=1, scme=0) $fffa, $fffb cop watchdog reset copctl (cr[2:0] nonzero) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) reset description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 319 depending on the internal synchronization latency. after 128+n sysclk cycles the reset pin is released. the reset generator circuit of the crg waits for additional 64 sysclk cycles and then samples the reset pin to determine the originating source. table 57 shows which vector will be fetched. note: external circuitry connected to the reset pin should not include a large capacitance that would interfere with the ability of this signal to rise to a valid logic one within 64 sysclk cycles after the low drive is released. the internal reset of the mcu remains asserted while the reset generator completes the 192 sysclk long reset sequence. the reset generator circuitry always makes sure the internal reset is negated synchronously after completion of the 192 sysclk cycles. in case the reset pin is externally driven low for more than these 192 sysclk cycles (external reset), the internal reset remains asserted too. table 57 reset vector selection sampled reset pin (64 sysclk cycles after release) clock monitor reset pending cop reset pending vector fetch 100 por / lvdr / external reset 11x clock monitor reset 1 0 1 cop reset 0xx por / lvdr / external reset with rise of reset pin f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 320 clocks and reset generator (crg) motorola figure 55 reset timing clock monitor reset the crg generates a clock monitor reset in case all of the following conditions are true: clock monitor is enabled (cme=1) loss of clock is detected self-clock mode is disabled (scme=0). the reset event asynchronously forces the configuration registers to their default settings (see register descriptions in page 280 ). in detail the cme and the scme are reset to logical ??(which doesn? change the state of the cme bit, because it has already been set). as a consequence the crg immediately enters self clock mode and starts its internal reset sequence. the clock quality check starts in parallel. as soon as the clock quality check indicates a valid oscclk, crg switches to oscclk and leaves self clock mode. since the clock quality checker is running in parallel to the reset generator, the crg may leave self clock mode while still completing the internal reset sequence, e.g. when a high frequency oscclk is provided. when the reset sequence is finished the crg checks the internally latched state of the clock monitor fail circuit. if a clock monitor fail is indicated processing begins by fetching the clock monitor reset vector. ) ( ) ( ) ( ) sysclk 128+ n cycles 64 cycles with n being min 3 / max 4 cycles depending on internal synchronization delay crg drives reset pin low eventually sysclk not running eventually reset driven low externally ) ( ( reset reset pin released f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) reset description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 321 computer operating properly watchdog (cop) reset when cop is enabled, the crg expects sequential write of $55 and $aa (in this order) to the armcop register during the selected time-out period. once this is done, the cop time-out period restarts. if the program fails to do this the crg will generate a reset. also, if any value other than $55 or $aa is written, the crg immediately generates a reset. in case window cop operation is enabled writes ($55 or $aa) to the armcop register must occur in the last 25% of the selected time-out period. a premature write the crg will immediately generate a reset. as soon as the reset sequence is completed the reset generator checks the reset condition. if no clock monitor failure is indicated and the latched state of the cop timeout is true, processing begins by fetching the cop vector. low voltage detection reset the crg generates a low voltage detection reset in case all of the following conditions are true: vddr voltage falls to v lvr level and remains at or below that level for 17 or more consecutive bus clock cycles. the lvd reset enable bit (lvdre) in the lvdcr register is set. as showed in figure 50 , after a lvd reset occurs, the crg will perform a maximum of 50 check windows before entering self clock mode and executing the reset sequence. if oscclk is considered valid before 50 check windows are complete, the clock quality check is successfully terminated and reset sequence is executed. more details about the lvd module can be found in the section in page 185 . power-on reset the on-chip voltage regulator detects when vdd to the mcu has reached a certain level and asserts power on reset. as soon as a power on reset is triggered the crg performs a quality check on the incoming clock signal. as soon as clock quality check indicates a valid oscillator clock signal the reset sequence starts using the oscillator clock. if after 50 check windows the clock quality check indicated a non-valid oscillator clock the reset sequence starts using self-clock mode. see figure 50 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 322 clocks and reset generator (crg) motorola figure 56 and figure 57 show the power-up sequence for cases when the reset pin is tied to vdd and when the reset pin is held low. note that the reset sequence only starts after a running sysclk is detected. figure 56 reset pin tied to vdd (by a pull-up resistor) figure 57 reset pin held low externally note: proper function of the lvd module requires the voltage regulator to be enable during operation (vregen pin tied high). note: por is only rearmed if the vdd voltage falls below the por rearm level (v por 1 ). there are four possible combinations of porlvdrf (crgflg register) and lvdf (lvdsr register) flags that can be obtained during operation. reset internal por 128 sysclk 64 sysclk internal reset clock quality check (no self-clock mode) ) ( ) ( ) ( clock quality check reset internal por internal reset 128 sysclk 64 sysclk (no self clock mode) ) ( ) ( ) ( 1. see table 116 in page 578 for the actual values of these parameters. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) reset description mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 323 these combinations are shown in table 58 with the correspondent events that caused them to be set. porlvdrf is set when a power-on or a low-voltage reset occurs, while lvdf is set when a low-voltage condition is detected. table 58 relation between porlvdrf and lvdf porlvdrf lvdf event 00 neither por nor lvdr occurred. no low-voltage condition detected (1) 1. considering that porlvdrf and lvdf flags were cleared by the program after por or lvdr. 01 neither por nor lvdr occurred. low-voltage condition detected but lvd reset not enabled (lvdre=0) (1) 1 0 por occurred 1 1 lvdr occurred f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 324 clocks and reset generator (crg) motorola interrupts general this section describes all interrupts originated by the crg. the interrupts/reset vectors requested by the crg are listed in table 59 . description of interrupt operation real time interrupt the crg generates a real time interrupt when the selected interrupt time period elapses. rti interrupts are locally disabled by setting the rtie bit to zero. the real time interrupt flag (rtif) is set to1 when a timeout occurs, and is cleared to 0 by writing a 1 to the rtif bit. the rti continues to run during pseudo stop mode if the pre bit is set to 1. this feature can be used for periodic wakeup from pseudo stop if the rti interrupt is enabled. pll lock interrupt the crg generates a pll lock interrupt when the lock condition of the pll has changed, either from a locked state to an unlocked state or vice versa. lock interrupts are locally disabled by setting the lockie bit to zero. the pll lock interrupt flag (lockif) is set to1 when the lock condition has changed, and is cleared to 0 by writing a 1 to the lockif bit. table 59 crg interrupt vectors vector address interrupt source ccr mask local enable $fff0, $fff1 real time interrupt i bit crgint (rtie) $ffc6, $ffc7 lock interrupt i bit crgint (lockie) $ffc4, $ffc5 scm interrupt i bit crgint (scmie) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) interrupts mc9s12t64revision 1.1.1 motorola clocks and reset generator (crg) 325 self clock mode interrupt the crg generates a self clock mode interrupt when the scm condition of the system has changed, either entered or exited self clock mode. scm conditions can only change if the self clock mode enable bit (scme) is set to 1. scm conditions are caused by a failing clock quality check after power-on-reset (por) or recovery from full stop mode (pstp=0) or clock monitor failure. for details on the clock quality check refer to clock quality checker in page 301 . if the clock monitor is enabled (cme=1) a loss of external clock will also cause a scm condition (scme=1). scm interrupts are locally disabled by setting the scmie bit to zero. the scm interrupt flag (scmif) is set to1 when the scm condition has changed, and is cleared to 0 by writing a 1 to the scmif bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
clocks and reset generator (crg) mc9s12t64revision 1.1.1 326 clocks and reset generator (crg) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 327 pulse width modulator (pwm8b8c) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 low power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 overview the pwm_8b8c definition is based on the mc68hc11kd2 and the hc12 pwm definitions. this pwm_8b8c contains the basic features from the hc11 with some of the enhancements incorporated on the hc12. in addition, the module is now expanded to eight channels with independent control of left and center aligned outputs on each channel. in all basic functionality, it will behave similarly to the hc11 pwm with the additional hc12 pwm features of center aligned output mode and four available clock sources. the pwm_8b8c module contains eight channels. each of these channels has a programmable period and duty cycle as well as a dedicated counter. a flexible clock select scheme allows a total of four different clock sources to be used with the counters. each of the modulators can create independent continuous waveforms with f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 328 pulse width modulator (pwm8b8c) motorola software-selectable duty rates from 0% to 100%. the pwm outputs can be programmed as left aligned outputs or center aligned outputs. features eight independent pwm channels with programmable period and duty cycle. dedicated counter for each pwm channel. programmable pwm enable/disable for each channel. software selection of pwm duty pulse polarity for each channel. period and duty cycle are double buffered. change takes effect when the end of the effective period is reached (pwm counter reaches zero) or when the channel is disabled. programmable center or left aligned outputs on individual channels. eight 8-bit channel or four 16-bit channel pwm resolution. four clock sources (a, b, sa and sb) provide for a wide range of frequencies. programmable clock select logic. emergency shutdown. modes of operation normal modes the pwm module behaves as described within this specification in all normal modes. special modes the pwm module behaves as described within this specification in all special modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) modes of operation mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 329 warning: while in special modes, do not access registers $0006, $0007, $000a and $000b. writing to any of these registers can alter the pwm functionality. freeze mode the pwm module enters freeze mode when background debug mode (bdm) is active. emulation modes in freeze mode, there is an option to disable the input clock to the prescaler by setting the pfrz bit in the pwmctl register. if this bit is set, whenever the mcu is in freeze mode the input clock to the prescaler is disabled. this feature is useful during emulation as it allows the pwm function to be suspended. in this way, the counters of the pwm can be stopped while in freeze mode so that once normal program flow is continued, the counters are re-enabled to simulate real-time operations. since the registers can still be accessed in this mode, to re-enable the prescaler clock, either disable the pfrz bit or exit freeze mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 330 pulse width modulator (pwm8b8c) motorola block diagram figure 58 pwm8b8c block diagram period and duty counter channel 6 clock select pwm clock period and duty counter channel 5 period and duty counter channel 4 period and duty counter channel 3 period and duty counter channel 2 period and duty counter channel 1 alignment polarity control pwm_8b8c pwm6 pwm5 pwm4 pwm3 pwm2 pwm1 enable pwm channels period and duty counter channel 7 period and duty counter channel 0 pwm0 pwm7 bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) external pin descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 331 external pin descriptions the pwm8b8c module has a total of 8 external pins. pwm7 (pp7) pwm8b8c channel 7 - this pin serves as waveform output of pwm channel 7 and as an input for the emergency shutdown feature. pwm6 (pp6) pwm8b8c channel 6 - this pin serves as waveform output of pwm channel 6. pwm5 (pp5) pwm8b8c channel 5 - this pin serves as waveform output of pwm channel 5. pwm4 (pp4) pwm8b8c channel 4 - this pin serves as waveform output of pwm channel 4. pwm3 (pp3) pwm8b8c channel 3 - this pin serves as waveform output of pwm channel 3. pwm2 (pp2) pwm8b8c channel 2 - this pin serves as waveform output of pwm channel 2. pwm1 (pp1) pwm8b8c channel 1 - this pin serves as waveform output of pwm channel 1. pwm0 (pp0) pwm8b8c channel 0 - this pin serves as waveform output of pwm channel 0. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 332 pulse width modulator (pwm8b8c) motorola register map this section describes the content of the registers in the pwm. the figure below shows the registers associated with the pwm and their relative offset from the base address. the register detail description follows the order they appear in the register map. reserved bits within a register will always read as 0 and the write will be unimplemented. unimplemented functions are indicated by shaded bits. register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 address offset pwme read: pwme7 pwme6 pwme5 pwme4 pwme3 pwme2 pwme1 pwme0 $00a0 write: pwmpol read: ppol7 ppol6 ppol5 ppol4 ppol3 ppol2 ppol1 ppol0 $00a1 write: pwmclk read: pclk7 pclkl6 pclk5 pclk4 pclk3 pclk2 pclk1 pclk0 $00a2 write: pwmprclk read: 0 pckb2 pckb1 pckb0 0 pcka2 pcka1 pcka0 $00a3 write: pwmcae read: cae7 cae6 cae5 cae4 cae3 cae2 cae1 cae0 $00a4 write: pwmctl read: con67 con45 con23 con01 pswai pfrz 00 $00a5 write: reserved for factory test read: reads to this register return unpredictable values. $00a6 write: reserved for factory test read: reads to this register return unpredictable values. $00a7 write: pwmscla read: bit 7 6 5 4 3 2 1 bit 0 $00a8 write: pwmsclb read: bit 7 6 5 4 3 2 1 bit 0 $00a9 write: reserved for factory test read: reads to this register return unpredictable values. $00aa write: reserved for factory test read: reads to this register return unpredictable values. $00ab write: pwmcnt0 read: bit 7 6 5 4 3 2 1 bit 0 $00ac write: 0 0 0 0000 0 pwmcnt1 read: bit 7 6 5 4 3 2 1 bit 0 $00ad write: 0 0 0 0000 0 = unimplemented figure 59 pwm register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register map mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 333 pwmcnt2 read: bit 7 6 5 4 3 2 1 bit 0 $00ae write: 0 0 0 0000 0 pwmcnt3 read: bit 7 6 5 4 3 2 1 bit 0 $00af write: 0 0 0 0000 0 pwmcnt4 read: bit 7 6 5 4 3 2 1 bit 0 $00b0 write: 0 0 0 0000 0 pwmcnt5 read: bit 7 6 5 4 3 2 1 bit 0 $00b1 write: 0 0 0 0000 0 pwmcnt6 read: bit 7 6 5 4 3 2 1 bit 0 $00b2 write: 0 0 0 0000 0 pwmcnt7 read: bit 7 6 5 4 3 2 1 bit 0 $00b3 write: 0 0 0 0000 0 pwmper0 read: bit 7 6 5 4 3 2 1 bit 0 $00b4 write: pwmper1 read: bit 7 6 5 4 3 2 1 bit 0 $00b5 write: pwmper2 read: bit 7 6 5 4 3 2 1 bit 0 $00b6 write: pwmper3 read: bit 7 6 5 4 3 2 1 bit 0 $00b7 write: pwmper4 read: bit 7 6 5 4 3 2 1 bit 0 $00b8 write: pwmper5 read: bit 7 6 5 4 3 2 1 bit 0 $00b9 write: pwmper6 read: bit 7 6 5 4 3 2 1 bit 0 $00ba write: pwmper7 read: bit 7 6 5 4 3 2 1 bit 0 $00bb write: pwmdty0 read: bit 7 6 5 4 3 2 1 bit 0 $00bc write: pwmdty1 read: bit 7 6 5 4 3 2 1 bit 0 $00bd write: pwmdty2 read: bit 7 6 5 4 3 2 1 bit 0 $00be write: pwmdty3 read: bit 7 6 5 4 3 2 1 bit 0 $00bf write: pwmdty4 read: bit 7 6 5 4 3 2 1 bit 0 $00c0 write: pwmdty5 read: bit 7 6 5 4 3 2 1 bit 0 $00c1 write: register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 address offset = unimplemented figure 59 pwm register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 334 pulse width modulator (pwm8b8c) motorola note: register address = base address (initrg) + address offset register descriptions this section describes in detail all the registers and register bits in the pwm module. note: all bits of all registers in this module are completely synchronous to internal clocks during a register read. pwmdty6 read: bit 7 6 5 4 3 2 1 bit 0 $00c2 write: pwmdty7 read: bit 7 6 5 4 3 2 1 bit 0 $00c3 write: pwmsdn read: pwmif pwmie 0 pwmlvl 0 pwm7in pwm7inl pwm7ena $00c4 write: pwmrstrt reserved read: 0 0 0 0000 0 $00c5 write: reserved read: 0 0 0 0000 0 $00c6 write: reserved read: 0 0 0 0000 0 $00c7 write: register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 address offset = unimplemented figure 59 pwm register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 335 pwm enable register (pwme) each pwm channel has an enable bit (pwmex) to start its waveform output. when any of the pwmex bits are set (pwmex=1), the associated pwm output is enabled immediately. however, the actual pwm waveform is not available on the associated pwm output until its clock source begins its next cycle due to the synchronization of pwmex and the clock source. the first pwm cycle after enabling the channel can be irregular. an exception to this is when channels are concatenated. once concatenated mode is enabled (conxx bits set in pwmctl register) then enabling/disabling the corresponding 16-bit pwm channel is controlled by the low order pwmex bit. in this case, the high order bytes pwmex bits have no effect and their corresponding pwm output lines are disabled. while in run mode, if all eight pwm channels are disabled pwmex=0), the prescaler counter shuts off for power savings. read: anytime write: anytime pwme7 ?pulse width channel 7 enable 1 = pulse width channel 7 is enabled. the pulse modulated signal becomes available at pwm output bit7 when its clock source begins its next cycle. 0 = pulse width channel 7 is disabled. pwme6 ?pulse width channel 6 enable address offset: $00a0 bit 7 654321 bit 0 read: pwme7 pwme6 pwme5 pwme4 pwme3 pwme2 pwme1 pwme0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 336 pulse width modulator (pwm8b8c) motorola 1 = pulse width channel 6 is enabled. the pulse modulated signal becomes available at port pwm output bit6 when its clock source begins its next cycle. if con67=1, then bit has no effect and pwm output bit6 is disabled. 0 = pulse width channel 6 is disabled. pwme5 ?pulse width channel 5 enable 1 = pulse width channel 5 is enabled. the pulse modulated signal becomes available at pwm output bit 5 when its clock source begins its next cycle. 0 = pulse width channel 5 is disabled. pwme4 ?pulse width channel 4 enable 1 = pulse width channel 4 is enabled. the pulse modulated signal becomes available at pwm output bit 4 when its clock source begins its next cycle. if con45=1, then bit has no effect and pwm output bit4 is disabled. 0 = pulse width channel 4 is disabled. pwme3 ?pulse width channel 3 enable 1 = pulse width channel 3 is enabled. the pulse modulated signal becomes available at pwm output bit 3 when its clock source begins its next cycle. 0 = pulse width channel 3 is disabled. pwme2 ?pulse width channel 2 enable 1 = pulse width channel 2 is enabled. the pulse modulated signal becomes available at pwm output bit 2 when its clock source begins its next cycle. if con23=1, then bit has no effect and pwm output bit2 is disabled. 0 = pulse width channel 2 is disabled. pwme1 ?pulse width channel 1 enable 1 = pulse width channel 1 is enabled. the pulse modulated signal becomes available at pwm output bit 1 when its clock source begins its next cycle. 0 = pulse width channel 1 is disabled. pwme0 ?pulse width channel 0 enable f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 337 1 = pulse width channel 0 is enabled. the pulse modulated signal becomes available at pwm, o/p bit 0 when its clock source begins its next cycle. if con01=1, then bit has no effect and pwm output bit0 is disabled. 0 = pulse width channel 0 is disabled. pwm polarity register (pwmpol) the starting polarity of each pwm channel waveform is determined by the associated ppolx bit in the pwmpol register. if the polarity bit is one, the pwm channel output is high at the beginning of the cycle and then goes low when the duty count is reached. conversely, if the polarity bit is zero, the output starts low and then goes high when the duty count is reached. read: anytime write: anytime caution: ppolx register bits can be written anytime. if the polarity is changed while a pwm signal is being generated, a truncated or stretched pulse can occur during the transition. ppol7 ?pulse width channel 7 polarity 1 = pwm channel 7 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 7 output is low at the beginning of the period, then goes high when the duty count is reached. ppol6 ?pulse width channel 6 polarity address offset: $00a1 bit 7 6 5 4 3 2 1 bit 0 read: ppol7 ppol6 ppol5 ppol4 ppol3 ppol2 ppol1 ppol0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 338 pulse width modulator (pwm8b8c) motorola 1 = pwm channel 6 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 6 output is low at the beginning of the period, then goes high when the duty count is reached. ppol5 ?pulse width channel 5 polarity 1 = pwm channel 5 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 5 output is low at the beginning of the period, then goes high when the duty count is reached. ppol4 ?pulse width channel 4 polarity 1 = pwm channel 4 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 4 output is low at the beginning of the period, then goes high when the duty count is reached. ppol3 ?pulse width channel 3 polarity 1 = pwm channel 3 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 3 output is low at the beginning of the period, then goes high when the duty count is reached. ppol2 ?pulse width channel 2 polarity 1 = pwm channel 2 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 2 output is low at the beginning of the period, then goes high when the duty count is reached. ppol1 ?pulse width channel 1 polarity 1 = pwm channel 1 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 1 output is low at the beginning of the period, then goes high when the duty count is reached. ppol0 ?pulse width channel 0 polarity 1 = pwm channel 0 output is high at the beginning of the period, then goes low when the duty count is reached. 0 = pwm channel 0 output is low at the beginning of the period, then goes high when the duty count is reached. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 339 pwm clock select register (pwmclk) each pwm channel has a choice of two clocks to use as the clock source for that channel as described below. read: anytime write: anytime caution: register bits pclk0 to pclk7 can be written anytime. if a clock select is changed while a pwm signal is being generated, a truncated or stretched pulse can occur during the transition. pclk7 ?pulse width channel 7 clock select 1 = clock sb is the clock source for pwm channel 7. 0 = clock b is the clock source for pwm channel 7. pclk6 ?pulse width channel 6 clock select 1 = clock sb is the clock source for pwm channel 6. 0 = clock b is the clock source for pwm channel 6. pclk5 ?pulse width channel 5 clock select 1 = clock sa is the clock source for pwm channel 5. 0 = clock a is the clock source for pwm channel 5. pclk4 ?pulse width channel 4 clock select 1 = clock sa is the clock source for pwm channel 4. 0 = clock a is the clock source for pwm channel 4. pclk3 ?pulse width channel 3 clock select 1 = clock sb is the clock source for pwm channel 3. 0 = clock b is the clock source for pwm channel 3. address offset: $00a2 bit 7 654321 bit 0 read: pclk7 pclkl6 pclk5 pclk4 pclk3 pclk2 pclk1 pclk0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 340 pulse width modulator (pwm8b8c) motorola pclk2 ?pulse width channel 2 clock select 1 = clock sb is the clock source for pwm channel 2. 0 = clock b is the clock source for pwm channel 2. pclk1 ?pulse width channel 1 clock select 1 = clock sa is the clock source for pwm channel 1. 0 = clock a is the clock source for pwm channel 1. pclk0 ?pulse width channel 0 clock select 1 = clock sa is the clock source for pwm channel 0. 0 = clock a is the clock source for pwm channel 0. pwm prescale clock select register (pwmprclk) this register selects the prescale clock source for clocks a and b independently. read: anytime write: anytime caution: pckb2? and pcka2? register bits can be written anytime. if the clock pre-scale is changed while a pwm signal is being generated, a truncated or stretched pulse can occur during the transition. pckb2?ckb0 ?prescaler select for clock b clock b is one of two clock sources which can be used for channels 2, 3, 6, or 7. these three bits determine the rate of clock b, as shown in the following table. address offset: $00a3 bit 7 654321 bit 0 read: 0 pckb2 pckb1 pckb0 0 pcka2 pcka1 pcka0 write: reset: 0 0000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 341 pcka2?cka0 ?prescaler select for clock a clock a is one of two clock sources which can be used for channels 0, 1, 4, or 5. these three bits determine the rate of clock a, as shown in the following table. table 60 clock b prescaler selects pckb2 pckb1 pckb0 value of clock b 0 0 0 bus clock 0 0 1 bus clock / 2 0 1 0 bus clock / 4 0 1 1 bus clock / 8 1 0 0 bus clock / 16 1 0 1 bus clock / 32 1 1 0 bus clock / 64 1 1 1 bus clock / 128 table 61 clock a prescaler selects pcka2 pcka1 pcka0 value of clock a 0 0 0 bus clock 0 0 1 bus clock / 2 0 1 0 bus clock / 4 0 1 1 bus clock / 8 1 0 0 bus clock / 16 1 0 1 bus clock / 32 1 1 0 bus clock / 64 1 1 1 bus clock / 128 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 342 pulse width modulator (pwm8b8c) motorola pwm center align enable register (pwmcae) the pwmcae register contains eight control bits for the selection of center aligned outputs or left aligned outputs for each pwm channel. if the caex bit is set to a one, the corresponding pwm output will be center aligned. if the caex bit is cleared, the corresponding pwm output will be left aligned. reference left aligned outputs and center aligned outputs for a more detailed description of the pwm output modes. read: anytime write: anytime caution: write these bits only when the corresponding channel is disabled. cae7 ?center aligned output mode on channel 7 1 = channel 7 operates in center aligned output mode. 0 = channel 7 operates in left aligned output mode. cae6 ?center aligned output mode on channel 6 1 = channel 6 operates in center aligned output mode. 0 = channel 6 operates in left aligned output mode. cae5 ?center aligned output mode on channel 5 1 = channel 5 operates in center aligned output mode. 0 = channel 5 operates in left aligned output mode. cae4 ?center aligned output mode on channel 4 1 = channel 4 operates in center aligned output mode. 0 = channel 4 operates in left aligned output mode. cae3 ?center aligned output mode on channel 3 1 = channel 3 operates in center aligned output mode. 0 = channel 3 operates in left aligned output mode. address offset: $00a4 bit 7 6 5 4 3 2 1 bit 0 read: cae7 cae6 cae5 cae4 cae3 cae2 cae1 cae0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 343 cae2 ?center aligned output mode on channel 2 1 = channel 2 operates in center aligned output mode. 0 = channel 2 operates in left aligned output mode. cae1 ?center aligned output mode on channel 1 1 = channel 1 operates in center aligned output mode. 0 = channel 1 operates in left aligned output mode. cae0 ?center aligned output mode on channel 0 1 = channel 0 operates in center aligned output mode. 0 = channel 0 operates in left aligned output mode. pwm control register (pwmctl) the pwmctl register provides for various control of the pwm module. read: anytime write: anytime there are three control bits for concatenation, each of which is used to concatenate a pair of pwm channels into one 16-bit channel. when channels 6 and 7 are concatenated, channel 6 registers become the high order bytes of the double byte channel as shown in figure 66 . similarly, when channels 4 and 5 are concatenated, channel 4 registers become the high order bytes of the double byte channel. when channels 2 and 3 are concatenated, channel 2 registers become the high order bytes of the double byte channel. when channels 0 and 1 are concatenated, channel 0 registers become the high order bytes of the double byte channel. reference pwm 16-bit functions for a more detailed description of the concatenation pwm function. address offset: $00a5 bit 7 6 5 4 3 2 1 bit 0 read: con67 con45 con23 con01 pswai pfrz 00 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 344 pulse width modulator (pwm8b8c) motorola caution: change these bits only when both corresponding channels are disabled. con67 ?concatenate channels 6 and 7 1 = channels 6 and 7 are concatenated to create one 16-bit pwm channel. channel 6 becomes the high order byte and channel 7 becomes the low order byte. channel 7 output pin is used as the output for this 16-bit pwm (bit 7 of port pwmp). channel 7 clock select control-bit determines the clock source, channel 7 polarity bit determines the polarity, channel 7 enable bit enables the output and channel 7 center aligned enable bit determines the output mode. 0 = channels 6 and 7 are separate 8-bit pwms. con45 ?concatenate channels 4 and 5 1 = channels 4 and 5 are concatenated to create one 16-bit pwm channel. channel 4 becomes the high order byte and channel 5 becomes the low order byte. channel 5 output pin is used as the output for this 16-bit pwm (bit 5 of port pwmp). channel 5 clock select control-bit determines the clock source, channel 5 polarity bit determines the polarity, channel 5 enable bit enables the output and channel 5 center aligned enable bit determines the output mode. 0 = channels 4 and 5 are separate 8-bit pwms. con23 ?concatenate channels 2 and 3 1 = channels 2 and 3 are concatenated to create one 16-bit pwm channel. channel 2 becomes the high order byte and channel 3 becomes the low order byte. channel 3 output pin is used as the output for this 16-bit pwm (bit 3 of port pwmp). channel 3 clock select control-bit determines the clock source, channel 3 polarity bit determines the polarity, channel 3 enable bit enables the output and channel 3 center aligned enable bit determines the output mode. 0 = channels 2 and 3 are separate 8-bit pwms. con01 ?concatenate channels 0 and 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 345 1 = channels 0 and 1 are concatenated to create one 16-bit pwm channel. channel 0 becomes the high order byte and channel 1 becomes the low order byte. channel 1 output pin is used as the output for this 16-bit pwm (bit 1 of port pwmp). channel 1 clock select control-bit determines the clock source, channel 1 polarity bit determines the polarity, channel 1 enable bit enables the output and channel 1 center aligned enable bit determines the output mode. 0 = channels 0 and 1 are separate 8-bit pwms. pswai ?pwm stops in wait mode enabling this bit allows for lower power consumption in wait mode by disabling the input clock to the prescaler. 1 = stop the input clock to the prescaler whenever the mcu is in wait mode. 0 = allow the clock to the prescaler to continue while in wait mode. pfrz ?pwm counters stop in freeze mode in freeze mode, there is an option to disable the input clock to the prescaler by setting the pfrz bit in the pwmctl register. if this bit is set, whenever the mcu is in freeze mode the input clock to the prescaler is disabled. this feature is useful during emulation as it allows the pwm function to be suspended. in this way, the counters of the pwm can be stopped while in freeze mode so that once normal program flow is continued, the counters are re-enabled to simulate real-time operations. since the registers can still be accessed in this mode, to re-enable the prescaler clock, either disable the pfrz bit or exit freeze mode. 1 = disable pwm input clock to the prescaler whenever the part is in freeze mode. this is useful for emulation. 0 = allow pwm to continue while in freeze mode. note: the pwm module enters freeze mode when background debug mode (bdm) is active. refer to the fast background debug module (fbdm) section about the background debug mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 346 pulse width modulator (pwm8b8c) motorola pwm scale a register (pwmscla) pwmscla is the programmable scale value used in scaling clock a to generate clock sa. clock sa is generated by taking clock a, dividing it by the value in the pwmscla register and dividing that by two. clock sa = clock a / (2 * pwmscla) note: when pwmscla = $00, pwmscla value is considered a full scale value of 256. clock a is thus divided by 512. any value written to this register will cause the scale counter to load the new scale value (pwmscla) . read: anytime write: anytime (causes the scale counter to load the pwmscla value) pwm scale b register (pwmsclb) pwmsclb is the programmable scale value used in scaling clock b to generate clock sb. clock sb is generated by taking clock b, dividing it by the value in the pwmsclb register and dividing that by two. clock sb = clock b / (2 * pwmsclb) address offset: $00a8 bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 address offset: $00a9 bit 7 654321 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 347 note: when pwmsclb = $00, pwmsclb value is considered a full scale value of 256. clock b is thus divided by 512. any value written to this register will cause the scale counter to load the new scale value (pwmsclb) . read: anytime write: anytime (causes the scale counter to load the pwmsclb value) pwm channel counter registers (pwmcntx) where: x=0,1,2,3,4,5,6,7 read: anytime write: anytime (any value written causes pwm counter to be reset to $00) each channel has a dedicated 8-bit up/down counter which runs at the rate of the selected clock source. the counter can be read at any time without affecting the count or the operation of the pwm channel. in left aligned output mode, the counter counts from 0 to the value in the period register 1. in center aligned output mode, the counter counts from 0 up to the value in the period register and then back down to 0. any value written to the counter causes the counter to reset to $00, the counter direction to be set to up, the immediate load of both duty and period registers with values from the buffers, and the output to change according to the polarity bit. the counter is also cleared at the end of the effective period (see sections left aligned outputs and center aligned outputs for more details). when the channel is disabled (pwmex=0), the pwmcntx register does not count. when a channel becomes enabled (pwmex=1), the associated pwm counter starts at the count in address offset: $00ac, $00ad, $00ae,$00af, $00b0, $00b1, $00b2, $00b3 bit 7 654321 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: 00000000 reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 348 pulse width modulator (pwm8b8c) motorola the pwmcntx register. for more detailed information on the operation of the counters, reference pwm timer counters . in concatenated mode, writes to the 16-bit counter by using a 16-bit access or writes to either the low or high order byte of the counter will reset the 16-bit counter. reads of the 16-bit counter must be made by 16-bit access to maintain data coherency caution: writing to the counter while the channel is enabled can cause an irregular pwm cycle to occur. pwm channel period registers (pwmperx) where: x=0,1,2,3,4,5,6,7 read: anytime write: anytime there is a dedicated period register for each channel. the value in this register determines the period of the associated pwm channel. the period registers for each channel are double buffered so that if they change while the channel is enabled, the change will not take effect until one of the following occurs: the effective period ends the counter is written (counter resets to $00) the channel is disabled in this way, the output of the pwm will always be either the old waveform or the new waveform, not some variation in between. if the channel is not enabled, then writes to the period register will go directly to the latches as well as the buffer. address offset: $00b4, $00b5, $00b6,$00b7, $00b8, $00b9, $00ba, $00bb bit 7 654321 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 11111111 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 349 note: reads of this register return the most recent value written. reads do not necessarily return the value of the currently active period due to the double buffering scheme. reference pwm period and duty for more information. to calculate the output period, take the selected clock source period for the channel of interest (a, b, sa, or sb) and multiply it by the value in the period register for that channel: left aligned output (caex=0) pwmx period = channel clock period * pwmperx center aligned output (caex=1) pwmx period = channel clock period * (2 * pwmperx) for boundary case programming values, please refer to pwm boundary cases . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 350 pulse width modulator (pwm8b8c) motorola pwm channel duty registers (pwmdtyx) where: x=0,1,2,3,4,5,6,7 read: anytime write: anytime there is a dedicated duty register for each channel. the value in this register determines the duty of the associated pwm channel. the duty value is compared to the counter and if it is equal to the counter value a match occurs and the output changes state. the duty registers for each channel are double buffered so that if they change while the channel is enabled, the change will not take effect until one of the following occurs: the effective period ends the counter is written (counter resets to $00) the channel is disabled in this way, the output of the pwm will always be either the old duty waveform or the new duty waveform, not some variation in between. if the channel is not enabled, then writes to the duty register will go directly to the latches as well as the buffer. note: reads of this register return the most recent value written. reads do not necessarily return the value of the currently active duty due to the double buffering scheme. reference pwm period and duty for more information. note: depending on the polarity bit, the duty registers will contain the count of either the high time or the low time. if the polarity bit is one, the output starts high and then goes low when the duty count is reached, so the address offset: $00bc, $00bd, $00be,$00bf, $00c0, $00c1, $00c2, $00c3 bit 7 654321 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 11111111 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) register descriptions mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 351 duty registers contain a count of the high time. if the polarity bit is zero, the output starts low and then goes high when the duty count is reached, so the duty registers contain a count of the low time. to calculate the output duty cycle (high time as a% of period) for a particular channel: polarity = 0 (ppolx=0) duty cycle = [(pwmperx-pwmdtyx)/pwmperx] * 100% polarity = 1 (ppolx=1) duty cycle = [pwmdtyx / pwmperx] * 100% for boundary case programming values, please refer to pwm boundary cases . pwm shutdown and interrupt control register (pwmsdn) the pwmsdn register provides for the shutdown functionality of the pwm module in the emergency cases. interruptions are enabled and monitored through this register. read: anytime write: anytime pwmif ?pwm interrupt flag any change from passive to asserted (active) state or from active to passive state will be flagged by setting the pwmif flag = 1. the flag is cleared by writing a ??to it. writing a ??has no effect. address offset: $00c4 bit 7 6 5 4 3 2 1 bit 0 read: pwmif pwmie 0 pwmlvl 0 pwm7in pwm7inl pwm7ena write: pwmrstrt reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 352 pulse width modulator (pwm8b8c) motorola 1 = change on pwm7in input 0 = no change on pwm7in input. pwmie ?pwm interrupt enable if interrupt is enabled an interrupt to the cpu is asserted. 1 = pwm interrupt is enabled. 0 = pwm interrupt is disabled. pwmrstrt ?pwm restart. the pwm can only be restarted if the pwm channel input 7 is de-asserted. after writing a ??to the pwmrstrt bit (trigger event) the pwm channels start running after the corresponding counter passes next ?ounter == 0?phase. also if the pwm7ena bit is reset to 0, the pwm do not start before the counter passes $00. the bit is always read as ?? pwmlvl ?pwm shutdown output level. if active level as defined by the pwm7in input, gets asserted all enabled pwm channels are immediately driven to the level defined by pwmlvl. 1 = pwm outputs are forced to 1. 0 = pwm outputs are forced to 0 pwm7in ?pwm channel 7 input status. this reflects the current status of the pwm7 pin. pwm7inl ?pwm shutdown active input level for ch. 7. if the emergency shutdown feature is enabled (pwm7ena = 1), this bit determines the active level of the pwm7channel. 1 = active level is high 0 = active level is low pwm7ena ?pwm emergency shutdown enable if this bit is ? the pin associated with channel 7 is forced to input and the emergency shutdown feature is enabled.all the other bits in this register are meaningful only if pwm7ena = 1. 1 = pwm emergency feature is enabled. 0 = pwm emergency feature disabled. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 353 functional description pwm clock select there are four available clocks called clock a, clock b, clock sa (scaled a), and clock sb (scaled b). these four clocks are based on the bus clock. clock a and b can be software selected to be 1, 1/2, 1/4, 1/8,..., 1/64, 1/128 times the bus clock. clock sa uses clock a as an input and divides it further with a reloadable counter. similarly, clock sb uses clock b as an input and divides it further with a reloadable counter. the rates available for clock sa are software selectable to be clock a divided by 2, 4, 6, 8,..., or 512 in increments of divide by 2. similar rates are available for clock sb. each pwm channel has the capability of selecting one of two clocks, either the pre-scaled clock (clock a or b) or the scaled clock (clock sa or sb). the block diagram in figure 60 shows the four different clocks and how the scaled clocks are created. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 354 pulse width modulator (pwm8b8c) motorola figure 60 pwm clock select block diagram 2 4 8 163264128 pckb2 pckb1 pckb0 m u x clock a clock b clock sa clock a/2, a/4, a/6,....a/512 prescale scale divide by prescaler taps: pfrz fipg_freeze clock select m u x pclk0 clock to pwm ch 0 m u x pclk2 clock to pwm ch 2 m u x pclk1 clock to pwm ch 1 m u x pclk4 clock to pwm ch 4 m u x pclk5 clock to pwm ch 5 m u x pclk6 clock to pwm ch 6 m u x pclk7 clock to pwm ch 7 m u x pclk3 clock to pwm ch 3 load div 2 pwmsclb 8-bit down counter clock sb clock b/2, b/4, b/6,....b/512 m u x pcka2 pcka1 pcka0 pwme7-0 count=1 load div 2 pwmscla 8-bit down counter count=1 bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 355 prescale the input clock to the pwm prescaler is the bus clock. it can be disabled whenever the part is in freeze mode by setting the pfrz bit in the pwmctl register. if this bit is set, whenever the mcu is in freeze mode the input clock to the prescaler is disabled. this is useful for emulation in order to freeze the pwm. the input clock can also be disabled when all eight pwm channels are disabled (pwmex=0 in the pwme register; where x=0,1,...,7). this is useful for reducing power by disabling the prescale counter. clock a and clock b are scaled values of the input clock. the value is software selectable for both clock a and clock b and has options of 1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, or 1/128 times the bus clock. the value selected for clock a is determined by the pcka2, pcka1, pcka0 bits in the pwmprclk register. the value selected for clock b is determined by the pckb2, pckb1, pckb0 bits also in the pwmprclk register. clock scale the scaled a clock uses clock a as an input and divides it further with a user programmable value and then divides this by 2. the scaled b clock uses clock b as an input and divides it further with a user programmable value and then divides this by 2. the rates available for clock sa are software selectable to be clock a divided by 2, 4, 6, 8,..., or 512 in increments of divide by 2. similar rates are available for clock sb. clock a is used as an input to an 8-bit down counter. this down counter loads a user programmable scale value from the scale register (pwmscla). when the down counter reaches one, two things happen; a pulse is output and the 8-bit counter is re-loaded. the output signal from this circuit is further divided by two. this gives a greater range with only a slight reduction in granularity. clock sa equals clock a divided by two times the value in the pwmscla register. note: clock sa = clock a / (2 * pwmscla) when pwmscla = $00, pwmscla value is considered a full scale value of 256. clock a is thus divided by 512. similarly, clock b is used as an input to an 8-bit down counter followed by a divide by two producing clock sb. thus, clock sb equals clock b divided by two times the value in the pwmsclb register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 356 pulse width modulator (pwm8b8c) motorola note: clock sb = clock b / (2 * pwmsclb) when pwmsclb = $00, pwmsclb value is considered a full scale value of 256. clock b is thus divided by 512. as an example, consider the case in which the user writes $ff into the pwmscla register. clock a for this case will be the bus clock divided by 4. a pulse will occur at a rate of once every 255x4 bus clock cycles. passing this through the divide by two circuit produces a clock signal that is the bus clock divided by 2040 rate. similarly, a value of $01 in the pwmscla register, when clock a is the bus clock divided by 4, will produce a clock that is the bus clock divided by 8 rate. writing to pwmscla or pwmsclb causes the associated 8-bit down counter to be re-loaded. otherwise, when changing rates the counter would have to count down to $01 before counting at the proper rate. forcing the associated counter to re-load the scale register value every time pwmscla or pwmsclb is written prevents this. caution: writing to the scale registers while channels are operating can cause irregularities in the pwm outputs. clock select each pwm channel has the capability of selecting one of two clocks. for channels 0, 1, 4, and 5 the clock choices are clock a or clock sa. for channels 2, 3, 6, and 7 the choices are clock b or clock sb. the clock selection is done with the pclkx control bits in the pwmclk register. caution: changing clock control bits while channels are operating can cause irregularities in the pwm outputs. pwm channel timers the main part of the pwm module are the actual timers. each of the timer channels has a counter, a period register and a duty register (each are 8-bit). the waveform output period is controlled by a match between the period register and the value in the counter. the duty is controlled by a match between the duty register and the counter value and causes the state of the output to change during the period. the starting polarity of the output is also selectable on a per channel basis. shown below in figure 61 is the block diagram for the pwm timer f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 357 figure 61 pwm timer channel block diagram pwm enable each pwm channel has an enable bit (pwmex) to start its waveform output. when any of the pwmex bits are set (pwmex=1), the associated pwm output signal is enabled immediately. however, the actual pwm waveform is not available on the associated pwm output until its clock source begins its next cycle due to the synchronization of pwmex and the clock source. an exception to this is when channels are concatenated. refer to pwm 16-bit functions for more detail. caution: the first pwm cycle after enabling the channel can be irregular. on the front end of the pwm timer, the clock is enabled to the pwm circuit by the pwmex bit being high. there is an edge-synchronizing circuit to guarantee that the clock will only be enabled or disabled at an clock source t r q q m u ppolx from port pwmp data register pwmex (clock edge sync) to pin driver gate 8-bit compare = pwmdtyx 8-bit compare = pwmperx m u caex up/down t r q q reset 8-bit counter pwmcntx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 358 pulse width modulator (pwm8b8c) motorola edge. when the channel is disabled (pwmex=0), the counter for the channel does not count. pwm polarity each channel has a polarity bit to allow starting a waveform cycle with a high or low signal. this is shown on the block diagram as a mux select of either the q output or the q output of the pwm output flip flop in figure 61 . when one of the bits in the pwmpol register is set, the associated pwm channel output is high at the beginning of the waveform, then goes low when the duty count is reached. conversely, if the polarity bit is zero, the output starts low and then goes high when the duty count is reached. pwm period and duty dedicated period and duty registers exist for each channel and are double buffered so that if they change while the channel is enabled, the change will not take effect until one of the following occurs: the effective period ends the counter is written (counter resets to $00) the channel is disabled in this way, the output of the pwm will always be either the old waveform or the new waveform, not some variation in between. if the channel is not enabled, then writes to the period and duty registers will go directly to the latches as well as the buffer. a change in duty or period can be forced into effect ?mmediately?by writing the new value to the duty and/or period registers and then writing to the counter. this forces the counter to reset and the new duty and/or period values to be latched. in addition, since the counter is readable it is possible to know where the count is with respect to the duty value and software can be used to make adjustments caution: when forcing a new period or duty into effect immediately, an irregular pwm cycle can occur. note: depending on the polarity bit, the duty registers will contain the count of either the high time or the low time. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 359 pwm timer counters each channel has a dedicated 8-bit up/down counter which runs at the rate of the selected clock source (reference pwm clock select for the available clock sources and rates). the counter compares to two registers, a duty register and a period register as shown in figure 61 . when the pwm counter matches the duty register the output flip-flop changes state causing the pwm waveform to also change state. a match between the pwm counter and the period register behaves differently depending on what output mode is selected as shown in figure 61 and described in left aligned outputs and center aligned outputs . each channel counter can be read at anytime without affecting the count or the operation of the pwm channel. any value written to the counter causes the counter to reset to $00, the counter direction to be set to up, the immediate load of both duty and period registers with values from the buffers, and the output to change according to the polarity bit. when the channel is disabled (pwmex=0), the counter stops. when a channel becomes enabled (pwmex=1), the associated pwm counter continues from the count in the pwmcntx register. this allows the waveform to continue where it left off when the channel is re-enabled. when the channel is disabled, writing ??to the period register will cause the counter to reset on the next selected clock. note: if the user wants to start a new ?lean?pwm waveform without any ?istory?from the old waveform, the user must write to channel counter (pwmcntx) prior to enabling the pwm channel (pwmex=1). generally, writes to the counter are done prior to enabling a channel in order to start from a known state. however, writing a counter can also be done while the pwm channel is enabled (counting). the effect is similar to writing the counter when the channel is disabled except that the new period is started immediately with the output set according to the polarity bit. caution: writing to the counter while the channel is enabled can cause an irregular pwm cycle to occur. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 360 pulse width modulator (pwm8b8c) motorola the counter is cleared at the end of the effective period (see left aligned outputs and center aligned outputs for more details). left aligned outputs the pwm timer provides the choice of two types of outputs, left aligned or center aligned outputs. they are selected with the caex bits in the pwmcae register. if the caex bit is cleared (caex=0), the corresponding pwm output will be left aligned. in left aligned output mode, the 8-bit counter is configured as an up counter only. it compares to two registers, a duty register and a period register as shown in the block diagram in figure 61 . when the pwm counter matches the duty register the output flip-flop changes state causing the pwm waveform to also change state. a match between the pwm counter and the period register resets the counter and the output flip-flop as shown in figure 61 as well as performing a load from the double buffer period and duty register to the associated registers as described in pwm period and duty . the counter counts from 0 to the value in the period register ?1. note: changing the pwm output mode from left aligned output to center aligned output (or vice versa) while channels are operating can cause irregularities in the pwm output. it is recommended to program the output mode before enabling the pwm channel. table 62 pwm timer counter conditions counter clears ($00) counter counts counter stops when pwmcntx register written to any value when pwm channel is enabled (pwmex=1). counts from last value in pwmcntx. when pwm channel is disabled (pwmex=0) effective period ends f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 361 figure 62 pwm left aligned output waveform to calculate the output frequency in left aligned output mode for a particular channel, take the selected clock source frequency for the channel (a, b, sa, or sb) and divide it by the value in the period register for that channel. pwmx frequency = clock (a, b, sa, or sb) / pwmperx pwmx duty cycle (high time as a% of period): polarity = 0 (ppolx=0) duty cycle = [(pwmperx-pwmdtyx)/pwmperx] * 100% polarity = 1 (ppolx=1) duty cycle = [pwmdtyx / pwmperx] * 100% as an example of a left aligned output, consider the following case: clock source = bus clock, where bus clock=10mhz (100ns period) ppolx = 0 pwmperx = 4 pwmdtyx = 1 pwmx frequency = 10mhz/4 = 2.5mhz pwmx period = 400ns pwmx duty cycle = 3/4 *100% = 75% the output waveform generated is shown in figure 63 . pwmdtyx period = pwmperx ppolx=0 ppolx=1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 362 pulse width modulator (pwm8b8c) motorola figure 63 pwm left aligned output example waveform center aligned outputs for center aligned output mode selection, set the caex bit (caex=1) in the pwmcae register and the corresponding pwm output will be center aligned. the 8-bit counter operates as an up/down counter in this mode and is set to up whenever the counter is equal to $00. the counter compares to two registers, a duty register and a period register as shown in the block diagram in figure 61 . when the pwm counter matches the duty register the output flip-flop changes state causing the pwm waveform to also change state. a match between the pwm counter and the period register changes the counter direction from an up-count to a down-count. when the pwm counter decrements and matches the duty register again, the output flip-flop changes state causing the pwm output to also change state. when the pwm counter decrements and reaches zero, the counter direction changes from a down-count back to an up-count and a load from the double buffer period and duty registers to the associated registers is performed as described in pwm period and duty . the counter counts from 0 up to the value in the period register and then back down to 0. thus the effective period is pwmperx*2. note: changing the pwm output mode from left aligned output to center aligned output (or vice versa) while channels are operating can cause irregularities in the pwm output. it is recommended to program the output mode before enabling the pwm channel. period = 400ns e=100ns duty cycle = 75% f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 363 figure 64 pwm center aligned output waveform to calculate the output frequency in center aligned output mode for a particular channel, take the selected clock source frequency for the channel (a, b, sa, or sb) and divide it by twice the value in the period register for that channel. pwmx frequency = clock (a, b, sa, or sb) / (2*pwmperx) pwmx duty cycle (high time as a% of period): polarity = 0 (ppolx=0) duty cycle = [(pwmperx-pwmdtyx)/pwmperx] * 100% polarity = 1 (ppolx=1) duty cycle = [pwmdtyx / pwmperx] * 100% as an example of a center aligned output, consider the following case: clock source = bus clock, where bus clock =10mhz (100ns period) ppolx = 0 pwmperx = 4 pwmdtyx = 1 pwmx frequency = 10mhz/8 = 1.25mhz pwmx period = 800ns pwmx duty cycle = 3/4 *100% = 75% the output waveform generated is shown in figure 65 ppolx=0 ppolx=1 period = pwmperx*2 pwmdtyx pwmdtyx pwmperx pwmperx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 364 pulse width modulator (pwm8b8c) motorola figure 65 pwm center aligned output example waveform pwm 16-bit functions the pwm timer also has the option of generating 8-channels of 8-bits or 4-channels of 16-bits for greater pwm resolution. this 16-bit channel option is achieved through the concatenation of two 8-bit channels. the pwmctl register contains four control bits, each of which is used to concatenate a pair of pwm channels into one 16-bit channel. channels 6 and 7 are concatenated with the con67 bit, channels 4 and 5 are concatenated with the con45 bit, channels 2 and 3 are concatenated with the con23 bit, and channels 0 and 1 are concatenated with the con01 bit. caution: change these bits only when both corresponding channels are disabled. when channels 6 and 7 are concatenated, channel 6 registers become the high order bytes of the double byte channel as shown in figure 66 . similarly, when channels 4 and 5 are concatenated, channel 4 registers become the high order bytes of the double byte channel. when channels 2 and 3 are concatenated, channel 2 registers become the high order bytes of the double byte channel. when channels 0 and 1 are concatenated, channel 0 registers become the high order bytes of the double byte channel. period = 800ns e=100ns duty cycle = 75% e=100ns f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 365 figure 66 pwm 16-bit mode when using the 16-bit concatenated mode, the clock source is determined by the low order 8-bit channel clock select control bits. that is channel 7 when channels 6 and 7 are concatenated, channel 5 when channels 4 and 5 are concatenated, channel 3 when channels 2 and 3 pwmcnt6 pwcnt7 pwm7 clock source 7 high low period/duty compare pwmcnt4 pwcnt5 pwm5 clock source 5 high low period/duty compare pwmcnt2 pwcnt3 pwm3 clock source 3 high low period/duty compare pwmcnt0 pwcnt1 pwm1 clock source 1 high low period/duty compare f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 366 pulse width modulator (pwm8b8c) motorola are concatenated, and channel 1 when channels 0 and 1 are concatenated. the resulting pwm is output to the pins of the corresponding low order 8-bit channel as also shown in figure 66 . the polarity of the resulting pwm output is controlled by the ppolx bit of the corresponding low order 8-bit channel as well. once concatenated mode is enabled (conxx bits set in pwmctl register) then enabling/disabling the corresponding 16-bit pwm channel is controlled by the low order pwmex bit. in this case, the high order bytes pwmex bits have no effect and their corresponding pwm output is disabled. in concatenated mode, writes to the 16-bit counter by using a 16-bit access or writes to either the low or high order byte of the counter will reset the 16-bit counter. reads of the 16-bit counter must be made by 16-bit access to maintain data coherency. either left aligned or center aligned output mode can be used in concatenated mode and is controlled by the low order caex bit. the high order caex bit has no effect. the table shown below is used to summarize which channels are used to set the various control bits when in 16-bit mode. table 63 16-bit concatenation mode summary conxx pwmex ppolx pclkx caex pwmx output con67 pwme7 ppol7 pclk7 cae7 pwm7 con45 pwme5 ppol5 pclk5 cae5 pwm5 con23 pwme3 ppol3 pclk3 cae3 pwm3 con01 pwme1 ppol1 pclk1 cae1 pwm1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) functional description mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 367 pwm boundary cases the following table summarizes the boundary conditions for the pwm regardless of the output mode (left aligned or center aligned) and 8-bit (normal) or 16-bit (concatenation): table 64 pwm boundary cases pwmdtyx pwmperx ppolx pwmx output $00 (indicates no duty) >$00 1 always low $00 (indicates no duty) >$00 0 always high xx $00 (1) (indicates no period) 1. counter=$00 and does not count. 1 always high xx $00 1 (indicates no period) 0 always low >= pwmperx xx 1 always high >= pwmperx xx 0 always low f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 368 pulse width modulator (pwm8b8c) motorola low power options this section summarizes the low power options available in the pwm module. low power design practices are implemented where possible. run mode while in run mode, if all eight pwm channels are disabled (pwmex=0 in the pwme register, where x=0,1,...,7), the prescaler counter shuts off for power savings (see figure 60 ). wait mode the pwm will keep running in wait unless the pswai bit in the pwmctl register is enabled. this allows for lower power consumption in wait mode by disabling the input clock to the prescaler. when in wait mode with this bit set, no activity in the pwm occurs and the pwm outputs go to a static state (high or low). stop mode in stop mode, the pwm module is stopped since all the clocks from ip bus to the module are stopped. the pwm outputs go to a static state (high or low). reset initialization the reset state of each individual bit is listed within the register description section (see register descriptions ) which details the registers and their bit-fields. all special functions or modes which are initialized during or just following reset are described within this section. the 8-bit up/down counter is configured as an up counter out of reset. all the channels are disabled and all the counters don? count. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) interrupts mc9s12t64revision 1.1.1 motorola pulse width modulator (pwm8b8c) 369 interrupts the pwm module has only one interrupt which is generated at the time of emergency shutdown, if the corresponding enable bit (pwmie in the pwmsdn register) is set. the vector address for the pwm emergency shutdown interrupt is $ff8c,$ff8d. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
pulse width modulator (pwm8b8c) mc9s12t64revision 1.1.1 370 pulse width modulator (pwm8b8c) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 371 enhanced capture timer (ect) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 overview the hc12 enhanced capture timer module has the features of the hc12 standard timer module enhanced by additional features in order to enlarge the field of applications, in particular for automotive abs applications. the basic timer consists of a 16-bit, software-programmable counter driven by a prescaler. this timer can be used for many purposes, including input waveform measurements while simultaneously generating an output waveform. pulse widths can vary from microseconds to many seconds. a full access for the counter registers or the input capture/output compare registers should take place in one clock cycle. accessing high byte and low byte separately for all of these registers may not yield the same result as accessing them in one word. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 372 enhanced capture timer (ect) motorola features 16-bit buffer register for four input capture (ic) channels. four 8-bit pulse accumulators with 8-bit buffer registers associated with the four buffered ic channels. configurable also as two 16-bit pulse accumulators. 16-bit modulus down-counter with 4-bit prescaler. four user selectable delay counters for input noise immunity increase. support for only 16-bit access on the ip bus. modes of operation stop: timer and modulus counter are off since clocks are stopped. freeze: the ect module enters freeze mode when background debug mode (bdm) is active. in freeze mode, timer and modulus counter keep on running, unless tsfrz in tscr1 (see page 382) is set to one. wait: counters keep on running, unless tswai in tscr1 is set to one. normal: timer and modulus counter keep on running, unless ten in tscr1 and mcen in mcctl (see page 396) , respectively, are cleared. abbreviations following abbreviations are used in the document. paclk ?16-bit pulse accumulator a (paca) clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) block diagram mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 373 block diagram figure 67 timer block diagram prescaler 16-bit counter input capture output compare 16-bit pulse accumulator b ioc0 ioc2 ioc1 ioc5 ioc3 ioc4 ioc6 ioc7 pa input interrupt pa overflow interrupt timer overflow interrupt timer channel 0 interrupt timer channel 7 interrupt registers bus clock input capture output compare input capture output compare input capture output compare input capture output compare input capture output compare input capture output compare input capture output compare channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 channel 6 channel 7 16-bit pulse accumulator a pb overflow interrupt 16-bit modulus counter modulus counter interrupt f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 374 enhanced capture timer (ect) motorola external pin descriptions ioc7 (pt7) input capture and output compare channel 7 - this pin serves as input capture or output compare for channel 7. ioc6 (pt6) input capture and output compare channel 6 - this pin serves as input capture or output compare for channel 6. ioc5 (pt5) input capture and output compare channel 5 - this pin serves as input capture or output compare for channel 5. ioc4 (pt4) input capture and output compare channel 4 - this pin serves as input capture or output compare for channel 4. ioc3 (pt3) input capture and output compare channel 3 - this pin serves as input capture or output compare for channel 3. ioc2 (pt2) input capture and output compare channel 2 - this pin serves as input capture or output compare for channel 2. ioc1 (pt1) input capture and output compare channel 1 - this pin serves as input capture or output compare for channel 1. ioc0 (pt0) input capture and output compare channel 0 - this pin serves as input capture or output compare for channel 0. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register map mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 375 register map register name bit 7 6 5 4 3 2 1 bit 0 address offset tios read: ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 $0040 write: cforc read: 0 0 0 0 0 0 0 0 $0041 (1) write: foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 oc7m read: oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 $0042 write: oc7d read: oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 $0043 write: tcnt (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0044 (2) write: tcnt (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0045 (2) write: tscr1 read: ten tswai tsfrz tffca 0000 $0046 write: ttov read: tov7 tov6 tov5 tov4 tov3 tov2 tov1 tov0 $0047 write: tctl1 read: om7 ol7 om6 ol6 om5 ol5 om4 ol4 $0048 write: tctl2 read: om3 ol3 om2 ol2 om1 ol1 om0 ol0 $0049 write: tctl3 read: edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a $004a write: tctl4 read: edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a $004b write: tie read: c7i c6i c5i c4i c3i c2i c1i c0i $004c write: tscr2 read: toi 000 tcre pr2 pr1 pr0 $004d write: tflg1 read: c7f c6f c5f c4f c3f c2f c1f c0f $004e write: tflg2 read: tof 0000000 $004f write: tc0 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0050 (3) write: tc0 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0051 (3) write: = unimplemented or reserved figure 68 enhanced capture timer register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 376 enhanced capture timer (ect) motorola tc1 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0052 (3) write: tc1 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0053 (3) write: tc2 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0054 (3) write: tc2 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0055 (3) write: tc3 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0056 (3) write: tc3 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0057 (3) write: tc4 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0058 (3) write: tc4 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0059 (3) write: tc5 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $005a (3) write: tc5 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $005b (3) write: tc6 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $005c (3) write: tc6 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $005d (3) write: tc7 (hi) read: bit 15 14 13 12 11 10 9 bit 8 $005e (3) write: tc7 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $005f (3) write: pactl read: 0 paen pamod pedge clk1 clk0 paovi pai $0060 write: paflg read: 0 0 0 0 0 0 paovf paif $0061 write: pacn3 (hi) read: bit 7 6 5 4 3 2 1 bit 0 $0062 write: pacn2 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0063 write: pacn1 (hi) read: bit 7 6 5 4 3 2 1 bit 0 $0064 write: pacn0 (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0065 write: register name bit 7 6 5 4 3 2 1 bit 0 address offset = unimplemented or reserved figure 68 enhanced capture timer register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register map mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 377 mcctl read: mczi modmc rdmcl 00 mcen mcpr1 mcpr0 $0066 write: iclat flmc mcflg read: mczf 0 0 0 polf3 polf2 polf1 polf0 $0067 write: icpar read: 0 0 0 0 pa3en pa2en pa1en pa0en $0068 write: dlyct read: 0 0 0 0 0 0 dly1 dly0 $0069 write: icovw read: novw7 novw6 novw5 novw4 novw3 novw2 novw1 novw0 $006a write: icsys read: sh37 sh26 sh15 sh04 tfmod pacmx bufen latq $006b (4) write: reserved read: 0 0 0 0 0 0 0 0 $006c write: reserved for factory test read: reads to this register return unpredictable values $006d (2) write: reserved read: 0 0 0 0 0 0 0 0 $006e write: reserved read: 0 0 0 0 0 0 0 0 $006f write: pbctl read: 0 pben 0000 pbovi 0 $0070 write: pbflg read: 0 0 0 0 0 0 pbovf 0 $0071 write: pa3h read: bit 7 6 5 4 3 2 1 bit 0 $0072 (5) write: pa2h read: bit 7 6 5 4 3 2 1 bit 0 $0073 (5) write: pa1h read: bit 7 6 5 4 3 2 1 bit 0 $0074 (5) write: pa0h read: bit 7 6 5 4 3 2 1 bit 0 $0075 (5) write: mccnt (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0076 write: mccnt (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0077 write: tc0h (hi) read: bit 15 14 13 12 11 10 9 bit 8 $0078 (5) write: tc0h (lo) read: bit 7 6 5 4 3 2 1 bit 0 $0079 (5) write: register name bit 7 6 5 4 3 2 1 bit 0 address offset = unimplemented or reserved figure 68 enhanced capture timer register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 378 enhanced capture timer (ect) motorola note: register address = base address (initrg) + address offset register descriptions this section consists of register descriptions in address order. each description includes a standard register diagram with an associated figure number. details of register bit and field function follow the register diagrams, in bit order. tc1h (hi) read: bit 15 14 13 12 11 10 9 bit 8 $007a (5) write: tc1h (lo) read: bit 7 6 5 4 3 2 1 bit 0 $007b (5) write: tc2h (hi) read: bit 15 14 13 12 11 10 9 bit 8 $007c (5) write: tc2h (lo) read: bit 7 6 5 4 3 2 1 bit 0 $007d (5) write: tc3h (hi) read: bit 15 14 13 12 11 10 9 bit 8 $007e (5) write: tc3h (lo) read: bit 7 6 5 4 3 2 1 bit 0 $007f (5) write: 1. always read $00. 2. only writable in special modes. 3. write to these registers have no meaning or effect during input capture. 4. may be written once in normal modes but writes are always permitted when special modes. 5. write has no effect. register name bit 7 6 5 4 3 2 1 bit 0 address offset = unimplemented or reserved figure 68 enhanced capture timer register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 379 timer input capture/output compare select (tios) read or write anytime. ios[7:0] ?input capture or output compare channel configuration 1 = the corresponding channel acts as an output compare. 0 = the corresponding channel acts as an input capture timer compare force register (cforc) read anytime but will always return $00 (1 state is transient). write anytime. foc[7:0] ?force output compare action for channel 7? a write to this register with the corresponding data bit(s) set causes the action which is programmed for output compare ??to occur immediately. the action taken is the same as if a successful comparison had just taken place with the tcn register except the interrupt flag does not get set note: a successful channel 7 output compare overrides any channel 6:0 compares. if forced output compare on any channel occurs at the same register offset: $0040 bit 7 6 5 4 3 2 1 bit 0 read: ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 write: reset: 0 0 0 0 0 0 0 0 register offset: $0041 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 0 0 0 0 write: foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 380 enhanced capture timer (ect) motorola time as the successful output compare then forced output compare action will take precedence and interrupt flag won? get set. output compare 7 mask register (oc7m) read or write anytime. setting the oc7mn (n ranges from 0 to 6) will set the corresponding port to be an output port when the corresponding iosn (tios register; n ranges from 0 to 6) bit is set to be an output compare. note: a successful channel 7 output compare overrides any channel 6:0 compares. for each oc7m bit that is set, the output compare action reflects the corresponding oc7d bit. register offset: $0042 bit 7 6 5 4 3 2 1 bit 0 read: oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 381 output compare 7 data register (oc7d) read or write anytime. a channel 7 output compare can cause bits in the output compare 7 data register to transfer to the timer port data register depending on the output compare 7 mask register. timer count register (tcnt) read anytime. write has no meaning or effect in the normal mode; only writable in special modes. the 16-bit main timer is an up counter. a full access for the counter register should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. register offset: $0043 bit 7 6 5 4 3 2 1 bit 0 read: oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 write: reset: 0 0 0 0 0 0 0 0 register offset: $0044?0045 bit 15 14 13 12 11 10 9 bit 8 read: bit 15 14 13 12 11 10 9 bit 8 write: bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 382 enhanced capture timer (ect) motorola the period of the first count after a write to the tcnt registers may be a different size because the write is not synchronized with the prescaler clock. timer system control register 1 (tscr1) read or write anytime. ten ?timer enable 1 = allows the timer to function normally. 0 = disables the main timer, including the counter. can be used for reducing power consumption. if for any reason the timer is not active, there is no 64 clock for the pulse accumulator since the 64 is generated by the timer prescaler. tswai ?timer module stops while in wait 1 = disables the timer module when the mcu is in the wait mode. timer interrupts cannot be used to get the mcu out of wait. 0 = allows the timer module to continue running during wait. tswai also affects pulse accumulators and modulus down counters. register offset: $0046 bit 7 6 5 4 3 2 1 bit 0 read: ten tswai tsfrz tffca 0 0 0 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 383 tsfrz ?timer and modulus counter stop while in freeze mode 1 = disables the timer and modulus counter whenever the mcu is in freeze mode. this is useful for emulation. 0 = allows the timer and modulus counter to continue running while in freeze mode. tsfrz does not stop the pulse accumulator. note: the ect module enters freeze mode when background debug mode (bdm) is active. refer to the fast background debug module (fbdm) section about the background debug mode. tffca ?timer fast flag clear all 1 = for tflg1, a read from an input capture or a write to the output compare channel causes the corresponding channel flag, cnf, to be cleared. for tflg2, any access to the tcnt register clears the tof flag. any access to the pacn3 and pacn2 registers clears the paovf and paif flags in the paflg register. any access to the pacn1 and pacn0 registers clears the pbovf flag in the pbflg register. this has the advantage of eliminating software overhead in a separate clear sequence. extra care is required to avoid accidental flag clearing due to unintended accesses. 0 = allows the timer flag clearing to function normally. timer toggle on overflow register 1 (ttov) read or write anytime. tovx ?toggle on overflow bits register offset: $0047 bit 7 6 5 4 3 2 1 0 read: tov7 tov6 tov5 tov4 tov3 tov2 tov1 tov0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 384 enhanced capture timer (ect) motorola tovx toggles output compare pin on overflow. this feature only takes effect when in output compare mode. when set, it takes precedence over forced output compare but not channel 7 override events. 1 = toggle output compare pin on overflow feature enabled 0 = toggle output compare pin on overflow feature disabled f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 385 timer control registers 1and 2 (tctl1, tctl2) read or write anytime. omn ?output mode oln ?output level these eight pairs of control bits are encoded to specify the output action to be taken as a result of a successful ocn compare. when either omn or oln is one, the pin associated with ocn becomes an output tied to ocn. note: to enable output action by omn and oln bits on timer port, the corresponding bit in oc7m should be cleared. to operate the 16-bit pulse accumulators a and b (paca and pacb) independently of input capture or output compare 7 and 0 respectively the user must set the corresponding bits iosn = 1, omn = 0 and oln = 0. oc7m7 or oc7m0 in the oc7m register must also be cleared. register offset: $0048-$0049 bit 7 6 5 4 3 2 1 bit 0 read: om7 ol7 om6 ol6 om5 ol5 om4 ol4 write: bit 7 6 5 4 3 2 1 bit 0 read: om3 ol3 om2 ol2 om1 ol1 om0 ol0 write: reset: 0 0 0 0 0 0 0 0 table 65 compare result output action omn oln action 0 0 timer disconnected from output pin logic 0 1 toggle ocn output line 1 0 clear ocn output line to zero 1 1 set ocn output line to one f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 386 enhanced capture timer (ect) motorola timer control registers 3 and 4 (tctl3, tctl4) read or write anytime. edgnb, edgna ?input capture / pulse accumulator edge control these eight pairs of control bits configure the input capture edge detector circuits. the four pairs of control bits of tctl4 also configure the 8 bit pulse accumulators pac0?. for 16-bit pulse accumulator pacb, edg0b & edg0a, control bits of tctl4 will decide the active edge. note: for the 16-bit pulse accumulator paca, refer to the register pactl for active edge control. register offset: $004a-$004b bit 7 6 5 4 3 2 1 bit 0 read: edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a write: bit 7 6 5 4 3 2 1 bit 0 read: edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a write: reset: 0 0 0 0 0 0 0 0 table 66 edge detector circuit con?uration edgnb edgna configuration 0 0 capture disabled 0 1 capture on rising edges only 1 0 capture on falling edges only 11 capture on any edge (rising or falling) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 387 timer interrupt enable register (tie) read or write anytime. the bits in tie correspond bit-for-bit with the bits in the tflg1 status register. if cleared, the corresponding flag is disabled from causing a hardware interrupt. if set, the corresponding flag is enabled to cause a interrupt. c7i?0i ?input capture/output compare ??interrupt enable timer system control register 2 (tscr2) read or write anytime. toi ?timer overflow interrupt enable 1 = hardware interrupt requested when tof flag set 0 = interrupt inhibited tcre ?timer counter reset enable this bit allows the timer counter to be reset by a successful output compare 7 event. this mode of operation is similar to an up-counting modulus counter. register offset: $004c bit 7 6 5 4 3 2 1 bit 0 read: c7i c6i c5i c4i c3i c2i c1i c0i write: reset: 0 0 0 0 0 0 0 0 register offset: $004d bit 7 6 5 4 3 2 1 bit 0 read: toi 0 0 0 tcre pr2 pr1 pr0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 388 enhanced capture timer (ect) motorola 1 = counter reset by a successful output compare 7 0 = counter reset inhibited and counter free runs if tc7 = $0000 and tcre = 1, tcnt will stay at $0000 continuously. if tc7 = $ffff and tcre = 1, tof in tflg2 (see page 389) will never be set when tcnt is reset from $ffff to $0000. pr2, pr1, pr0 ?timer prescaler select these three bits specify the number of 2 stages that are to be inserted between the bus clock and the main timer counter. the newly selected prescale factor will not take effect until the next synchronized edge where all prescale counter stages equal zero. main timer interrupt flag 1 (tflg1) tflg1 indicates when interrupt conditions have occurred. read anytime. table 67 prescaler selection pr2 pr1 pr0 prescale factor 000 1 001 2 010 4 011 8 100 16 101 32 110 64 1 1 1 128 register offset: $004e bit 7 6 5 4 3 2 1 bit 0 read: c7f c6f c5f c4f c3f c2f c1f c0f write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 389 write used in the clearing mechanism. writing one will cause the corresponding bits to be cleared. writing a zero has no effect. use of the tfmod bit in the icsys register (see page 401) in conjunction with the use of the icovw (see page 400) register allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. when tffca bit in tscr1 register (see page 382) is set, a read from an input capture or a write into an output compare channel will cause the corresponding channel flag cnf to be cleared. c7f?0f ?input capture/output compare channel ??flag. c0f can also be set by 16-bit pulse accumulator b (pacb). c3f?0f can also be set by 8-bit pulse accumulators pac3?ac0. main timer interrupt flag 2 (tflg2) tflg2 indicates when interrupt conditions have occurred. read anytime. write used in the clearing mechanism. writing one will cause the corresponding bits to be cleared. writing a zero has no effect. any access to tcnt will clear tflg2 register if the tffca bit in tscr1 (see page 382) register is set. tof ?timer overflow flag register offset: $004f bit 7 6 5 4 3 2 1 bit 0 read: tof 0 0 0 0 0 0 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 390 enhanced capture timer (ect) motorola set when 16-bit free-running timer overflows from $ffff to $0000. this bit is cleared automatically by a write to the tflg2 register with bit 7 set. (see also tcre control bit explanation in tscr2 register - page 387 .) timer input capture/output compare registers 0? (tc0?c7) read anytime. write anytime for output compare function. writes to these registers have no meaning or effect during input capture. all timer input capture/output compare registers are reset to $0000. depending on the tios bit for the corresponding channel, these registers are used to latch the value of the free-running counter when a defined transition is sensed by the corresponding input capture edge detector or to trigger an output action for output compare. register offset: $0050?005f bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: bit 15 14 13 12 11 10 9 bit 8 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 391 16-bit pulse accumulator a control register (pactl) read or write any time. 16-bit pulse accumulator a (paca) is formed by cascading the 8-bit pulse accumulators pac3 and pac2. when paen is set, the paca is enabled. the paca shares the input pin with ic7. paen pulse accumulator a system enable 1 = pulse accumulator a system enabled. the two 8-bit pulse accumulators pac3 and pac2 are cascaded to form the paca 16-bit pulse accumulator. when paca is enabled, the pacn3 and pacn2 registers contents are respectively the high and low byte of the paca. pa3en and pa2en control bits in icpar (see page 399) have no effect. pulse accumulator input edge flag (paif) function is enabled. 0 = 16-bit pulse accumulator a system disabled. 8-bit pac3 and pac2 can be enabled when their related enable bits in icpar are set. pulse accumulator input edge flag (paif) function is disabled. paen is independent from ten in tscr1 (see page 382) . with timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. register offset: $0060 bit 7 6 5 4 3 2 1 bit 0 read: 0 paen pamod pedge clk1 clk0 paovi pai write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 392 enhanced capture timer (ect) motorola pamod pulse accumulator mode this bit is active only when the pulse accumulator a is enabled (paen = 1). 1 = gated time accumulation mode 0 = event counter mode pedge pulse accumulator edge control this bit is active only when the pulse accumulator a is enabled (paen = 1). for pamod bit = 0 (event counter mode). 1 = rising edges on pt7 pin cause the count to be incremented 0 = falling edges on pt7 pin cause the count to be incremented for pamod bit = 1 (gated time accumulation mode). 1 = pt7 input pin low enables bus clock divided by 64 clock to pulse accumulator and the trailing rising edge on pt7 sets the paif flag 0 = pt7 input pin high enables bus clock divided by 64 clock to pulse accumulator and the trailing falling edge on pt7 sets the paif flag. if the timer is not active (ten = 0 in tscr1), there is no divide-by-64 since the 64 clock is generated by the timer prescaler. clk1, clk0 clock select bits for the description of paclk please refer to figure 72 in page 412 . table 68 pin action pamod pedge pin action 0 0 falling edge 0 1 rising edge 1 0 div. by 64 clock enabled with pin high level 1 1 div. by 64 clock enabled with pin low level table 69 clock selection clk1 clk0 clock source 0 0 use timer prescaler clock as timer counter clock 0 1 use paclk as input to timer counter clock 1 0 use paclk/256 as timer counter clock frequency 1 1 use paclk/65536 as timer counter clock frequency f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 393 if the pulse accumulator is disabled (paen = 0), the prescaler clock from the timer is always used as an input clock to the timer counter. the change from one selected clock to the other happens immediately after these bits are written. paovi pulse accumulator a overflow interrupt enable 1 = interrupt requested if paovf is set 0 = interrupt inhibited pai pulse accumulator input interrupt enable 1 = interrupt requested if paif is set 0 = interrupt inhibited pulse accumulator a flag register (paflg) read or write anytime. when the tffca bit in the tscr1 register (see page 382) is set, any access to the pacnt register will clear all the flags in the paflg register. paovf pulse accumulator a overflow flag set when the 16-bit pulse accumulator a overflows from $ffff to $0000,or when 8-bit pulse accumulator 3 (pac3) overflows from $ff to $00. when pacmx = 1, paovf bit can also be set if 8-bit pulse accumulator 3 (pac3) reaches $ff followed by an active edge on pt3. this bit is cleared automatically by a write to the paflg register with bit 1 set. register offset: $0061 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 0 0 paovf paif write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 394 enhanced capture timer (ect) motorola paif pulse accumulator input edge flag set when the selected edge is detected at the pt7 input pin. in event mode the event edge triggers paif and in gated time accumulation mode the trailing edge of the gate signal at the pt7 input pin triggers paif. this bit is cleared by a write to the paflg register with bit 0 set. any access to the pacn3, pacn2 registers will clear all the flags in this register when tffca bit in register tscr1 is set. pulse accumulators count registers (pacn3, pacn2) read or write any time. the two 8-bit pulse accumulators pac3 and pac2 are cascaded to form the paca 16-bit pulse accumulator. when paca in enabled (paen=1 in pactl) the pacn3 and pacn2 registers contents are respectively the high and low byte of the paca. when pacn3 overflows from $ff to $00, the interrupt flag paovf in paflg is set. full count register access should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. note: the input capture edge circuits of 8-bit pulse accumulators are configured with control bits edgna and edgnb in the tctl4 register (see page 386) . register offset: $0062?0063 bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 395 note: when clocking pulse and write to the registers occurs simultaneously, write takes priority and the register is not incremented. pulse accumulators count registers (pacn1, pacn0) read or write any time. the two 8-bit pulse accumulators pac1 and pac0 are cascaded to form the pacb 16-bit pulse accumulator. when pacb is enabled, (pben=1 in pbctl) the pacn1 and pacn0 registers contents are respectively the high and low byte of the pacb. when pacn1 overflows from $ff to $00, the interrupt flag pbovf in pbflg (see page 405) is set. full count register access should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. note: the input capture edge circuits of 8-bit pulse accumulators are configured with control bits edgna edgnb in the tctl4 register (see page 386) . note: when clocking pulse and write to the registers occurs simultaneously, write takes priority and the register is not incremented. register offset: $0064?0065 bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 396 enhanced capture timer (ect) motorola 16?it modulus down-counter control register (mcctl) read or write any time except for bit 4. mczi ?modulus counter underflow interrupt enable 1 = modulus counter interrupt is enabled. 0 = modulus counter interrupt is disabled. modmc modulus mode enable 1 = modulus mode is enabled. when the counter reaches $0000, the counter is loaded with the latest value written to the modulus count register. 0 = the counter counts once from the value written to it and will stop at $0000. note: for proper operation, the mcen bit should be cleared before modifying the modmc bit in order to reset the modulus counter to $ffff. rdmcl read modulus down-counter load 1 = reads of the modulus count register will return the contents of the load register. 0 = reads of the modulus count register will return the present value of the count register. iclat input capture force latch action when input capture latch mode is enabled - latq and bufen bit in icsys (see page 401) are set - a write one to this bit immediately forces the contents of the input capture registers tc0 to tc3 and their register offset: $0066 bit 7 6 5 4 3 2 1 bit 0 read: mczi modmc rdmcl 0 0 mcen mcpr1 mcpr0 write: iclat flmc reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 397 corresponding 8-bit pulse accumulators to be latched into the associated holding registers. the pulse accumulators will be automatically cleared when the latch action occurs. writing zero to this bit has no effect. read of this bit will return always zero. flmc force load register into the modulus counter count register this bit is active only when the modulus down-counter is enabled (mcen=1). a write one into this bit loads the load register into the modulus counter count register. this also resets the modulus counter prescaler. write zero to this bit has no effect. when modmc=0, counter starts counting and stops at $0000. read of this bit will return always zero. mcen ?modulus down-counter enable 1 = modulus counter is enabled. 0 = modulus counter disabled. when mcen=0, the counter is preset to $ffff. this will prevent an early interrupt flag when the modulus down-counter is enabled. mcpr1, mcpr0 modulus counter prescaler select these two bits specify the division rate of the modulus counter prescaler. the newly selected prescaler division rate will not be effective until a load of the load register into the modulus counter count register occurs. table 70 modulus counter prescaler select mcpr1 mcpr0 prescaler division rate 00 1 01 4 10 8 11 16 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 398 enhanced capture timer (ect) motorola 16-bit modulus down-counter flag register (mcflg) read: any time write: only for clearing bit 7 mczf ?modulus counter underflow flag the flag is set when the modulus down-counter reaches $0000. a write one to this bit clears the flag. write zero has no effect. any access to the mccnt register will clear the mczf flag in this register when tffca bit in register tscr1 (see page 382) is set. polf3?olf0 ?first input capture polarity status this are read only bits. write to these bits has no effect. each status bit gives the polarity of the first edge which has caused an input capture to occur after capture latch has been read. each polfx corresponds to a timer portx input. 1 = the first input capture has been caused by a rising edge. 0 = the first input capture has been caused by a falling edge. register offset: $0067 bit 7 6 5 4 3 2 1 bit 0 read: mczf 0 0 0 polf3 polf2 polf1 polf0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 399 input control pulse accumulators register (icpar) the 8-bit pulse accumulators pac3 and pac2 can be enabled only if paen in pactl is cleared. if paen is set, pa3en and pa2en have no effect. the 8-bit pulse accumulators pac1 and pac0 can be enabled only if pben in pbctl is cleared. if pben is set, pa1en and pa0en have no effect. read or write any time. paxen ?8-bit pulse accumulator ??enable 1 = 8-bit pulse accumulator is enabled. 0 = 8-bit pulse accumulator is disabled. note: the input capture edge circuits of 8-bit pulse accumulators are configured with control bits edgna and edgnb in the tctl4 register (see page 386) . delay counter control register (dlyct) register offset: $0068 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 pa3en pa2en pa1en pa0en write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented register offset: $0069 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 0 0 dly1 dly0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 400 enhanced capture timer (ect) motorola read or write any time. if enabled, after detection of a valid edge on input capture pin, the delay counter counts the pre-selected number of bus clock cycles, then it will generate a pulse on its output. the pulse is generated only if the level of input signal, after the preset delay, is the opposite of the level before the transition.this will avoid reaction to narrow input pulses. after counting, the counter will be cleared automatically. delay between two active edges of the input signal period should be longer than the selected counter delay. dlyx ?delay counter select input control overwrite register (icovw) read or write any time. table 71 delay counter select dly1 dly0 delay 0 0 disabled (bypassed) 0 1 256 bus clock cycles 1 0 512 bus clock cycles 1 1 1024 bus clock cycles register offset: $006a bit 7 6 5 4 3 2 1 bit 0 read: novw7 novw6 novw5 novw4 novw3 novw2 novw1 novw0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 401 novwx ?no input capture overwrite 1 = the related capture register or holding register cannot be written by an event unless they are empty (see ic channels ). this will prevent the captured value to be overwritten until it is read or latched in the holding register. 0 = the contents of the related capture register or holding register can be overwritten when a new input capture or latch occurs. note: an ic register is empty when it has been read or latched into the holding register. note: a holding register is empty when it has been read. input control system control register (icsys) read: any time write: may be written once in normal modes. writes are always permitted when special modes. shxy ?share input action of input capture channels x and y 1 = the channel input ??causes the same action on the channel ?? the port pin ??and the corresponding edge detector is used to be active on the channel ?? 0 = normal operation tfmod ?timer flag-setting mode use of the tfmod bit in the icsys register in conjunction with the use of the icovw register allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. register offset: $006b bit 7 6 5 4 3 2 1 bit 0 read: sh37 sh26 sh15 sh04 tfmod pacmx bufen latq write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 402 enhanced capture timer (ect) motorola by setting tfmod in queue mode, when novw bit is set and the corresponding capture and holding registers are emptied, an input capture event will first update the related input capture register with the main timer contents. at the next event the tcn data is transferred to the tcnh register, the tcn is updated and the cnf interrupt flag is set. see figure 73 in page 413 . in all other input capture cases the interrupt flag is set by a valid external event on ptn. 1 = if in queue mode (bufen=1 and latq=0), the timer flags c3f?0f in tflg1 are set only when a latch on the corresponding holding register occurs. if the queue mode is not engaged, the timer flags c3f?0f are set the same way as for tfmod=0. 0 = the timer flags c3f?0f in tflg1 are set when a valid input capture transition on the corresponding port pin occurs. pacmx ?8-bit pulse accumulators maximum count 1 = when the 8-bit pulse accumulator has reached the value $ff, it will not be incremented further. the value $ff indicates a count of 255 or more. 0 = normal operation. when the 8-bit pulse accumulator has reached the value $ff, with the next active edge, it will be incremented to $00. bufen ic buffer enable 1 = input capture and pulse accumulator holding registers are enabled. the latching mode is defined by latq control bit. write one into iclat bit in mcctl (see page 396) , when latq is set will produce latching of input capture and pulse accumulators registers into their holding registers. 0 = input capture and pulse accumulator holding registers are disabled. latq ?input control latch or queue mode enable the bufen control bit should be set in order to enable the ic and pulse accumulators holding registers. otherwise latq latching modes are disabled. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 403 write one into iclat bit in mcctl, when latq and bufen are set will produce latching of input capture and pulse accumulators registers into their holding registers. 1 = latch mode is enabled. latching function occurs when modulus down-counter reaches zero or a zero is written into the count register mccnt (see buffered ic channels ). with a latching event the contents of ic registers and 8-bit pulse accumulators are transferred to their holding registers. 8-bit pulse accumulators are cleared. 0 = queue mode of input capture is enabled. the main timer value is memorized in the ic register by a valid input pin transition. with a new occurrence of a capture, the value of the ic register will be transferred to its holding register and the ic register memorizes the new timer value. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 404 enhanced capture timer (ect) motorola 16-bit pulse accumulator b control register (pbctl) read or write any time. 16-bit pulse accumulator b (pacb) is formed by cascading the 8-bit pulse accumulators pac1 and pac0. when pben is set, the pacb is enabled. the pacb shares the input pin with ic0. pben ?pulse accumulator b system enable 1 = pulse accumulator b system enabled. the two 8-bit pulse accumulators pac1 and pac0 are cascaded to form the pacb 16-bit pulse accumulator. when pacb in enabled, the pacn1 and pacn0 registers contents are respectively the high and low byte of the pacb. pa1en and pa0en control bits in icpar have no effect. 0 = 16-bit pulse accumulator system disabled. 8-bit pac1 and pac0 can be enabled when their related enable bits in icpar are set. pben is independent from ten in tscr1 (see page 382) . with timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. pbovi ?pulse accumulator b overflow interrupt enable 1 = interrupt requested if pbovf in pbflg is set 0 = interrupt inhibited register offset: $0070 bit 7 6 5 4 3 2 1 bit 0 read: 0 pben 0 0 0 0 pbovi 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 405 note: the input capture edge circuits of the 16-bit pulse accumulator pacb are configured with control bits edg0b and edg0a in the tctl4 register (see page 386) . pulse accumulator b flag register (pbflg) read or write any time. pbovf ?pulse accumulator b overflow flag this bit is set when the 16-bit pulse accumulator b overflows from $ffff to $0000, or when 8-bit pulse accumulator 1 (pac1) overflows from $ff to $00. this bit is cleared by a write to the pbflg register with bit 1 set. any access to the pacn1 and pacn0 registers will clear the pbovf flag in this register when tffca bit in register tscr1 (see page 382) is set. when pacmx=1 in icsys (see page 401) , pbovf bit can also be set if 8-bit pulse accumulator 1 (pac1) reaches $ff and followed an active edge comes on pt1. register offset: $0071 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 0 0 pbovf 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 406 enhanced capture timer (ect) motorola 8-bit pulse accumulators holding registers (pa3h?a0h) read: any time write: has no effect. these registers are used to latch the value of the corresponding pulse accumulator when the related bits in register icpar are enabled (see pulse accumulators ). modulus down-counter count register (mccnt) read or write any time. a full access for the counter register should take place in one clock cycle. a separate read/write for high byte and low byte will give different result than accessing them as a word. register offset: $0072?0075 bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented register offset: $0076?0077 bit 15 14 13 12 11 10 9 8 read: bit 15 14 13 12 11 10 9 bit 8 write: bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) register descriptions mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 407 if the rdmcl bit in mcctl register (see page 396) is cleared, reads of the mccnt register will return the present value of the count register. if the rdmcl bit is set, reads of the mccnt will return the contents of the load register. if a $0000 is written into mccnt and modulus counter while latq and bufen in icsys register are set, the input capture and pulse accumulator registers will be latched. with a $0000 write to the mccnt, the modulus counter will stay at zero and does not set the mczf flag in mcflg register. if modulus mode is enabled (modmc=1), a write to this address will update the load register with the value written to it. the count register will not be updated with the new value until the next counter underflow. the flmc bit in mcctl can be used to immediately update the count register with the new value if an immediate load is desired. if modulus mode is not enabled (modmc=0), a write to this address will clear the prescaler and will immediately update the counter register with the value written to it and down-counts once to $0000 timer input capture holding registers 0? (tc0h?c3h) read: any time write: has no effect. register offset: $0078?007f bit 15 14 13 12 11 10 9 8 read: bit 15 14 13 12 11 10 9 bit 8 write: bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 408 enhanced capture timer (ect) motorola these registers are used to latch the value of the input capture registers tc0?c3. the corresponding iosx bits in tios should be cleared (see ic channels ). functional description the enhanced capture timer has 8 input capture, output compare (ic/oc) channels same as on the hc12 standard timer (timer channels tc0 to tc7). when channels are selected as input capture by selecting the iosx bit in tios register, they are called input capture (ic) channels. figures 69 (page 409) and 70 (page 410) show the timer block diagram for latch and queue modes, respectively. four ic channels are the same as on the standard timer with one capture register each which memorizes the timer value captured by an action on the associated input pin. four other ic channels, in addition to the capture register, have also one buffer each called holding register. this permits to memorize two different timer values without generation of any interrupt. four 8-bit pulse accumulators are associated with the four buffered ic channels. each pulse accumulator has a holding register to memorize their value by an action on its external input. each pair of pulse accumulators can be used as a 16-bit pulse accumulator. see figures 71 (page 411) and 72 (page 412) for block diagrams of these accumulators. the 16-bit modulus down-counter can control the transfer of the ic registers contents and the pulse accumulators to the respective holding registers for a given period, every time the count reaches zero. the modulus down-counter can also be used as a stand-alone time base with periodic interrupt capability. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) functional description mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 409 figure 69 timer block diagram in latch mode 16 bit main timer pt1 comparator tc0h hold register pt0 pt3 pt2 pt4 pt5 pt6 pt7 edg0 edg1 edg2 edg3 mux prescaler bus clock 16-bit load register 16-bit modulus 0 reset edg0 edg1 edg2 edg4 edg5 edg3 edg6 edg7 1, 4, 8, 16 16-bit free-running latch underflow main timer prescaler tc0 capture/compare register comparator tc1 capture/compare register comparator tc2 capture/compare register comparator tc3 capture/compare register comparator tc4 capture/compare register comparator tc5 capture/compare register comparator tc6 capture/compare register comparator tc7 capture/compare register pin logic pin logic pin logic pin logic pin logic pin logic pin logic pin logic delay counter delay counter delay counter delay counter tc1h hold register tc2h hold register tc3h hold register mux mux mux pa0h hold register pac0 0 reset pa1h hold register pac1 0 reset pa2h hold register pac2 0 reset pa3h hold register pac3 write $0000 to modulus counter iclat, latq, bufen (force latch) latq (mdc latch enable) down counter sh04 sh15 sh26 sh37 bus clock 1, 2,..., 128 timclk pclk f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 410 enhanced capture timer (ect) motorola figure 70 timer block diagram in queue mode 16 bit main timer pt1 comparator tc0h hold register pt0 pt3 pt2 pt4 pt5 pt6 pt7 edg0 edg1 edg2 edg3 mux prescaler bus clock 16-bit load register 16-bit modulus 0 reset edg0 edg1 edg2 edg4 edg5 edg3 edg6 edg7 1, 2,..., 128 1, 4, 8, 16 16-bit free-running latch0 main timer prescaler tc0 capture/compare register comparator tc1 capture/compare register comparator tc2 capture/compare register comparator tc3 capture/compare register comparator tc4 capture/compare register comparator tc5 capture/compare register comparator tc6 capture/compare register comparator tc7 capture/compare register pin logic pin logic pin logic pin logic pin logic pin logic pin logic pin logic delay counter delay counter delay counter delay counter bus clock tc1h hold register tc2h hold register tc3h hold register mux mux mux pa0h hold register pac0 0 reset pa1h hold register pac1 0 reset pa2h hold register pac2 0 reset pa3h hold register pac3 latch1 latch3 latch2 la tq, bufen (queue mode) read tc3h hold register read tc2h hold register read tc1h hold register read tc0h hold register down counter sh04 sh15 sh26 sh37 pclk timclk f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) functional description mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 411 figure 71 8-bit pulse accumulators block diagram ip data bus pt0 load holding register and reset pulse accumulator 0 0 edg3 edg2 edg1 edg0 edge detector delay counter interrupt interrupt pt1 edge detector delay counter pt2 edge detector delay counter pt3 edge detector delay counter 8-bit pac0 (pacn0) pa0h holding register 0 8-bit pac1 (pacn1) pa1h holding register 0 8-bit pac2 (pacn2) pa2h holding register 0 8-bit pac3 (pacn3) pa3h holding register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 412 enhanced capture timer (ect) motorola figure 72 16-bit pulse accumulators block diagram edge detector 8-bit pac2 intermodule bus 8-bit pac3 pt7 pt0 bus clock divide by 64 clock select clk0 clk1 4:1 mux timclk paclk paclk / 256 paclk / 65536 prescaled clock (pclk) (timer clock) interrupt mux (pamod) edge detector paca delay counter (pacn3) (pacn2) 8-bit pac0 8-bit pac1 interrupt pacb (pacn1) (pacn0) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) functional description mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 413 figure 73 interrupt flag setting ic channels the ic channels are composed of four standard ic registers and four buffered ic channels. an ic register is empty when it has been read or latched into the holding register. a holding register is empty when it has been read. non-buffered ic channels the main timer value is memorized in the ic register by a valid input pin transition. if the corresponding novwx bit of the icovw register (see page 400) is cleared, with a new occurrence of a capture, the contents of ic register are overwritten by the new value. if the corresponding novwx bit of the icovw register is set, the capture register cannot be written unless it is empty. this will prevent the captured value to be overwritten until it is read. buffered ic channels there are two modes of operations for the buffered ic channels. ic latch mode: ptn edge detector delay counter 16-bit main timer tcn input capture reg. tcnh i.c. holding reg. bufen ? la tq ? tfmod set cnf interrupt f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 414 enhanced capture timer (ect) motorola when enabled (latq=1), the main timer value is memorized in the ic register by a valid input pin transition. the value of the buffered ic register is latched to its holding register by the modulus counter for a given period when the count reaches zero, by a write $0000 to the modulus counter or by a write to iclat in the mcctl register. see figure 69 in page 409. if the corresponding novwx bit of the icovw register is cleared, with a new occurrence of a capture, the contents of ic register are overwritten by the new value. in case of latching, the contents of its holding register are overwritten. if the corresponding novwx bit of the icovw register is set, the capture register or its holding register cannot be written by an event unless they are empty (see ic channels ). this will prevent the captured value to be overwritten until it is read or latched in the holding register. ic queue mode: when enabled (latq=0), the main timer value is memorized in the ic register by a valid input pin transition. see figure 70 in page 410. if the corresponding novwx bit of the icovw register is cleared, with a new occurrence of a capture, the value of the ic register will be transferred to its holding register and the ic register memorizes the new timer value. if the corresponding novwx bit of the icovw register is set, the capture register or its holding register cannot be written by an event unless they are empty (see ic channels ). in queue mode, reads of holding register will latch the corresponding pulse accumulator value to its holding register. pulse accumulators there are four 8-bit pulse accumulators with four 8-bit holding registers associated with the four ic buffered channels. a pulse accumulator counts the number of active edges at the input of its channel. the active edge can be programmed through the tctl4 register (for the 8-bit pulse accumulators and the 16-bit pulse accumulator pacb) and f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) functional description mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 415 the pedge bit in the pactl register (for the 16-bit pulse accumulator paca). the user can prevent 8-bit pulse accumulators counting further than $ff by pacmx control bit in icsys. in this case a value of $ff means that 255 counts or more have occurred. each pair of pulse accumulators can be used as a 16-bit pulse accumulator. see figures 71 (page 411) and 72 (page 412) for block diagrams of 8-bit and 16-bit accumulators. there are two modes of operation for the pulse accumulators. pulse accumulator latch mode the value of the pulse accumulator is transferred to its holding register when the modulus down-counter reaches zero, a write $0000 to the modulus counter or when the force latch control bit iclat is written. at the same time the pulse accumulator is cleared. pulse accumulator queue mode when queue mode is enabled, reads of an input capture holding register will transfer the contents of the associated pulse accumulator to its holding register. at the same time the pulse accumulator is cleared. modulus down-counter the modulus down-counter can be used as a time base to generate a periodic interrupt. it can also be used to latch the values of the ic registers and the pulse accumulators to their holding registers. the action of latching can be programmed to be periodic or only once. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 416 enhanced capture timer (ect) motorola interrupts this section describes interrupts originated by the ect block.the mcu must service the interrupt requests. table 72 lists the interrupts generated by the ect to communicate with the mcu. description of interrupt operation the ect only originates interrupt requests. the following is a description of how the ect makes a request and how the mcu should acknowledge that request. channel [7:0] interrupt (ectch(0-7)) this active high output will be asserted by the module to request a timer channel 7? interrupt to be serviced by the system controller. table 72 ect interrupts interrupt vector address source description ectch0 $ffee, $ffef timer channel 0 active high timer channel interrupts 0 ectch1 $ffec, $ffed timer channel 1 active high timer channel interrupts 1 ectch2 $ffea, $ffeb timer channel 2 active high timer channel interrupts 2 ectch3 $ffe8, $ffe9 timer channel 3 active high timer channel interrupts 3 ectch4 $ffe6, $ffe7 timer channel 4 active high timer channel interrupts 4 ectch5 $ffe4, $ffe5 timer channel 5 active high timer channel interrupts 5 ectch6 $ffe2, $ffe3 timer channel 6 active high timer channel interrupts 6 ectch7 $ffe0, $ffe1 timer channel 7 active high timer channel interrupts 7 ectmcufi $ffca, $ffcb modulus down counter under?w active high modulus counter interrupt ectpabo $ffc8, $ffc9 pulse accumulator b over?w active high pulse accumulator b interrupt ectpaai $ffda, $ffdb pulse accumulator a input edge active high pulse accumulator a input interrupt ectpaao $ffdc, $ffdd pulse accumulator a over?w pulse accumulator over?w interrupt ectovi $ffde, $ffdf timer over?w timer over?w interrupt f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) interrupts mc9s12t64revision 1.1.1 motorola enhanced capture timer (ect) 417 modulus down counter underflow interrupt (ectmcufi) this active high output will be asserted by the module to request a modulus counter underflow interrupt to be serviced by the system controller. pulse accumulator b overflow interrupt (ectpabo) this active high output will be asserted by the module to request a timer pulse accumulator b overflow interrupt to be serviced by the system controller. pulse accumulator a input interrupt (ectpaai) this active high output will be asserted by the module to request a timer pulse accumulator a input interrupt to be serviced by the system controller. pulse accumulator a overflow interrupt (ectpaao) this active high output will be asserted by the module to request a timer pulse accumulator a overflow interrupt to be serviced by the system controller. timer overflow interrupt (ectovi) this active high output will be asserted by the module to request a timer overflow interrupt to be serviced by the system controller. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
enhanced capture timer (ect) mc9s12t64revision 1.1.1 418 enhanced capture timer (ect) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 419 serial communications interface (sci) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 overview the sci allows asynchronous serial communications with peripheral devices and other cpus. features the sci includes these distinctive features: full-duplex operation standard mark/space non-return-to-zero (nrz) format 13-bit baud rate selection programmable 8-bit or 9-bit data format separately enabled transmitter and receiver programmable transmitter output parity f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 420 serial communications interface (sci) motorola two receiver wake-up methods: idle line wake-up address mark wake-up interrupt-driven operation with eight flags: transmitter empty transmission complete receiver full idle receiver input receiver overrun noise error framing error parity error receiver framing error detection hardware parity checking 10/13 bit software selectable break character length 1/16 bit-time noise detection modes of operation the sci functions the same in normal, special, and emulation modes. it has two low power modes, wait and stop modes. run mode normal mode of operation. wait mode sci operation in wait mode depends on the state of the sciswai bit in the sci control register 1 (scixcr1). if sciswai is clear, the sci operates normally when the cpu is in wait mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) block diagram mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 421 if sciswai is set, sci clock generation ceases and the sci module enters a power-conservation state when the cpu is in wait mode. setting sciswai does not affect the state of the receiver enable bit, re, or the transmitter enable bit, te. if sciswai is set, any transmission or reception in progress stops at wait mode entry. the transmission or reception resumes when either an internal or external interrupt brings the cpu out of wait mode. exiting wait mode by reset aborts any transmission or reception in progress and resets the sci. stop mode the sci is inactive during stop mode for reduced power consumption. the stop instruction does not affect the sci register states, but the bus clock will be disabled. the sci operation resumes from where it left off after an external interrupt brings the cpu out of stop mode. exiting stop mode by reset aborts any transmission or reception in progress and resets the sci. block diagram figure 74 is a block diagram of the sci. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 422 serial communications interface (sci) motorola figure 74 sci block diagram external pin descriptions rxd (ps0, ps2) sci receive pin. this pin serves as receive data input of sci. when the sci operates in single wire mode (loops=1 in scrxcr1 register), this channel is unused and corresponding mcu pins (ps0, ps2) can be used as general purpose i/o. txd (ps1, ps3) sci transmit pin. this pin serves as transmit data output of sci. sci data register receive shift register receive & wake up control data format control transmit control transmit shift register sci data register baud generator irq gener- irq gene- idle rdrf/or tdre tc rx data in 16 irq irq irq bus clk ation ration txdata out irq o irq to cpu r i n g f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register map mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 423 register map note: register address = base address (initrg) + address offset register name (1) 1. where: x = 0 for sci0, or 1 for sci1 bit 7 6 5 4 3 2 1 bit 0 address offset sci0 sci1 scixbdh read: 0 0 0 sbr12 sbr11 sbr10 sbr9 sbr8 $00c8 $00d0 write: scixbdl read: sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 $00c9 $00d1 write: scixcr1 read: loops sciswai rsrc m wake ilt pe pt $00ca $00d2 write: scixcr2 read: tie tcie rie ilie te re rwu sbk $00cb $00d3 write: scixsr1 read: tdre tc rdrf idle or nf fe pf $00cc $00d4 write: scixsr2 read: 0 0 0 0 0 brk13 txdir raf $00cd $00d5 write: scixdrh read: r8 t8 000000 $00ce $00d6 write: scixdrl read: r7 r6 r5 r4 r3 r2 r1 r0 $00cf $00d7 write: t7 t6 t5 t4 t3 t2 t1 t0 = reserved or unimplemented figure 75 sci register quick reference f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 424 serial communications interface (sci) motorola register descriptions this section consists of register descriptions in address order. each description includes a standard register diagram with an associated figure number. writes to a reserved register location do not have any effect and reads of these locations return a zero. details of register bit and field function follow the register diagrams, in bit order. sci baud rate registers (scixbdh/l) where: x = 0 for sci0, or 1 for sci1 read: anytime. if only scixbdh is written to, a read will not return the correct data until scixbdl is written to as well, following a write to scixbdh. write: anytime. writing to scixbdh has no effect without writing to scixbdl, since writing to scixbdh puts the data in a temporary location until scixbdl is written to. the sci baud rate register is used by the counter to determine the baud rate of the sci. the formula for calculating the baud rate is: sci baud rate = bus clock / (16 x br), address offset: $00c8 (sci0bdh), $00d0 (sci1bdh) bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 sbr12 sbr11 sbr10 sbr9 sbr8 write: reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved address offset: $00c9 (sci0bdl), $00d1 (sci1bdl) bit 7 6 5 4 3 2 1 bit 0 read: sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 write: reset: 0 0 0 0 0 1 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register descriptions mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 425 where br is the content of the sci baud rate registers, bits sbr12 through sbr0. the baud rate registers can contain a value from 1 to 8191. sbr12?br0 ?sci baud rate bits the baud rate for the sci is determined by these 13 bits. note: the baud rate generator is disabled until te or re bits in scixcr2 are set for the first time after reset. the baud rate generator is disabled when br = 0. sci control register 1 (scixcr1) where: x = 0 for sci0, or 1 for sci1 read: anytime write: anytime loops ?loop select bit loops enables loop operation. in loop operation, the rxd pin is disconnected from the sci and the transmitter output is internally connected to the receiver input. both the transmitter and the receiver must be enabled to use the loop function. 1 = loop operation enabled 0 = normal operation enabled the receiver input is determined by the rsrc bit. sciswai ?sci stop in wait mode bit sciswai disables the sci in wait mode. address offset: $00ca (sci0cr1), $00d2 (sci1cr1) bit 7 6 5 4 3 2 1 bit 0 read: loops sciswai rsrc m wake ilt pe pt write: reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 426 serial communications interface (sci) motorola 1 = sci disabled in wait mode 0 = sci enabled in wait mode rsrc ?receiver source bit when loops = 1, the rsrc bit determines the source for the receiver shift register input. 1 = receiver input connected externally to transmitter 0 = receiver input internally connected to transmitter output m ?data format mode bit mode determines whether data characters are eight or nine bits long. 1 = one start bit, nine data bits, one stop bit 0 = one start bit, eight data bits, one stop bit wake ?wakeup condition bit wake determines which condition wakes up the sci: a logic 1 (address mark) in the most significant bit position of a received data character or an idle condition on the rxd . 1 = address mark wakeup 0 = idle line wakeup ilt ?idle line type bit ilt determines when the receiver starts counting logic 1s as idle character bits. the counting begins either after the start bit or after the stop bit. if the count begins after the start bit, then a string of logic 1s preceding the stop bit may cause false recognition of an idle character. beginning the count after the stop bit avoids false idle character recognition, but requires properly synchronized transmissions. 1 = idle character bit count begins after stop bit 0 = idle character bit count begins after start bit table 73 loop functions loops rsrc function 0 x normal operation 1 0 loop mode with rx input internally connected to tx output 1 1 single-wire mode with rx input connected to txd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register descriptions mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 427 pe ?parity enable bit pe enables the parity function. when enabled, the parity function inserts a parity bit in the most significant bit position. 1 = parity function enabled 0 = parity function disabled pt ?parity type bit pt determines whether the sci generates and checks for even parity or odd parity. with even parity, an even number of 1s clears the parity bit and an odd number of 1s sets the parity bit. with odd parity, an odd number of 1s clears the parity bit and an even number of 1s sets the parity bit. 1 = odd parity 0 = even parity sci control register 2 (scixcr2) where: x = 0 for sci0, or 1 for sci1 read: anytime write: anytime tie ?transmitter interrupt enable bit tie enables the transmit data register empty flag, tdre, to generate interrupt requests. 1 = tdre interrupt requests enabled 0 = tdre interrupt requests disabled address offset: $00cb (sci0cr2), $00d3 (sci1cr2) bit 7 6 5 4 3 2 1 bit 0 read: tie tcie rie ilie te re rwu sbk write: reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 428 serial communications interface (sci) motorola tcie ?transmission complete interrupt enable bit tcie enables the transmission complete flag, tc, to generate interrupt requests. 1 = tc interrupt requests enabled 0 = tc interrupt requests disabled rie ?receiver full interrupt enable bit rie enables the receive data register full flag, rdrf, or the overrun flag, or, to generate interrupt requests. 1 = rdrf and or interrupt requests enabled 0 = rdrf and or interrupt requests disabled ilie ?idle line interrupt enable bit ilie enables the idle line flag, idle, to generate interrupt requests. 1 = idle interrupt requests enabled 0 = idle interrupt requests disabled te ?transmitter enable bit te enables the sci transmitter and configures the txd pin as being controlled by the sci. the te bit can be used to queue an idle preamble. 1 = transmitter enabled 0 = transmitter disabled re ?receiver enable bit re enables the sci receiver. 1 = receiver enabled 0 = receiver disabled rwu ?receiver wakeup bit standby state 1 = rwu enables the wakeup function and inhibits further receiver interrupt requests. normally, hardware wakes the receiver by automatically clearing rwu. 0 = normal operation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register descriptions mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 429 sbk ?send break bit toggling sbk sends one break character (10 or 11 logic 0s, respectively 13 or 14 logics 0s if brk13 is set). toggling implies clearing the sbk bit before the break character has finished transmitting. as long as sbk is set, the transmitter continues to send complete break characters (10 or 11, respectively 13 or 14 bits). 1 = transmit break characters 0 = no break characters sci status register 1 (scixsr1) where: x = 0 for sci0, or 1 for sci1 the scixsr1 and scixsr2 register provides inputs to the mcu for generation of sci interrupts. also, these registers can be polled by the mcu to check the status of these bits. the flag-clearing procedures require that the status register be read followed by a read or write to the sci data register. it is permissible to execute other instructions between the two steps as long as it does not compromise the handling of i/o, but the order of operations is important for flag clearing. read: anytime write: has no meaning or effect tdre ?transmit data register empty flag tdre is set when the transmit shift register receives a byte from the sci data register. when tdre is 1, the transmit data register (scixdrh/l) is empty and can receive a new value to transmit. clear tdre by reading sci status register 1 (scixsr1) with tdre set and then writing to sci data register low (scixdrl). address offset: $00cc (sci0sr1), $00d4 (sci1sr1) bit 7 6 5 4 3 2 1 bit 0 read: tdre tc rdrf idle or nf fe pf write: reset: 1 1 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 430 serial communications interface (sci) motorola 1 = byte transferred to transmit shift register; transmit data register empty 0 = no byte transferred to transmit shift register tc ?transmit complete flag tc is set low when there is a transmission in progress or when a preamble or break character is loaded. tc is set high when the tdre flag is set and no data, preamble, or break character is being transmitted. when tc is set, the txd out signal becomes idle (logic 1). clear tc by reading sci status register 1 (scixsr1) with tc set and then writing to sci data register low (scixdrl). tc is cleared automatically when data, preamble, or break is queued and ready to be sent. tc is cleared in the event of a simultaneous set and clear of the tc flag (transmission not complete). 1 = no transmission in progress 0 = transmission in progress rdrf ?receive data register full flag rdrf is set when the data in the receive shift register transfers to the sci data register. clear rdrf by reading sci status register 1 (scixsr1) with rdrf set and then reading sci data register low (scixdrl). 1 = received data available in sci data register 0 = data not available in sci data register idle ?idle line flag idle is set when 10 consecutive logic 1s (if m=0) or 11 consecutive logic 1s (if m=1) appear on the receiver input. once the idle flag is cleared, a valid frame must again set the rdrf flag before an idle condition can set the idle flag.clear idle by reading sci status register 1 (scixsr1) with idle set and then reading sci data register low (scixdrl). 1 = receiver input has become idle 0 = receiver input is either active now or has never become active since the idle flag was last cleared note: when the receiver wakeup bit (rwu) is set, an idle line condition does not set the idle flag. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register descriptions mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 431 or ?overrun flag or is set when software fails to read the sci data register before the receive shift register receives the next frame. the or bit is set immediately after the stop bit has been completely received for the second frame. the data in the shift register is lost, but the data already in the sci data registers is not affected. clear or by reading sci status register 1 (scixsr1) with or set and then reading sci data register low (scixdrl). 1 = overrun 0 = no overrun nf ?noise flag nf is set when the sci detects noise on the receiver input. nf bit is set during the same cycle as the rdrf flag but does not get set in the case of an overrun. clear nf by reading sci status register 1 (scixsr1) and then reading sci data register low (scixdrl). 1 = noise 0 = no noise fe ?framing error flag fe is set when a logic 0 is accepted as the stop bit. fe bit is set during the same cycle as the rdrf flag, but does not get set in the case of an overrun. fe inhibits further data reception until it is cleared. clear fe by reading sci status register 1 (scixsr1) with fe set and then reading the sci data register low (scixdrl). 1 = framing error 0 = no framing error pf ?parity error flag pf is set when the parity enable bit, pe, is set and the parity of the received data does not match its parity bit. clear pf by reading sci status register 1 (scixsr1), and then reading sci data register low (scixdrl). 1 = parity error 0 = no parity error f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 432 serial communications interface (sci) motorola sci status register 2 (scixsr2) where: x = 0 for sci0, or 1 for sci1 read: anytime write: anytime; writing accesses sci status register 2; writing to any bits except txdir and brk13 has no effect brk13 ?break transmit character length this bit determines whether the transmit break character is 10 or 11 bit respectively 13 or 14 bits long. the detection of a framing error is not affected by this bit. 1 = break character is 13 or 14 bit long 0 = break character is 10 or 11 bit long txdir ?transmitter pin data direction in single-wire mode. this bit determines whether the txd pin is going to be used as an input or output, in the single-wire mode of operation. this bit is only relevant in the single-wire mode of operation. 1 = txd pin to be used as an output in single-wire mode 0 = txd pin to be used as an input in single-wire mode raf ?receiver active flag raf is set when the receiver detects a logic 0 during the rt1 time period of the start bit search. raf is cleared when the receiver detects an idle character. 1 = reception in progress 0 = no reception in progress address offset: $00cd (sci0sr2), $00d5 (sci1sr2) bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 0 0 brk13 txdir raf write: reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) register descriptions mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 433 sci data registers (scixdrh/l) where: x = 0 for sci0, or 1 for sci1 read: anytime; reading accesses sci receive data register write: anytime; writing accesses sci transmit data register; writing to r8 has no effect r8 ?received bit 8 r8 is the ninth data bit received when the sci is configured for 9-bit data format (m = 1). t8 ?transmit bit 8 t8 is the ninth data bit transmitted when the sci is configured for 9-bit data format (m = 1). r7?0 ?received bits seven through zero for 9-bit or 8-bit data formats t7?0 ?transmit bits seven through zero for 9-bit or 8-bit formats note: if the value of t8 is the same as in the previous transmission, t8 does not have to be rewritten. the same value is transmitted until t8 is rewritten. address offset: $00ce (sci0drh), $00d6 (sci1drh) bit7 6 5 4 3 2 1 bit 0 read: r8 t8 0 0 0 0 0 0 write: reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved address offset: $oocf (sci0drl), $00d7 (sci1drl) bit 7 6 5 4 3 2 1 bit 0 read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: 0 0 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 434 serial communications interface (sci) motorola note: in 8-bit data format, only sci data register low (scixdrl) needs to be accessed. note: when transmitting in 9-bit data format and using 8-bit write instructions, write first to sci data register high (scixdrh), then scixdrl. functional description this section provides a complete functional description of the sci block, detailing the operation of the design from the end user perspective in a number of subsections. figure 76 shows the structure of the sci module. the sci allows full duplex, asynchronous, nrz serial communication between the cpu and remote devices, including other cpus. the sci transmitter and receiver operate independently, although they use the same baud rate generator. the cpu monitors the status of the sci, writes the data to be transmitted, and processes received data. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 435 figure 76 detailed sci block diagram data format the sci uses the standard nrz mark/space data format illustrated in figure 77 below. figure 77 sci data formats sci data receive shift register sci data register transmit shift register register baud rate generator sbr12?br0 bus transmit control 16 receive and wakeup data format control control t8 pf fe nf rdrf idle tie or tcie tdre tc r8 raf loops rwu re pe ilt pt wake m clock idle ilie rie rdrf/or tdre tc interrupt interrupt interrupt interrupt rxd rsrc sbk loops te rsrc request request request request txd bit 5 start bit bit 0 bit 1 next stop bit start bit 9-bit data format bit 2 bit 3 bit 4 bit 6 bit 7 parity or data bit parity or data bit bit m in scixcr1 set 8-bit data format bit m in scixcr1 clear bit 5 bit 0 bit 1 bit 2 bit 3 bit 4 bit 6 bit 7 bit 8 stop bit next start bit start bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 436 serial communications interface (sci) motorola each data character is contained in a frame that includes a start bit, eight or nine data bits, and a stop bit. clearing the m bit in sci control register 1 configures the sci for 8-bit data characters. a frame with eight data bits has a total of 10 bits. setting the m bit configures the sci for nine-bit data characters. a frame with nine data bits has a total of 11 bits. when the sci is configured for 9-bit data characters, the ninth data bit is the t8 bit in sci data register high (scixdrh). it remains unchanged after transmission and can be used repeatedly without rewriting it. a frame with nine data bits has a total of 11 bits. baud rate generation a 13-bit modulus counter in the baud rate generator derives the baud rate for both the receiver and the transmitter. the value from 0 to 8191 written to the sbr12?br0 bits determines the bus clock divisor. the sbr bits are in the sci baud rate registers (scixbdh and scixbdl). the baud rate clock is synchronized with the bus clock and drives the receiver. the baud rate clock divided by 16 drives the transmitter. the receiver has an acquisition rate of 16 samples per bit time. table 74 example of 8-bit data formats start bit data bits address bits parity bits stop bit 18001 17011 17 1 (1) 1. the address bit identifies the frame as an address character. see section on receiver wakeup . 01 table 75 example of 9-bit data formats start bit data bits address bits parity bits stop bit 19001 18011 18 1 (1) 1. the address bit identifies the frame as an address character. see section on receiver wakeup . 01 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 437 baud rate generation is subject to two sources of error: integer division of the bus clock may not give the exact target frequency. synchronization with the bus clock can cause phase shift. table 76 lists some examples of achieving target baud rates with a bus clock frequency of 16 mhz sci baud rate = bus clock / (16 *sbr[12:0]) note: the maximum divider rate is 8191. table 76 baud rates (example: bus clock = 16.0 mhz) bits sbr[12-0] receiver clock (hz) transmitter clock (hz) target baud rate error (%) 13 1,230,769 76923 76800 0.16 26 615,385 38,462 38,400 0.16 52 307,692 19,231 19,200 0.16 104 153,846 9615 9600 0.16 208 76,923 4808 4800 0.16 417 38,369 2398 2400 -0.08 833 19,207 1200 1200 0.04 1664 9,598 600 600 -0.02 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 438 serial communications interface (sci) motorola transmitter figure 78 transmitter block diagram transmitter character length the sci transmitter can accommodate either 8-bit or 9-bit data characters. the state of the m bit in sci control register 1 (scixcr1) determines the length of data characters. when transmitting 9-bit data, bit t8 in sci data register high (scixdrh) is the ninth bit (bit 8). character transmission to transmit data, the mcu writes the data bits to the sci data registers (scixdrh/scixdrl), which in turn are transferred to the transmitter pe pt h876543210l 11-bit transmit shift register stop start t8 tdre tie tcie sbk tc parity generation msb sci data registers load from scidr shift enable preamble (all ones) break (all 0s) transmitter control m internal bus sbr12?br0 baud divider 16 tdre interrupt request tc interrupt request module loop rsrc clock te to control receiver loops tx brk13 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 439 shift register. the transmit shift register then shifts a frame out through the tx output signal, after it has prefaced it with a start bit and appended it with a stop bit. the sci data registers (scixdrh and scixdrl) are the write-only buffers between the internal data bus and the transmit shift register. the sci also sets a flag, the transmit data register empty flag (tdre), every time it transfers data from the buffer (scixdrh/l) to the transmitter shift register.the transmit driver routine may respond to this flag by writing another byte to the transmitter buffer (scixdrh/scixdrl), while the shift register is still shifting out the first byte. to initiate an sci transmission: 9. configure the sci: a. select a baud rate. write this value to the sci baud registers (scixbdh/l) to begin the baud rate generator. remember that the baud rate generator is disabled when the baud rate is zero. writing to the scixbdh has no effect without also writing to scixbdl. b. write to scixcr1 to configure word length, parity, and other configuration bits (loops, rsrc, m, wake, ilt, pe, pt). c. enable the transmitter, interrupts, receive, and wake up as required, by writing to the scixcr2 register bits (tie, tcie, rie, ilie, te, re, rwu, sbk). a preamble or idle character will now be shifted out of the transmitter shift register. 10. transmit procedure for each byte: a. poll the tdre flag by reading the scixsr1 or responding to the tdre interrupt. keep in mind that the tdre bit resets to one. b. if the tdre flag is set, write the data to be transmitted to scixdrh/l, where the ninth bit is written to the t8 bit in scixdrh if the sci is in 9-bit data format. a new transmission will not result until the tdre flag has been cleared. 11. repeat step 2 for each subsequent transmission. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 440 serial communications interface (sci) motorola note: the tdre flag is set when the shift register is loaded with the next data to be transmitted from scixdrh/l, which happens, generally speaking, a little over half-way through the stop bit of the previous frame. specifically, this transfer occurs 9/16ths of a bit time after the start of the stop bit of the previous frame. writing the te bit from 0 to a 1 automatically loads the transmit shift register with a preamble of 10 logic 1s (if m = 0) or 11 logic 1s (if m = 1). after the preamble shifts out, control logic transfers the data from the sci data register into the transmit shift register. a logic 0 start bit automatically goes into the least significant bit position of the transmit shift register. a logic 1 stop bit goes into the most significant bit position. hardware supports odd or even parity. when parity is enabled, the most significant bit (msb) of the data character is the parity bit. the transmit data register empty flag, tdre, in sci status register 1 (scixsr1) becomes set when the sci data register transfers a byte to the transmit shift register. the tdre flag indicates that the sci data register can accept new data from the internal data bus. if the transmit interrupt enable bit, tie, in sci control register 2 (scixcr2) is also set, the tdre flag generates a transmitter interrupt request. when the transmit shift register is not transmitting a frame, the tx output signal goes to the idle condition, logic 1. if at any time software clears the te bit in sci control register 2 (scixcr2), the transmitter enable signal goes low and the transmit signal goes idle. if software clears te while a transmission is in progress (tc = 0), the frame in the transmit shift register continues to shift out. to avoid accidentally cutting off the last frame in a message, always wait for tdre to go high after the last frame before clearing te. to separate messages with preambles of minimum idle line time, use this sequence between messages: 1. write the last byte of the first message to scixdrh/l. 2. wait for the tdre flag to go high, indicating the transfer of the last frame to the transmit shift register. 3. queue a preamble by clearing and then setting the te bit. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 441 4. write the first byte of the second message to scixdrh/l. break characters writing a logic 1 to the send break bit, sbk, in sci control register 2 (scixcr2) loads the transmit shift register with a break character. a break character contains all logic 0s and has no start, stop, or parity bit. break character length depends on the m bit in sci control register 1 (scixcr1). as long as sbk is at logic 1, transmitter logic continuously loads break characters into the transmit shift register. after software clears the sbk bit, the shift register finishes transmitting the last break character and then transmits at least one logic 1. the automatic logic 1 at the end of a break character guarantees the recognition of the start bit of the next frame. the sci recognizes a break character when a start bit is followed by eight or nine logic 0 data bits and a logic 0 where the stop bit should be. receiving a break character has these effects on sci registers: sets the framing error flag, fe sets the receive data register full flag, rdrf clears the sci data registers (scixdrh/l) may set the overrun flag, or, noise flag, nf, parity error flag, pe, or the receiver active flag, raf (see sci status register 1 (scixsr1) and sci status register 2 (scixsr2) ) idle characters an idle character contains all logic 1s and has no start, stop, or parity bit. idle character length depends on the m bit in sci control register 1 (scixcr1). the preamble is a synchronizing idle character that begins the first transmission initiated after writing the te bit from 0 to 1. if the te bit is cleared during a transmission, the tx output signal becomes idle after completion of the transmission in progress. clearing and then setting the te bit during a transmission queues an idle character to be sent after the frame currently being transmitted. note: when queueing an idle character, return the te bit to logic 1 before the stop bit of the current frame shifts out through the tx output signal. setting te after the stop bit appears on tx output signal causes data previously written to the sci data register to be lost. toggle the te bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 442 serial communications interface (sci) motorola for a queued idle character while the tdre flag is set and immediately before writing the next byte to the sci data register. note: if the te bit is clear and the transmission is complete, the sci is not the master of the txd pin. receiver figure 79 sci receiver block diagram receiver character length the sci receiver can accommodate either 8-bit or 9-bit data characters. the state of the m bit in sci control register 1 (scixcr1) determines the all ones m wake ilt pe pt re h876543210l 11-bit receive shift register stop start data wakeup parity checking msb sci data register r8 rie ilie rwu rdrf or nf fe pe internal bus module idle interrupt request rdrf/or interrupt request sbr12?br0 baud divider loop rsrc from txd clock idle raf recovery control logic loops rxd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 443 length of data characters. when receiving 9-bit data, bit r8 in sci data register high (scixdrh) is the ninth bit (bit 8). character reception during an sci reception, the receive shift register shifts a frame in from the rx input signal. the sci data register is the read-only buffer between the internal data bus and the receive shift register. after a complete frame shifts into the receive shift register, the data portion of the frame transfers to the sci data register. the receive data register full flag, rdrf, in sci status register 1 (scixsr1) becomes set, indicating that the received byte can be read. if the receive interrupt enable bit, rie, in sci control register 2 (scixcr2) is also set, the rdrf flag generates an rdrf interrupt request. data sampling the receiver samples the rx input signal at the rt clock rate. the rt clock is an internal signal with a frequency 16 times the baud rate. to adjust for baud rate mismatch, the rt clock (see figure 80 ) is re-synchronized: after every start bit after the receiver detects a data bit change from logic 1 to logic 0 (after the majority of data bit samples at rt8, rt9, and rt10 returns a valid logic 1 and the majority of the next rt8, rt9, and rt10 samples returns a valid logic 0) to locate the start bit, data recovery logic does an asynchronous search for a logic 0 preceded by three logic 1s. when the falling edge of a possible start bit occurs, the rt clock begins to count to 16. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 444 serial communications interface (sci) motorola figure 80 receiver data sampling to verify the start bit and to detect noise, data recovery logic takes samples at rt3, rt5, and rt7. table 77 summarizes the results of the start bit verification samples. if start bit verification is not successful, the rt clock is reset and a new search for a start bit begins. to determine the value of a data bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 78 summarizes the results of the data bit samples. reset rt clock rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt8 rt7 rt6 rt11 rt10 rt9 rt15 rt14 rt13 rt12 rt16 rt1 rt2 rt3 rt4 samples rt clock rt clock count start bit rx input signal start bit qualification start bit data sampling 11 1 1 1 1 110000 0 00 lsb verification table 77 start bit veri?ation rt3, rt5, and rt7 samples start bit verification noise flag 000 yes 0 001 yes 1 010 yes 1 011 no 0 100 yes 1 101 no 0 110 no 0 111 no 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 445 note: the rt8, rt9, and rt10 samples do not affect start bit verification. if any or all of the rt8, rt9, and rt10 start bit samples are logic 1s following a successful start bit verification, the noise flag (nf) is set and the receiver assumes that the bit is a start bit (logic 0). to verify a stop bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 79 summarizes the results of the stop bit samples. in figure 81 , the verification samples rt3 and rt5 determine that the first low detected was noise and not the beginning of a start bit. the rt clock is reset and the start bit search begins again. the noise flag is not set because the noise occurred before the start bit was found. table 78 data bit recovery rt8, rt9, and rt10 samples data bit determination noise flag 000 0 0 001 0 1 010 0 1 011 1 1 100 0 1 101 1 1 110 1 1 111 1 0 table 79 stop bit recovery rt8, rt9, and rt10 samples framing error flag noise flag 000 1 0 001 1 1 010 1 1 011 0 1 100 1 1 101 0 1 110 0 1 111 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 446 serial communications interface (sci) motorola figure 81 start bit search example 1 in figure 82 , verification sample at rt3 is high. the rt3 sample sets the noise flag. although the perceived bit time is misaligned, the data samples rt8, rt9, and rt10 are within the bit time and data recovery is successful. figure 82 start bit search example 2 in figure 83 , a large burst of noise is perceived as the beginning of a start bit, although the test sample at rt5 is high. the rt5 sample sets the noise flag. although this is a worst-case misalignment of perceived reset rt clock rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt1 rt1 rt2 rt3 rt4 rt7 rt6 rt5 rt10 rt9 rt8 rt14 rt13 rt12 rt11 rt15 rt16 rt1 rt2 rt3 samples rt clock rt clock count start bit rx input signal 11 0 1 111000 00 lsb 0 0 reset rt clock rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt11 rt10 rt9 rt14 rt13 rt12 rt2 rt1 rt16 rt15 rt3 rt4 rt5 rt6 rt7 samples rt clock rt clock count actual start bit rx input signal 11 1 1 11000 0 lsb 0 0 perceived start bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 447 bit time, the data samples rt8, rt9, and rt10 are within the bit time and data recovery is successful. figure 83 start bit search example 3 figure 84 shows the effect of noise early in the start bit time. although this noise does not affect proper synchronization with the start bit time, it does set the noise flag. figure 84 start bit search example 4 figure 85 shows a burst of noise near the beginning of the start bit that resets the rt clock. the sample after the reset is low but is not preceded reset rt clock rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt9 rt10 rt13 rt12 rt11 rt16 rt15 rt14 rt4 rt3 rt2 rt1 rt5 rt6 rt7 rt8 rt9 samples rt clock rt clock count actual start bit rx input signal 10 1 11000 0 lsb 0 perceived start bit reset rt clock rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt7 rt6 rt5 rt10 rt9 rt8 rt14 rt13 rt12 rt11 rt15 rt16 rt1 rt2 rt3 samples rt clock rt clock count perceived and actual start bit rx input signal 11 1 1100 1 lsb 1 1 1 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 448 serial communications interface (sci) motorola by three high samples that would qualify as a falling edge. depending on the timing of the start bit search and on the data, the frame may be missed entirely or it may set the framing error flag. figure 85 start bit search example 5 in figure 86 , a noise burst makes the majority of data samples rt8, rt9, and rt10 high. this sets the noise flag but does not reset the rt clock. in start bits only, the rt8, rt9, and rt10 data samples are ignored. figure 86 start bit search example 6 reset rt clock rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt7 rt6 rt5 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 samples rt clock rt clock count start bit rx input signal 11 1 1101 0 lsb 1 1 1 1 1 00 0 00 0 0 0 no start bit found reset rt clock rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt7 rt6 rt5 rt10 rt9 rt8 rt14 rt13 rt12 rt11 rt15 rt16 rt1 rt2 rt3 samples rt clock rt clock count start bit rx input signal 11 1 1100 0 lsb 1 1 1 1 0 11 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 449 framing errors if the data recovery logic does not detect a logic 1 where the stop bit should be in an incoming frame, it sets the framing error flag, fe, in sci status register 1 (scixsr1). a break character also sets the fe flag because a break character has no stop bit. the fe flag is set at the same time that the rdrf flag is set. baud rate tolerance a transmitting device may be operating at a baud rate below or above the receiver baud rate. accumulated bit time misalignment can cause one of the three stop bit data samples (rt8, rt9, and rt10) to fall outside the actual stop bit. a noise error will occur if the rt8, rt9, and rt10 samples are not all the same logical values. a framing error will occur if the receiver clock is misaligned in such a way that the majority of the rt8, rt9, and rt10 stop bit samples are a logic zero. as the receiver samples an incoming frame, it re-synchronizes the rt clock on any valid falling edge within the frame. resynchronization within frames will correct a misalignment between transmitter bit times and receiver bit times. slow data tolerance figure 87 shows how much a slow received frame can be misaligned without causing a noise error or a framing error. the slow stop bit begins at rt8 instead of rt1 but arrives in time for the stop bit data samples at rt8, rt9, and rt10. figure 87 slow data for an 8-bit data character, data sampling of the stop bit takes the receiver 9 bit times x 16 rt cycles +10 rt cycles =154 rt cycles. msb stop rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt9 rt10 rt11 rt12 rt13 rt14 rt15 rt16 data samples receiver rt clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 450 serial communications interface (sci) motorola with the misaligned character shown in figure 87 , the receiver counts 154 rt cycles at the point when the count of the transmitting device is 9 bit times x 16 rt cycles + 3 rt cycles = 147 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a slow 8-bit data character with no errors is: ((154 ?147) / 154) x 100 = 4.54% for a 9-bit data character, data sampling of the stop bit takes the receiver 10 bit times x 16 rt cycles + 10 rt cycles = 170 rt cycles. with the misaligned character shown in figure 87 , the receiver counts 170 rt cycles at the point when the count of the transmitting device is 10 bit times x 16 rt cycles + 3 rt cycles = 163 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a slow 9-bit character with no errors is: ((170 ?163) / 170) x 100 = 4.12% fast data tolerance figure 88 shows how much a fast received frame can be misaligned. the fast stop bit ends at rt10 instead of rt16 but is still sampled at rt8, rt9, and rt10. figure 88 fast data for an 8-bit data character, data sampling of the stop bit takes the receiver 9 bit times x 16 rt cycles + 10 rt cycles = 154 rt cycles. idle or next frame stop rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt9 rt10 rt11 rt12 rt13 rt14 rt15 rt16 data samples receiver rt clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 451 with the misaligned character shown in figure 88 , the receiver counts 154 rt cycles at the point when the count of the transmitting device is 10 bit times x 16 rt cycles = 160 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a fast 8-bit character with no errors is: ((154 ?160) / 154) x 100 = 3.90% for a 9-bit data character, data sampling of the stop bit takes the receiver 10 bit times x 16 rt cycles + 10 rt cycles = 170 rt cycles. with the misaligned character shown in figure 88 , the receiver counts 170 rt cycles at the point when the count of the transmitting device is 11 bit times x 16 rt cycles = 176 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a fast 9-bit character with no errors is: ((170 ?176) / 170) x 100 = 3.53% receiver wakeup to enable the sci to ignore transmissions intended only for other receivers in multiple-receiver systems, the receiver can be put into a standby state. setting the receiver wakeup bit, rwu, in sci control register 2 (scixcr2) puts the receiver into a standby state during which receiver interrupts are disabled.the sci will still load the receive data into the scixdrh/l registers, but it will not set the rdrf flag. the transmitting device can address messages to selected receivers by including addressing information in the initial frame or frames of each message. the wake bit in sci control register 1 (scixcr1) determines how the sci is brought out of the standby state to process an incoming message. the wake bit enables either idle line wakeup or address mark wakeup. idle input line wakeup (wake = 0) in this wakeup method, an idle condition on the rx input signal clears the rwu bit and wakes up the sci. the initial frame or frames of every message contain addressing information. all receivers evaluate the addressing information, and receivers for which the message is f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 452 serial communications interface (sci) motorola addressed process the frames that follow. any receiver for which a message is not addressed can set its rwu bit and return to the standby state. the rwu bit remains set and the receiver remains on standby until another idle character appears on the rx input signal. idle line wakeup requires that messages be separated by at least one idle character and that no message contains idle characters. the idle character that wakes a receiver does not set the receiver idle bit, idle, or the receive data register full flag, rdrf. the idle line type bit, ilt, determines whether the receiver begins counting logic 1s as idle character bits after the start bit or after the stop bit. ilt is in sci control register 1 (scixcr1). address mark wakeup (wake = 1) in this wakeup method, a logic 1 in the most significant bit (msb) position of a frame clears the rwu bit and wakes up the sci. the logic 1 in the msb position marks a frame as an address frame that contains addressing information. all receivers evaluate the addressing information, and the receivers for which the message is addressed process the frames that follow. any receiver for which a message is not addressed can set its rwu bit and return to the standby state. the rwu bit remains set and the receiver remains on standby until another address frame appears on the rx input signal. the logic 1 msb of an address frame clears the receiver? rwu bit before the stop bit is received and sets the rdrf flag. address mark wakeup allows messages to contain idle characters but requires that the msb be reserved for use in address frames. note: with the wake bit clear, setting the rwu bit after the rx input signal has been idle can cause the receiver to wake up immediately. single-wire operation normally, the sci uses two pins for transmitting and receiving. in single-wire operation, the rxd pin is disconnected from the sci. the sci uses the txd pin for both receiving and transmitting. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) functional description mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 453 figure 89 single-wire operation (loops = 1, rsrc = 1) enable single-wire operation by setting the loops bit and the receiver source bit, rsrc, in sci control register 1 (scixcr1). setting the loops bit disables the path from the rx input signal to the receiver. setting the rsrc bit connects the receiver input to the output of the txd pin driver. both the transmitter and receiver must be enabled (te=1 and re=1).the txdir bit (scixsr2[1]) determines whether the txd pin is going to be used as an input (txdir = 0) or an output (txdir = 1) in this mode of operation. loop operation in loop operation the transmitter output goes to the receiver input. the rx input signal is disconnected from the sci. figure 90 loop operation (loops = 1, rsrc = 0) enable loop operation by setting the loops bit and clearing the rsrc bit in sci control register 1 (scixcr1). setting the loops bit disables the path from the rx input signal to the receiver. clearing the rsrc bit connects the transmitter output to the receiver input. both the transmitter and receiver must be enabled (te = 1 and re = 1). rxd transmitter receiver txd output signal txd input signal rxd transmitter receiver tx output signal f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 454 serial communications interface (sci) motorola interrupts recovery from wait mode the sci interrupt request can be used to bring the cpu out of wait mode. system level interrupt sources this section describes the interrupt originated by the sci block.the mcu must service the interrupt requests. table 80 lists the five interrupt sources of the sci. the local enables for the five sci interrupt sources, are described in table 80 . the sci only originates interrupt requests. the following is a description of how the sci makes a request and how the mcu should acknowledge that request. the sci only has a single interrupt line ( sci interrupt signal , active high operation) and all the following interrupts, when generated, are ored together and issued through that port. tdre description the tdre interrupt is set high by the sci when the transmit shift register receives a byte from the sci data register. a tdre interrupt indicates that the transmit shift register (scixdrh/l) is empty and that a new byte can be written to the scixdrh/l for transmission.clear tdre by table 80 sci interrupt sources interrupt vector address source description sci0 sci1 tdre $ffd6, $ffd7 $ffd4, $ffd5 scixsr1[7] active high level detect. indicates that a byte was transferred from scixdrh/l to the transmit shift register. tc scixsr1[6] active high level detect. indicates that a transmit is complete. rdrf scixsr1[5] active high level detects. the rdrf interrupt indicates that received data is available in the sci data register. or scixsr1[3] active high level detects. this interrupt indicates that an overrun condition has occurred. idle scixsr1[4] active high level detect. indicates that receiver input has become idle. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) interrupts mc9s12t64revision 1.1.1 motorola serial communications interface (sci) 455 reading sci status register 1 with tdre set and then writing to sci data register low (scixdrl). tc description the tc interrupt is set by the sci when a transmission has been completed. a tc interrupt indicates that there is no transmission in progress. tc is set high when the tdre flag is set and no data, preamble, or break character is being transmitted. when tc is set, the txd pin becomes idle (logic 1). clear tc by reading sci status register 1 (scixsr1) with tc set and then writing to sci data register low (scixdrl). tc is cleared automatically when data, preamble, or break is queued and ready to be sent. rdrf description the rdrf interrupt is set when the data in the receive shift register transfers to the sci data register. a rdrf interrupt indicates that the received data has been transferred to the sci data register and that the byte can now be read by the mcu. the rdrf interrupt is cleared by reading the sci status register one (scixsr1) and then reading sci data register low (scixdrl). or description the or interrupt is set when software fails to read the sci data register before the receive shift register receives the next frame. the newly acquired data in the shift register will be lost in this case, but the data already in the sci data registers is not affected. the or interrupt is cleared by reading the sci status register one (scixsr1) and then reading sci data register low (scixdrl). idle description the idle interrupt is set when 10 consecutive logic 1s (if m=0) or 11 consecutive logic 1s (if m=1) appear on the receiver input. once the idle is cleared, a valid frame must again set the rdrf flag before an idle condition can set the idle flag. clear idle by reading sci status register 1 (scixsr1) with idle set and then reading sci data register low (scixdrl). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial communications interface (sci) mc9s12t64revision 1.1.1 456 serial communications interface (sci) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 457 serial peripheral interface (spi) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 low power mode options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 overview the serial peripheral interface module allows a duplex, synchronous, serial communication between the mcu and peripheral devices. software can poll the spi status flags or the spi operation can be interrupt driven. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 458 serial peripheral interface (spi) motorola features the serial peripheral interface includes these distinctive features: master mode and slave mode bi-directional mode slave select output mode fault error flag with cpu interrupt capability double-buffered operation serial clock with programmable polarity and phase control of spi operation during wait mode modes of operation the spi functions in three modes, run, wait, and stop. run mode this is the basic mode of operation. wait mode spi operation in wait mode is a configurable low power mode. depending on the state of internal bits, the spi can operate normally when the cpu is in wait mode or the spi clock generation can be turned off and the spi module enters a power conservation state during wait mode. during wait mode, any master transmission in progress stops if the spiswai bit is set in the spicr2 register. reception and transmission of a byte as slave continues so that the slave is synchronized to the master. stop mode the spi is inactive in stop mode for reduced power consumption. the stop instruction does not affect or depend on spi register states. again, reception and transmission of a byte as slave continues to stay synchronized with the master. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) block diagram mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 459 this is a high level description only, detailed descriptions of operating modes are contained in section low power mode options . block diagram figure 91 is a block diagram of the serial peripheral interface. figure 91 spi block diagram pin control logic 8-bit shift register clock logic spi control spi status register spi data register divider select spi baud rate register 2 4 8 16 32 64 128 256 spi interrupt s m m s m s request spi control register 1 baud rate generator miso mosi spi control register 2 ss sck bus clock modf spif sptef sppr2 sppr1 spr1 spr0 sppr0 spr2 mstr cpha cpol lsbfe bidiroe spc0 baud clock ipbus muxed clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 460 serial peripheral interface (spi) motorola external pin descriptions miso (ps4) master in / slave out. this pin is used to transmit data out of the spi module when it is configured as a slave, and receive data when it is configured as master mosi (ps5) master out/ slave in. this pin is used to transmit data out of the spi module when it is configured as a master, and receive data when it is configured as slave. sck (ps6) serial clock. this pin is used to output the clock with respect to which the spi module tranfers and receives data. ss (ps7) slave select. this pin is used to output the select signal from the spi module to another peripheral with which a data transfer is to take place. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) register map mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 461 register map note: register address = base address (initrg) + address offset register name bit 7 6 5 4 3 2 1 bit 0 address offset spicr1 read: spie spe sptie mstr cpol cpha ssoe lsbfe $00d8 write: spicr2 read: 0 0 0 mod- fen bidiroe 0 spiswai spc0 $00d9 write: spibr read: 0 sppr2 sppr1 sppr0 0 spr2 spr1 spr0 $00da write: spisr read: spif 0 sptef modf 0 0 0 0 $00db write: spi reserved read: 0 0 0 0 0 0 0 0 $00dc write: spidr read: bit 7 6 5 4 3 2 1 bit 0 $00dd write: spi reserved read: 0 0 0 0 0 0 0 0 $00de write: spi reserved read: 0 0 0 0 0 0 0 0 $00df write: = unimplemented or reserved figure 92 spi register summary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 462 serial peripheral interface (spi) motorola register descriptions this section consists of register descriptions in address order. each description includes a standard register diagram with an associated figure number. details of register bit and field function follow the register diagrams, in bit order. spi control register 1 (spicr1) read: anytime write: anytime spie ?spi interrupt enable bit this bit enables spi interrupts each time the spif or modf status flag is set. 1 = spi interrupts enabled. 0 = spi interrupts disabled. spe ?spi system enable bit this bit enables the spi system and dedicates the spi port pins to spi system functions. 1 = spi port pins are dedicated to spi functions. 0 = spi disabled. (lower power consumption) sptie ?spi transmit interrupt enable this bit enables spi interrupt generated each time the sptef flag is set. 1 = sptef interrupt enabled. 0 = sptef interrupt disabled. mstr ?spi master/slave mode select bit address offset: $00d8 bit 7 6 5 4 3 2 1 bit 0 read: spie spe sptie mstr cpol cpha ssoe lsbfe write: reset: 0 0 0 0 0 1 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) register descriptions mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 463 1 = master mode 0 = slave mode cpol ?spi clock polarity bit this bit selects an inverted or non-inverted spi clock. to transmit data between spi modules, the spi modules must have identical cpol values. 1 = active-low clocks selected; sck idles high 0 = active-high clocks selected; sck idles low cpha ?spi clock phase bit this bit is used to shift the sck serial clock. 1 = the first sck edge is issued at the beginning of the 8-cycle transfer operation 0 = the first sck edge is issued one-half cycle into the 8-cycle transfer operation ssoe ?slave select output enable the ss output feature is enabled only in the master mode by asserting the ssoe as shown in table 81 . lsbfe ?spi lsb-first enable this bit does not affect the position of the msb and lsb in the data register. reads and writes of the data register always have the msb in bit 7. 1 = data is transferred least significant bit first. 0 = data is transferred most significant bit first. table 81 ss input / output selection mod fen ssoe master mode slave mode 00 ss not used by spi ss input 01 ss not used by spi ss input 10 ss input with modf feature ss input 11 ss output ss input f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 464 serial peripheral interface (spi) motorola spi control register 2 (spicr2) read: anytime write: anytime; writes to unimplemented bits have no effect modfen ?mode fault enable bit this bit when set allows the modf flag to be set. if the modf flag is set, clearing the modfen does not clear the modf flag. if the spi is enabled as master and the modfen bit is low, then the ss pin is not used by the spi. when the spi is enabled as a slave, the ss is available only as an input regardless of the value of modfen. 1 = enable setting the modf error 0 = disable the modf error bidiroe ?output enable in the bidirectional mode of operation this bit along with the mstr bit of spcr1 is used to enable the output buffer when the spi is configured in bidirectional mode. 1 = output buffer enabled 0 = output buffer disabled spiswai ?spi stop in wait mode bit this bit is used for power conservation while in wait mode. 1 = stop spi clock generation when in wait mode 0 = spi clock operates normally in wait mode spc0 ?serial pin control bit 0 with the mstr control bit, this bit enables bidirectional pin configurations as shown in table 82 . address offset: $00d9 bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 modfen bidiroe 0 spiswai spc0 write: reset: 00 0 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) register descriptions mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 465 spi baud rate register (spibr) read: anytime write: anytime; writes to unimplemented bits have no effect note: writing to this register during data transfers may cause spurious results sppr2?ppr0 ?spi baud rate preselection bits spr2?pr0 ?spi baud rate selection bits these bits are used in the determination of the spi baud rates as shown in the table 83 . for details see spi baud rate generation in page 479 . the bus clock divisor equation is as follows; table 82 bidirectional pin con?urations pin mode spc0 mstr miso (1) 1. slave output is enabled if bidiroe bit = 1, ss = 0, and mstr = 0 (c) mosi (2) 2. master output is enabled if bidiroe bit = 1 and mstr = 1 (d) sck (3) 3. sck output is enabled if mstr = 1 (b, d) ss (4) 4. ss output is enabled if modfen bit = 1, ssoe = 1, and mstr = 1 (b, d). a normal 0 0 slave out slave in sck in ss in b 1 master in master out sck out ss i/o c bidirectional 1 0 slave i/o --- sck in ss in d 1 --- master i/o sck out ss i/o address offset: $00da bit 7 6 5 4 3 2 1 bit 0 read: 0 sppr2 sppr1 sppr0 0 spr2 spr1 spr0 write: reset: 00 0 0 0 0 0 0 = unimplemented or reserved  <:
36*2 0=0:69  ? + () ?  ? + () = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 466 serial peripheral interface (spi) motorola  (<+(;,  <:
36*2  <:
36*2 0=0:69 ------------------------------------------------- - = table 83 spi baud rate selection (16 mhz bus clock) sppr2 sppr1 sppr0 spr2 spr1 spr0 bus clock divisor baud rate 000000 2 (1) 8 mhz 000001 4 (1) 4 mhz 000010 8 2 mhz 000011 16 1 mhz 0 0 0 1 0 0 32 500 khz 0 0 0 1 0 1 64 250 khz 0 0 0 1 1 0 128 125 khz 0 0 0 1 1 1 256 62.5 khz 001000 4 (1) 4 mhz 001001 8 2 mhz 001010 16 1 mhz 0 0 1 0 1 1 32 500 khz 0 0 1 1 0 0 64 250 khz 0 0 1 1 0 1 128 125 khz 0 0 1 1 1 0 256 62.5 khz 0 0 1 1 1 1 512 31.25 khz 0 1 0 0 0 0 6 2.67 mhz 0 1 0 0 0 1 12 1.33 mhz 0 1 0 0 1 0 24 666.67 khz 0 1 0 0 1 1 48 333.33 khz 0 1 0 1 0 0 96 166.67 khz 0 1 0 1 0 1 192 83.33 khz 0 1 0 1 1 0 384 41.67 khz 0 1 0 1 1 1 768 20.83 khz 011000 8 2 mhz 011001 16 1 mhz 0 1 1 0 1 0 32 500 khz 0 1 1 0 1 1 64 250 khz 0 1 1 1 0 0 128 125 khz 0 1 1 1 0 1 256 62.5 khz 0 1 1 1 1 0 512 31.25 khz 0 1 1 1 1 1 1024 15.63 khz f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) register descriptions mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 467 100000 10 1.6 mhz 100001 20 800 khz 100010 40 400 khz 100011 80 200 khz 100100 160 100 khz 100101 320 50 khz 100110 640 25 khz 100111 1280 12.5 khz 101000 12 1.33 mhz 101001 24 666.67 khz 101010 48 333.33 khz 101011 96 166.67 khz 101100 192 83.33 khz 101101 384 41.67 khz 101110 768 20.83 khz 101111 1536 10.42 khz 110000 14 1.14 mhz 110001 28 571.43 khz 110010 56 285.71 khz 110011 112 142.86 khz 110100 224 71.43 khz 110101 448 35.71 khz 110110 896 17.86 khz 110111 1792 8.93 khz 111000 16 1 mhz 111001 32 500 mhz 111010 64 250 khz 111011 128 125 khz 111100 256 62.5 khz 111101 512 31.25 khz 111110 1024 15.63 khz 111111 2048 7.81 khz 1. these bus clock divisors are not supported in slave mode of spi. table 83 spi baud rate selection (16 mhz bus clock) (continued) sppr2 sppr1 sppr0 spr2 spr1 spr0 bus clock divisor baud rate f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 468 serial peripheral interface (spi) motorola spi status register (spisr) read: anytime write: has no meaning or effect spif ?spi interrupt flag this bit is set after the eighth sck cycle in a data transfer and is cleared by reading the spisr register (with spif set) followed by a read access to the spi data register. 1 = new data copied to spidr 0 = transfer not yet complete sptef ?spi transmit empty interrupt flag note: there is an errata information about the sptef flag. see mc9s12t64 errata sheet for details. this bit is set when there is room in the transmit data buffer. it is cleared by reading spisr with sptef set, followed by writing a data value to the transmit buffer at spidr. spisr must be read with sptef=1 before writing data to spidr or the spidr write will be ignored. sptef generates an sptef cpu interrupt request if the sptie bit in the spicr1 is also set. sptef is automatically set when a data byte transfers from the transmit buffer into the transmit shift register. for an idle spi (no data in the transmit buffer or the shift register and no transfer in progress), data written to spidr is transferred to the shifter almost immediately so sptef is set within two bus cycles allowing a second 8-bit data value to be queued into the transmit buffer. after completion of the transfer of the value in the shift register, the queued value from the transmit buffer will automatically move to the shifter and sptef will be set to indicate address offset: $00db bit 7 6 5 4 3 2 1 bit 0 read: spif 0 sptef modf 0 0 0 0 write: reset: 00 1 0 0 0 0 0 = unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) register descriptions mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 469 there is room for new data in the transmit buffer. if no new data is waiting in the transmit buffer, sptef simply remains set and no data moves from the buffer to the shifter. 1 = spi data register empty 0 = spi data register not empty note: do not write to the spi data register unless the sptef bit is high. any such write to the spi data register before reading sptef=1 is effectively ignored modf ?mode fault flag note: there is an errata information about the mode fault behavior. see mc9s12t64 errata sheet for details. this bit is set if the ss input becomes low while the spi is configured as a master. the flag is cleared automatically by a read of the spi status register (with modf set) followed by a write to the spi control register 1. the modf flag is set only if the modfen bit of spicr2 register is set, refer to modfen bit description in spi control register 2 (spicr2) . 1 = mode fault has occurred. 0 = mode fault has not occurred. spi data register (spidr) read: anytime; normally read only after spif is set write: anytime; see sptef bit in spisr register the spi data register is both the input and output register for spi data. a write to this register allows a data byte to be queued and transmitted. for a spi configured as a master, a queued data byte is address offset: $00dd bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 2 bit 0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 470 serial peripheral interface (spi) motorola transmitted immediately after the previous transmission has completed. the spi transmitter empty flag in spisr indicates when the spi data register is ready to accept new data. note: do not write to the spi data register unless the sptef bit is high. reading the data can occur anytime from after the spif is set to before the end of the next transfer. if the spif is not serviced by the end of the successive transfers, those data bytes are lost and the data within the spidr retains the first byte until spif is serviced. note: after reset the content of the spi shift register is undefined until a data byte is stored into spidr. functional description the spi module allows a duplex, synchronous, serial communication between the mcu and peripheral devices. software can poll the spi status flags or spi operation can be interrupt driven. the spi system is enabled by setting the spi enable (spe) bit in spi control register 1. while spe is set, the four associated spi port pins are dedicated to the spi function as: slave select ( ss) serial clock (sck) master out/slave in (mosi) master in/slave out (miso) the main element of the spi system is the spi data register. the 8-bit data register in the master and the 8-bit data register in the slave are linked by the mosi and miso pins to form a distributed 16-bit register. when a data transfer operation is performed, this 16-bit register is serially shifted eight bit positions by the sck clock from the master; data is exchanged between the master and the slave. data written to the master spi data register becomes the output data for the slave, and data read from the master spi data register after a transfer operation is the input data from the slave. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 471 a write to the spi data register puts data into the transmit buffer if the previous transmission was complete. when a transfer is complete, received data is moved into a receive data register. data may be read from this double-buffered system any time before the next transfer is complete. this 8-bit data register acts as the spi receive data register for reads and as the spi transmit data register for writes. a single spi register address is used for reading data from the read data buffer and for writing data to the shifter. the clock phase control bit (cpha) and a clock polarity control bit (cpol) in the spi control register 1 select one of four possible clock formats to be used by the spi system. the cpol bit simply selects a non-inverted or inverted clock. the cpha bit is used to accommodate two fundamentally different protocols by shifting the clock by a half cycle or by not shifting the clock (see transmission formats ). the spi can be configured to operate as a master or as a slave. when mstr in spi control register1 is set, the master mode is selected; when the mstr bit is clear, the slave mode is selected. master mode the spi operates in master mode when the mstr bit is set. only a master spi module can initiate transmissions. a transmission begins by writing to the master spi data register. if the shift register is empty, the byte immediately transfers to the shift register. the byte begins shifting out on the mosi pin under the control of the serial clock. the spr2, spr1, and spr0 baud rate selection bits in conjunction with the sppr2, sppr1, and sppr0 baud rate preselection bits in the spi baud rate register control the baud rate generator and determine the speed of the shift register. the sck pin is the spi clock output. through the sck pin, the baud rate generator of the master controls the shift register of the slave peripheral. in master mode, the function of the serial data output pin (mosi) and the serial data input pin (miso) is determined by the spc0 and mstr control bits. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 472 serial peripheral interface (spi) motorola the ss pin is normally an input which should remain in the inactive high state. however, in the master mode, if both modfen bit and ssoe bit are set, then the ss pin is the slave select output. the ss output becomes low during each transmission and is high when the spi is in the idling state. if the ss input becomes low while the spi is configured as a master, it indicates a mode fault error where more than one master may be trying to drive the mosi and sck lines simultaneously. in this case, the spi immediately clears the output buffer enables associated with the miso, mosi (or momi), and sck pins so that these pins become inputs. this mode fault error also clears the mstr control bit and sets the mode fault (modf) flag in the spi status register. if the spi interrupt enable bit (spie) is set when the modf bit gets set, then an spi interrupt sequence is also requested note: there is an errata information about the mode fault behavior. see mc9s12t64 errata sheet for details. when a write to the spi data register in the master occurs, there is a half sck-cycle delay. after the delay, sck is started within the master. the rest of the transfer operation differs slightly, depending on the clock format specified by the spi clock phase bit, cpha, in spi control register 1 (see transmission formats ). slave mode the spi operates in slave mode when the mstr bit in spi control register1 is clear. in slave mode, sck is the spi clock input from the master, and ss is the slave select input. before a data transmission occurs, the ss pin of the slave spi must be at logic 0. ss must remain low until the transmission is complete. in slave mode, the function of the serial data output pin (miso) and serial data input pin (mosi) is determined by the spc0 bit in spi control register 2 and the mstr control bit. while in slave mode, the ss input controls the serial data output pin; if ss is high (not selected), the serial data output pin is high impedance, and, if ss is low the first bit in the spi data register is driven out of the serial data output pin. also, if the slave is not selected ( ss is high), then the sck input is ignored and no internal shifting of the spi shift register takes place. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 473 although the spi is capable of duplex operation, some spi peripherals are capable of only receiving spi data in a slave mode. for these simpler devices, there is no serial data out pin. note: when peripherals with duplex capability are used, take care not to simultaneously enable two receivers whose serial outputs drive the same system slave? serial data output line. as long as no more than one slave device drives the system slave? serial data output line, it is possible for several slaves to receive the same transmission from a master, although the master would not receive return information from all of the receiving slaves. if the cpha bit in spi control register 1 is clear, odd numbered edges on the sck input cause the data at the serial data input pin to be latched. even numbered edges cause the value previously latched from the serial data input pin to shift into the lsb of the spi shifter. if the cpha bit is set, even numbered edges on the sck input cause the data at the serial data input pin to be latched. odd numbered edges cause the value previously latched from the serial data input pin to shift into the lsb of the spi shifter. note: in slave mode, the control bits cpha and cpol of the spi should be configured only when spi is disabled else it may lead to incorrect data transfer. if the spi is disabled, e.g. for configuration purpose, the dedicated spi pins become gpio pins. care must be taken to avoid driver collisions. as recommended action, gpio pins should be configured as high impedance inputs, before disabling the spi. when cpha is set, the first edge is used to get the first data bit onto the serial data output pin. when cpha is clear and the ss input is low (slave selected), the first bit of the spi data is driven out of the serial data output pin. after the eighth shift, the transfer is considered complete and the received data is transferred into the spi data register. to indicate transfer is complete, the spif flag in the spi status register is set. note: there is an errata information about cpha=1 transfer format in slave mode. see mc9s12t64 errata sheet for details. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 474 serial peripheral interface (spi) motorola transmission formats during an spi transmission, data is transmitted (shifted out serially) and received (shifted in serially) simultaneously. the serial clock (sck) synchronizes shifting and sampling of the information on the two serial data lines. a slave select line allows selection of an individual slave spi device; slave devices that are not selected do not interfere with spi bus activities. optionally, on a master spi device, the slave select line can be used to indicate multiple-master bus contention. figure 93 master/slave transfer block diagram shift register shift register baud rate generator master spi slave spi v dd mosi mosi miso miso sck sck ss ss f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 475 clock phase and polarity controls using two bits in the spi control register1, software selects one of four combinations of serial clock phase and polarity. the cpol clock polarity control bit specifies an active high or low clock and has no significant effect on the transmission format. the cpha clock phase control bit selects one of two fundamentally different transmission formats. clock phase and polarity should be identical for the master spi device and the communicating slave device. in some cases, the phase and polarity are changed between transmissions to allow a master device to communicate with peripheral slaves having different requirements. note: it is recommended that software writes to the spi control register to change cpha, cpol or mstr bits only in the idle state of the spi. if these bits are changed during the transmission, data transmission gets corrupted. cpha = 0 transfer format the first edge on the sck line is used to clock the first data bit of slave into the master and the first data bit of master into the slave. in some peripherals, the first bit of the slave's data is available at the slave data out pin as soon as the slave is selected. in this format, the first sck edge is not issued until a half cycle into the 8-cycle transfer operation. the first edge of sck is delayed a half cycle by clearing the cpha bit. the sck output from the master remains in the inactive state for a half sck period before the first edge appears. a half sck cycle later, the second edge appears on the sck line. when this second edge occurs, the value previously latched from the serial data input pin is shifted into the lsb of the shifter. after this second edge, the next bit of the spi master data is transmitted out of the serial data output pin of the master to the serial input pin on the slave. this process continues for a total of 16 edges on the sck line, with data being latched on odd numbered edges and shifted on even numbered edges. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 476 serial peripheral interface (spi) motorola data reception is double buffered. data is shifted serially into the spi shift register during the transfer and is transferred to the parallel spi data register after the last bit is shifted in. after the 16th (last) sck edge: data that was previously in the master spi data register should now be in the slave data register and the data that was in the slave data register should be in the master. the spif flag in the spi status register is set indicating that the transfer is complete. figure 94 is a timing diagram of an spi transfer where cpha = 0. sck waveforms are shown for cpol = 0 and cpol = 1. the diagram may be interpreted as a master or slave timing diagram since the sck, miso, and mosi pins are connected directly between the master and the slave. the miso signal is the output from the slave and the mosi signal is the output from the master. the ss pin of the master must be either high or reconfigured as a general-purpose output not affecting the spi. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 477 figure 94 spi clock format 0 (cpha = 0) the ss line should be deasserted at least for minimum idle time (half sck cycle) between the successive transfers ( ss should not be tied low all the times in this mode). if ss is not deasserted between the successive transmission then the new byte written to the data register would not be transmitted, instead the last received byte would be transmitted. cpha = 1 transfer format some peripherals require the first sck edge before the first data bit becomes available at the data out pin; the second edge clocks data into the system. in this format, the first sck edge is issued by setting the cpha bit at the beginning of the 8-cycle transfer operation. t l begin end sck (cpol = 0) sample i change o sel ss (o) transfer sck (cpol = 1) msb ?st (lsbfe = 0): lsb ?st (lsbfe = 1): msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) mosi pin miso pin master only mosi/miso t t if next transfer begins here for t t , t l , t l minimum 1/2 sck t i t l t l = minimum leading time before the ?st sck edge t t = minimum trailing time after the last sck edge t i = minimum idling time between transfers (minimum ss high time) t l , t t , and t i are guaranteed for the master mode and required for the slave mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 478 serial peripheral interface (spi) motorola the first edge of sck occurs immediately after the half sck clock cycle synchronization delay. this first edge commands the slave to transfer its most significant data bit to the serial data input pin of the master. a half sck cycle later, the second edge appears on the sck pin. this is the latching edge for both the master and slave. when the third edge occurs, the value previously latched from the serial data input pin is shifted into the lsb of the spi shifter. after this edge, the next bit of the master data is coupled out of the serial data output pin of the master to the serial input pins on the slave. this process continues for a total of 16 edges on the sck line with data being latched on even numbered edges and shifting taking place on odd numbered edges. data reception is double buffered; data is serially shifted into the spi shift register during the transfer and is transferred to the parallel spi data register after the last bit is shifted in. after the 16th sck edge: data that was previously in the spi data register of the master is now in the data register of the slave, and data that was in the data register of the slave is in the master. the spif flag bit in spisr is set indicating that the transfer is complete. figure 95 shows two clocking variations for cpha = 1. the diagram may be interpreted as a master or slave timing diagram since the sck, miso, and mosi pins are connected directly between the master and the slave. the miso signal is the output from the slave, and the mosi signal is the output from the master. the ss line is the slave select input to the slave. the ss pin of the master must be either high or reconfigured as a general-purpose output not affecting the spi. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 479 figure 95 spi clock format 1 (cpha = 1) the ss line can remain active low between successive transfers (can be tied low at all times). this format is sometimes preferred in systems having a single fixed master and a single slave that drive the miso data line. the spi interrupt request flag (spif) is common to both the master and slave modes. spif gets set after the last sck edge in a data transfer operation to indicate that the transfer is complete though transfer is actually complete half sck cycle later. spi baud rate generation baud rate generation consists of a series of divider stages. six bits in the spi baud rate register (sppr2, sppr1, sppr0, spr2, spr1, and spr0) determine the divisor to the bus clock which results in the spi baud rate. t l t t for t t , t l , t l minimum 1/2 sck t i t l if next transfer begins here begin end sck (cpol = 0) sample i change o sel ss (o) transfer sck (cpol = 1) msb ?st (lsbfe = 0): lsb ?st (lsbfe = 1): msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) mosi pin miso pin master only mosi/miso t l = minimum leading time before the ?st sck edge t t = minimum trailing time after the last sck edge t i = minimum idling time between transfers (minimum ss high time) t l , t t , and t i are guaranteed for the master mode and required for the slave mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 480 serial peripheral interface (spi) motorola the spi clock rate is determined by the product of the value in the baud rate preselection bits (sppr2?ppr0) and the value in the baud rate selection bits (spr2?pr0). the bus clock divisor equation is shown in figure 96 . when all bits are clear (the default condition), the bus clock is divided by 2. when the selection bits (spr2?pr0) are 001 and the preselection bits (sppr2?ppr0) are 000, the bus clock divisor becomes 4. when the selection bits are 010, the bus clock divisor becomes 8, etc. when the preselection bits are 001, the divisor determined by the selection bits is multiplied by 2. when the preselection bits are 010, the divisor is multiplied by 3, etc. see table 83 for baud rate calculations for all bit conditions, based on a 16 mhz bus clock.the two sets of selects allows the clock to be divided by a non-power of two to achieve other baud rates such as divide by 6, divide by 10, etc. the baud rate generator is activated only when the spi is in the master mode and a serial transfer is taking place. in the other cases, the divider is disabled to decrease i dd current. figure 96 bus clock divisor equation special features ss output the ss output feature automatically drives the ss pin low during transmission to select external devices and drives it high during idle to deselect external devices. when ss output is selected, the ss output pin is connected to the ss input pin of the external device. the ss output is available only in master mode during normal spi operation by asserting ssoe and modfen bit as shown in table 81 . the mode fault feature is disabled while ss output is enabled.  <:
36*2 0=0:69  ? + () ?  ? + () = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) functional description mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 481 note: care must be taken when using the ss output feature in a multimaster system since the mode fault feature is not available for detecting system errors between masters. bidirectional mode (momi or siso) the bidirectional mode is selected when the spc0 bit is set in spi control register 2 (see normal mode and bidirectional mode ). in this mode, the spi uses only one serial data pin for the interface with external device(s). the mstr bit decides which pin to use. the mosi pin becomes the serial data i/o (momi) pin for the master mode, and the miso pin becomes serial data i/o (siso) pin for the slave mode. the miso pin in the master mode and mosi pin in the slave mode are not used by the spi in bidirectional mode. the direction of each serial i/o pin depends on the bidiroe bit. if the pin is configured as an output, serial data from the shift register is driven out on the pin. the same pin is also the serial input to the shift register. the sck is output for the master mode and input for the slave mode. the ss is the input or output for the master mode, and it is always the input for the slave mode. table 84 normal mode and bidirectional mode when spe = 1 master mode mstr = 1 slave mode mstr = 0 normal mode spc0 = 0 bidirectional mode spc0 = 1 spi mosi miso serial out serial in spi mosi miso serial in serial out spi momi serial out serial in bidiroe spi siso serial in serial out . bidiroe f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 482 serial peripheral interface (spi) motorola the bidirectional mode does not affect sck and ss functions. error conditions the spi has one error condition mode fault error mode fault error if the ss input becomes low while the spi is configured as a master, it indicates a system error where more than one master may be trying to drive the mosi and sck lines simultaneously. this condition is not permitted in normal operation; the modf bit in the spi status register is set automatically provided the modfen bit is set. in the special case where the modfen bit is cleared, the ss pin is a general purpose input/output pin for the spi system configured in master mode. in this special case, the mode error function is inhibited and modf remains cleared. in case the spi system is configured as a slave, the ss pin is a dedicated input pin. mode fault error doesn? occur in slave mode. when a mode fault error occurs, the mstr bit in control register spicr1 is cleared, modf bit in the status register is set and the output enable for the sck, miso and mosi pins are de-asserted. so sck, miso and mosi pins are forced to be high impedance inputs to avoid any possibility of conflict with another output driver. note: there is an errata information about the mode fault behavior. see mc9s12t64 errata sheet for details. if the mode fault error occurs in the bidirectional mode for a spi system configured in master mode, output enable of the momi (mosi in bidirectional mode) is cleared if it was set but miso (siso) is not affected. no mode fault error occurs in the bidirectional mode for spi system configured in slave mode. the mode fault flag is cleared automatically by a read of the spi status register (with modf set) followed by a write to spi control register 1. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) low power mode options mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 483 low power mode options spi in run mode in run mode with the spi system enable (spe) bit in the spi control register clear, the spi system is in a low-power, disabled state. spi registers can still be accessed, but clocks to the core of this module are disabled. spi in wait mode spi operation in wait mode depends upon the state of the spiswai bit in spi control register 2. if spiswai is clear, the spi operates normally when the cpu is in wait mode if spiswai is set, spi clock generation ceases and the spi module enters a power conservation state when the cpu is in wait mode. if spiswai is set and the spi is configured for master, any transmission and reception in progress stops at wait mode entry. the transmission and reception resumes when the spi exits wait mode. if spiswai is set and the spi is configured as a slave, any transmission and reception in progress continues if the sck continues to be driven from the master. this keeps the slave synchronized to the master and the sck. if the master transmits several bytes while the slave is in wait mode, the slave will continue to send out bytes consistent with the its operation mode at the start of wait mode (i.e. if the slave is currently sending its spidr to the master, it will continue to send the same byte. else if the slave is currently sending the last received byte from the master, it will continue to send each previous master byte). note: care must be taken when expecting data from a master while the slave is in wait or stop mode. even though the shift register will continue to operate, the rest of the spi is shut down (i.e. a spif interrupt will not be generated until exiting stop or wait mode). also, the byte from the shift f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 484 serial peripheral interface (spi) motorola register will not be copied into the spidr register until after the slave spi has exited wait or stop mode. a spif flag and spidr copy is only generated if wait mode is entered or exited during a transmission. if the slave enters wait mode in idle mode and exits wait mode in idle mode, neither a spif nor a spidr copy will occur. spi in stop mode stop mode is dependent on the system. the spi enters stop mode when the bus clock is disabled (held high or low). if the spi is in master mode and exchanging data when the cpu enters stop mode, the transmission is frozen until the cpu exits stop mode. after stop, data to and from the external spi is exchanged correctly. in slave mode, the spi will stay synchronized with the master. the stop mode is equivalent to the wait mode with the spiswai bit set except that the stop mode is dependent on the system and cannot be controlled with the spiswai bit. reset initialization the reset values of registers and signals are described in registers . all registers reset to a particular value. if a data transmission occurs in slave mode after reset without a write to spidr, it will transmit random data or the byte last received from the master before the reset. reading from the spidr after reset will always read a byte of zeros. interrupts this section describes interrupts originated by the serial peripheral interface. the mcu must service the interrupt requests. table 85 lists the three sources of interrupts generated by the spi module. the spi module communicates with the mcu through one interrupt port. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) interrupts mc9s12t64revision 1.1.1 motorola serial peripheral interface (spi) 485 description of interrupt operation the serial peripheral interface only originates interrupt requests. the following is a description of how the serial peripheral interface makes a request and how the mcu should acknowledge that request. modf description modf occurs when the master detects an error on the ss pin. the master spi must be configured for the modf feature (see table 81 ). once modf is set, the current transfer is halted and the following bit is changed: mstr=0, the master bit in spicr1 resets. the modf interrupt is reflected in the status register modf flag. clearing the flag will also clear the interrupt. this interrupt will stay active while the modf flag is set. modf has an automatic clearing process which is described in spi status register (spisr) . spif description spif occurs when the spi receives/transmits the last sck edge in a data transfer operation. once spif is set, it does not clear until it is serviced. spif has an automatic clearing process which is described in spi status register (spisr) . in the event that the spif is not serviced before the end of the next transfer (i.e. spif remains active throughout another transfer), the latter transfers will be ignored and no new data will be copied into the spidr. sptef description sptef occurs when the spi data register transfers a byte into the transmit buffer once sptef is set, it does not clear until it is serviced. table 85 spi interrupt signals interrupt sources vector address description mode fault $ffd8, $ffd9 active high detect. modf occurs when a logic zero occurs on the ss pin of a master spi transfer complete active high detect. spif occurs after the last sck cycle in a data transfer operation to indicate that the transfer is complete. spi transmitter empty active high detect. sptef occurs when the spi data register transfers a byte into the transmit shift register. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
serial peripheral interface (spi) mc9s12t64revision 1.1.1 486 serial peripheral interface (spi) motorola sptef has an automatic clearing process which is described in spi status register (spisr) . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 487 analog to digital converter (atd) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 low power modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 overview the atd module is an 8-channel, 10-bit, multiplexed input successive approximation analog-to-digital converter. refer to device electrical specifications for atd accuracy. the block is designed to be upwards compatible with the 68hc11 standard 8-bit a/d converter. in addition, there are new operating modes that are unique to the hc12 design. features 8/10 bit resolution. ? sec, 10-bit single conversion time. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 488 analog to digital converter (atd) motorola sample buffer amplifier. programmable sample time. left/right justified, signed/unsigned result data. external trigger control. conversion completion interrupt generation. analog input multiplexer for 8 analog input channels. analog/digital input pin multiplexing. 1 to 8 conversion sequence lengths. continuous conversion mode. multiple channel scans. modes of operation conversion modes there is software programmable selection between performing single or continuous conversion on a single channel or multiple channels . the conversion modes for the atd module are defined by the settings of three control bits and three control values. the control bits are etrige in atdctl2, and mult, scan in atdctl5. in brief, etrige controls whether an external trigger is used to start a conversion sequence. mult controls whether the sequence examines a single analog input channel or scans a number of different channels. scan determines if sequences are performed continuously. the control values are bits cc/cb/ca in atdctl5 which define the input channels to be examined; s8c/s4c/s2c/s1c in atdctl3 define the number of conversions in a sequence; smp0/smp1 in atdctl4 define the length of the sample time. mcu operating modes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) modes of operation mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 489 run mode run mode for the atd module is defined as the state where the atd module is powered up and currently performing an a/d conversion. complete assess to all control, status, and result registers is available. the module is consuming maximum power. wait mode entering wait mode the atd conversion either continues or aborts for low power depending on the logical value of the await bit in atdctl2 register. stop mode entering stop mode causes all clocks to halt and thus the system is placed in a minimum power standby mode. this aborts any conversion sequence in progress. during recovery from stop mode, there must be a minimum delay for the stop recovery time t sr before initiating a new atd conversion sequence. freeze mode the atd module enters freeze mode when background debug mode (bdm) is active. in freeze mode the atd module will behave according to the logical values of the frz1 and frz0 bits. this is useful for debugging and emulation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 490 analog to digital converter (atd) motorola block diagram figure 97 atd module block diagram vrl an0 (pad0) atd module port ad data register analog mux mode and timing control successive approximation register (sar) results atd 0 atd 1 atd 2 atd 3 atd 4 atd 5 atd 6 atd 7 and dac an7 / etrig an6 (pad6) an5 (pad5) an4 (pad4) an3 (pad3) an2 (pad2) an1 (pad1) sample & hold 1 1 vssa vdda conversion complete interrupt + - comparator clock prescaler bus clock atd clock atd input enable register vrh (pad7) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) external pin descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 491 external pin descriptions the atd module has a total of 12 external pins. an7 / etrig (pad7) this pin serves as the analog input channel 7. it can be configured as an external trigger for the atd conversion, or as general purpose digital input. an6 (pad6) this pin serves as the analog input channel 6. it can be configured as general purpose digital input. an5 (pad5) this pin serves as the analog input channel 5. it can be configured as general purpose digital input. an4 (pad4) this pin serves as the analog input channel 4. it can be configured as general purpose digital input. an3 (pad3) this pin serves as the analog input channel 3. it can be configured as general purpose digital input. an2 (pad2) this pin serves as the analog input channel 2. it can be configured as general purpose digital input. an1 (pad1) this pin serves as the analog input channel 1.it can be configured as general purpose digital input. an0 (pad0) this pin serves as the analog input channel 0. it can also be configured as general purpose digital input. vrh, vrl vrh is the high reference voltage and vrl is the low reference voltage for atd conversion. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 492 analog to digital converter (atd) motorola vdda, vssa these pins are the power supplies for the analog circuitry of the atd module block. register map register name bit 7 654321 bit 0 address offset reserved for factory test read: reads to this register return unpredictable values. $0080 write: reserved for factory test read: reads to this register return unpredictable values. $0081 write: atdctl2 read: adpu affc awai etrigle etrigp etrige ascie ascif $0082 write: atdctl3 read: 0 s8c s4c s2c s1c fifo frz1 frz0 $0083 write: atdctl4 read: sres8 smp1 smp0 prs4 prs3 prs2 prs1 prs0 $0084 write: atdctl5 read: djm dsgn scan mult 0 cc cb ca $0085 write: atdstat0 read: scf 0 etorf fifor 0 cc2 cc1 cc0 $0086 write: unimplemented read: reads to this register return unpredictable values. $0087 write: reserved for factory test read: reads to this register return unpredictable values. $0088 write: atdtest1 read: reads to these bits return unpredictable values. sc $0089 write: unimplemented read: reads to this register return unpredictable values. $008a write: atdstat1 read: ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 $008b write: unimplemented read: reads to this register return unpredictable values. $008c write: atddien read: ien7 ien6 ien5 ien4 ien3 ien2 ien1 ien0 $008d write: unimplemented read: reads to this register return unpredictable values. $008e write = unimplemented or reserved figure 98 atd register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register map mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 493 note: register address: base address (initrg) + address offset note: writing to reserved registers during special modes can alter functionality. portad read: ptad7 ptad6 ptad5 ptad4 ptad3 ptad2 ptad1 ptad0 $008f write: atddr0h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $0090 write: atddr0l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $0091 write: atddr1h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $0092 write: atddr1l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $0093 write: atddr2h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $0094 write: atddr2l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $0095 write: atddr3h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $0096 write: atddr3l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $0097 write: atddr4h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $0098 write: atddr4l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $0099 write: atddr5h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $009a write: atddr5l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $009b write: atddr6h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $009c write: atddr6l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $009d write: atddr7h read: bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 $009e write: atddr7l read: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 $009f write: register name bit 7 654321 bit 0 address offset = unimplemented or reserved figure 98 atd register map (continued) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 494 analog to digital converter (atd) motorola register descriptions the following subsections describe the bit-level arrangement and functionality of each register. atd control register 2 (atdctl2) this register controls power down, interrupt and external trigger. writes to this register will abort current conversion sequence but will not start a new sequence. read: anytime write: anytime (except for bit 8 ?ascif, read: any time, write: not allowed) adpu ?atd power down this bit provides on/off control over the atd module block allowing reduced mcu power consumption. because analog electronic is turned off when powered down, the atd requires a recovery time period after adpu bit is enabled. 1 = normal atd functionality 0 = power down atd affc ?atd fast flag clear all 1 = changes all atd conversion complete flags to a fast clear sequence. any access to a result register will cause the associate ccf flag to clear automatically. 0 = atd flag clearing operates normally (read the status register atdstat1 before reading the result register to clear the associate ccf flag). awai ?atd power down in wait mode address offset: $0082 bit 15 14 13 12 11 10 9 bit 8 read: adpu affc awai etrigle etrigp etrige ascie ascif write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 495 when entering wait mode this bit provides on/off control over the atd module block allowing reduced mcu power. because analog electronic is turned off when powered down, the atd requires a recovery time period after exit from wait mode. 1 = power down atd during wait mode 0 = atd continues to run in wait mode note: although a conversion that was interrupted prior to entering wait mode is restarted after wait mode wake-up, the results are not reliable and should not be used by the user application. etrigle ?external trigger level/edge control this bit controls the sensitivity of the external trigger signal. see table 86 for details. etrigp ?external trigger polarity this bit controls the polarity of the external trigger signal. see table 86 for details. etrige ?external trigger mode enable this bit enables the external trigger on atd channel 7. the external trigger allows to synchronize sample and atd conversions processes with external events. 1 = enable external trigger 0 = disable external trigger note: the conversion results for the external trigger atd channel 7 have no meaning while external trigger mode is enabled. ascie ?atd sequence complete interrupt enable table 86 external trigger con?urations etrigle etrigp external trigger sensitivity 0 0 falling edge 0 1 rising edge 1 0 low level 1 1 high level f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 496 analog to digital converter (atd) motorola 1 = atd interrupt will be requested whenever ascif=1 is set. 0 = atd sequence complete interrupt requests are disabled. note: there is an errata information about the ascif flag. see mc9s12 errata sheet for details. ascif ?atd sequence complete interrupt flag if ascie=1 the ascif flag equals the scf flag (see register atdstat0 - page 505 ), else ascif reads zero. writes have no effect. 1 = atd sequence complete interrupt pending 0 = no atd interrupt occurred atd control register 3 (atdctl3) this register controls the conversion sequence length, fifo for results registers and behavior in freeze mode. writes to this register will abort current conversion sequence but will not start a new sequence. s8c/s4c/s2c/s1c ?conversion sequence length these bits control the number of conversions per sequence. table 87 shows all combinations. at reset, s4c is set to 1 (sequence length is 4). this is to maintain software continuity to hc12 family. address offset: $0083 bit 7 654321 bit 0 read: 0 s8c s4c s2c s1c fifo frz1 frz0 write: reset: 00100000 unimplemented or reserved table 87 conversion sequence length coding. s8c s4c s2c s1c number of conversions per sequence 0000 8 0001 1 0010 2 0011 3 0100 4 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 497 fifo ?result register fifo mode if this bit is zero (non-fifo mode), the a/d conversion results map into the result registers based on the conversion sequence; the result of the first conversion appears in the first result register, the second result in the second result register, and so on. if this bit is one (fifo mode) the conversion counter is not reset at the beginning or end of a conversion sequence; conversion results are placed in consecutive result registers between sequences. the result register counter wraps around when it reaches the end of the result register file. the conversion counter value in atdstat0 can be used to determine where in the result register file, the current conversion result will be placed. finally, which result registers hold valid data can be tracked using the conversion complete flags. fast flag clear mode may or may not be useful in a particular application to track valid data. 1 = conversion results are placed in consecutive result registers (wrap around at end). 0 = conversion results are placed in the corresponding result register up to the selected sequence length. frz1, frz0 ?background debug freeze enable when debugging an application, it is useful in many cases to have the atd pause when a breakpoint (freeze mode) is encountered. these 2 bits determine how the atd will respond to a breakpoint as shown in table 88 . leakage onto the storage node and comparator 0101 5 0110 6 0111 7 1xxx 8 table 87 conversion sequence length coding. (continued) s8c s4c s2c s1c number of conversions per sequence f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 498 analog to digital converter (atd) motorola reference capacitors may compromise the accuracy of an immediately frozen conversion depending on the length of the freeze period. note: the atd module enters freeze mode when background debug mode (bdm) is active. refer to the fast background debug module (fbdm) section about the background debug mode. table 88 atd behavior in freeze mode (breakpoint) frz1 frz0 atd response 0 0 1 1 0 1 0 1 continue conversion reserved finish current conversion, then freeze freeze immediately f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 499 atd control register 4 (atdctl4) this register selects the conversion clock frequency, the length of the second phase of the sample time and the resolution of the a/d conversion (i.e.: 8-bits or 10-bits). writes to this register will abort current conversion sequence but will not start a new sequence. sres8 ?a/d resolution select 1 = 8-bit resolution selected. 0 = 10-bit resolution selected. this bit selects the resolution of a/d conversion results as either 8 or 10 bits. the a/d converter has an accuracy of 10 bits. however, if low resolution is required, the conversion can be speeded up by selecting 8-bit resolution. smp0, smp1 ?sample time select these two bits select the length of the second phase of the sample time in units of atd conversion clock cycles. note that the atd conversion clock period is itself a function of the prescaler value (bits prs4-0). the sample time consists of two phases. the first phase is two atd conversion clock cycles long and transfers the sample quickly (via the buffer amplifier) onto the a/d machine? storage node. the second phase attaches the external analog signal directly to the storage node for final charging and high accuracy. table 89 lists the lengths available for the second sample phase. address offset: $0084 bit 7 654321 bit 0 read: sres8 smp1 smp0 prs4 prs3 prs2 prs1 prs0 write: reset: 00000101 unimplemented or reserved table 89 sample time select smp1 smp0 length of second phase of sample time 0 0 1 1 0 1 0 1 2 a/d clock periods 4 a/d clock periods 8 a/d clock periods 16 a/d clock periods f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 500 analog to digital converter (atd) motorola prs0, prs1, prs2, prs3, prs4 ?atd clock prescaler these 5 bits are the binary value prescaler value prs. the atd conversion clock frequency is calculated as follows: note that the maximum atd conversion clock frequency is half the bus clock. the default (after reset) prescaler value is 5 which results in a default atd conversion clock frequency that is bus clock divided by 12. table 90 illustrates the divide-by operation and the appropriate range of bus clock.  *65=,9:065*36*2  <:
36*2 []  ? + [] ------------------------------ - ? = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 501 table 90 clock prescaler values prescale value total divisor value max bus clock (1) min bus clock (2) 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111 divide by 2 divide by 4 divide by 6 divide by 8 divide by 10 divide by 12 divide by 14 divide by 16 divide by 18 divide by 20 divide by 22 divide by 24 divide by 26 divide by 28 divide by 30 divide by 32 divide by 34 divide by 36 divide by 38 divide by 40 divide by 42 divide by 44 divide by 46 divide by 48 divide by 50 divide by 52 divide by 54 divide by 56 divide by 58 divide by 60 divide by 62 divide by 64 4 mhz 8 mhz 12 mhz 16 mhz 20 mhz 24 mhz 28 mhz 32 mhz 36 mhz 40 mhz 44 mhz 48 mhz 52 mhz 56 mhz 60 mhz 64 mhz 68 mhz 72 mhz 76 mhz 80 mhz 84 mhz 88 mhz 92 mhz 96 mhz 100 mhz 104 mhz 108 mhz 112 mhz 116 mhz 120 mhz 124 mhz 128 mhz 1 mhz 2 mhz 3 mhz 4 mhz 5 mhz 6 mhz 7 mhz 8 mhz 9 mhz 10 mhz 11 mhz 12 mhz 13 mhz 14 mhz 15 mhz 16 mhz 17 mhz 18 mhz 19 mhz 20 mhz 21 mhz 22 mhz 23 mhz 24 mhz 25 mhz 26 mhz 27 mhz 28 mhz 29 mhz 30 mhz 31 mhz 32 mhz 1. maximum atd conversion clock frequency is 2mhz. the max. bus clock frequency is computed from the max. atd clock frequency times the indicated prescaler setting. 2. minimum atd clock frequency is 500khz. the min. bus clock frequency is computed from the min. atd clock frequency times the indicated prescaler settling. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 502 analog to digital converter (atd) motorola atd control register 5 (atdctl5) this register selects the type of conversion sequence and the analog input channels sampled. writes to this register will abort current conversion sequence and start a new conversion sequence. read: anytime write: anytime djm ?result register data justification mode 1 = right justified mode. 0 = left justified mode. this bit controls justification of conversion data in the result registers. see atddrx a/d conversion result registers (atddr0?) in page 510 for details. dsgn ?signed/unsigned result data mode 1 = signed result register data select. 0 = unsigned result register data select. this bit selects between signed and unsigned conversion data representation in the result registers. signed data is represented as 2? complement. see atddrx a/d conversion result registers (atddr0?) in page 510 for details. table 91 summarizes the result data formats available and how they are set up using the control bits. table 92 illustrates the difference between the signed and unsigned, left justified output codes for an input signal range between 0 and 5.12 volts. address offset: $0085 bit 7 654321 bit 0 read: djm dsgn scan mult 0 cc cb ca write: reset: 00000000 unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 503 scan ?continuous conversion sequence mode 1 = perform conversion sequences continuously. 0 = perform a conversion sequence and return to idle mode. the scan mode bit controls whether or not conversion sequences are performed continuously or only once. mult ?multi-channel sample mode 1 = sample across many channels. 0 = sample only the specified channel. when mult is 0, the atd sequence controller samples only from the specified analog input channel for an entire conversion sequence. the analog channel is selected by channel selection code (control bits cc/cb/ca located in atdctl5). when mult is 1, the atd sequence controller samples across channels. the number of table 91 result data formats available. sres8 djm dsgn result data formats description and bus bit mapping 1 1 1 0 0 0 0 0 1 0 0 1 0 1 x 0 1 x 8-bit/left justi?d/unsigned - bits 8-15 8-bit/ left justi?d/signed - bits 8-15 8-bit/right justi?d/unsigned - bits 0-7 10-bit/left justi?d/unsigned - bits 6-15 10-bit/left justi?d/signed - bits 6-15 10-bit/right justi?d/unsigned - bits 0-9 table 92 left justi?d, signed and unsigned atd output codes. input signal vrl = 0 volts vrh = 5.12 volts signed 8-bit codes unsigned 8-bit codes signed 10-bit codes unsigned 10-bit codes 5.120 volts 5.100 5.080 2.580 2.560 2.540 0.020 0.000 7f 7f 7e 01 00 ff 81 80 ff ff fe 81 80 7f 01 00 7fc0 7f00 7e00 0100 0000 ff00 8100 8000 ffc0 ff00 fe00 8100 8000 7f00 0100 0000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 504 analog to digital converter (atd) motorola channels sampled is determined by the sequence length value (s8c, s4c, s2c, s1c). the first analog channel examined is determined by channel selection code (cc, cb, ca control bits); subsequent channels sampled in the sequence are determined by incrementing the channel selection code. cc, cb, ca ?analog input channel select code these bits select the analog input channel(s) whose signals are sampled and converted to digital codes. table 93 lists the coding used to select the various analog input channels. in the case of single channel scans (mult=0), this selection code specifies the channel to be examined . in the case of multi-channel scans (mult=1), this selection code represents the first channel to be examined in the conversion sequence. subsequent channels are determined by incrementing channel selection code; selection codes that reach the maximum value wrap around to the minimum value. table 93 analog input channel select coding cc cb ca analog input channel 000 an0 001 an1 010 an2 011 an3 100 an4 101 an5 110 an6 111 an7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 505 a/d status register (atdstat0) this read-only register contains the sequence complete flag, overrun flags for external trigger and fifo mode, and the conversion counter. read: anytime write: refer to each bit for individual write conditions note: there is an errata information about the flags scf, etorf and fifor. see mc9s12t64 errata sheet for details. note: there is an errata information about the scf flag. see mc9s12t64 errata sheet for details. scf ?sequence complete flag this flag is set upon completion of a conversion sequence. if conversion sequences are continuously performed (scan=1), the flag is set after each one is completed. this flag is cleared when one of the following occurs: a) write ??to scf b) write to atdctl5 (a new conversion sequence is started) c) if affc=1 and read of a result register 1 = conversion sequence has completed 0 = conversion sequence not completed etorf ?external trigger overrun flag while in edge trigger mode (etrigle=0), if additional active edges are detected while a conversion sequence is in process the overrun flag is set. this flag is cleared when one of the following occurs: a) write ??to etorf b) write to atdctl2, atdctl3 or atdctl4 (a conversion sequence is aborted) c) write to atdctl5 (a new conversion sequence is started) address offset: $0086 bit 7 654321 bit 0 read: scf 0 etorf fifor 0 cc2 cc1 cc0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 506 analog to digital converter (atd) motorola 1 = external trigger overrun error has occurred 0 = no external trigger overrun error has occurred fifor ?fifo over run flag. this bit indicates that a result register has been written to before its associated conversion complete flag (ccf) has been cleared. this flag is most useful when using the fifo mode because the flag potentially indicates that result registers are out of sync with the input channels. however, it is also practical for non-fifo modes, and indicates that a result register has been over written before it has been read (i.e. the old data has been lost). this flag is cleared when one of the following occurs: a) write ??to fifor b) write to atdctl5 (a new conversion sequence is started) 1 = an over run condition exists 0 = no over run has occurred cc2/cc1/cc0 ?conversion counter these 3 read-only bits are the binary value of the conversion counter. the conversion counter points to the result register that will receive the result of the current conversion. e.g. cc2=1, cc1=1, cc0=0 indicates that the result of the current conversion will be in atd result register 6. if in non-fifo mode (fifo=0) the conversion counter is initialized to zero at the begin and end of the conversion sequence. if in fifo mode (fifo=1) the register counter is not initialized. the conversion counters wraps around when its maximum value is reached. atd test register 1 (atdtest1) this register contains the sc bit used to enable special channel conversions. address offset: $0089 bit 7 654321 bit 0 read: reads to these bits return unpredictable values. sc write: reset: 00000000 unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 507 read: anytime write: anytime sc - special channel conversion bit if this bit is set, then special channel conversion can be selected using cc, cb, and ca of atdctl5 register. table 94 lists the coding. 1 = special channel conversions enabled 0 = special channel conversions disabled caution: always write remaining bits of atdtest1 (bits 7 to 1) zero when writing the sc bit. not doing so might result in unpredictable atd behavior. a/d status register (atdstat1) this read-only register contains the conversion complete flags. read: anytime write: only in special modes note: there is an errata information about the ccf flags. see mc9s12t64 errata sheet for details. table 94 special channel select coding sc cc cb ca analog input channel 1 0 x x reserved 1100 v rh 1101 v rl 1110 (v rl +v rh )/2 1111 reserved address offset: $008b bit 7 654321 bit 0 read: ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 write: reset: 00000000 unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 508 analog to digital converter (atd) motorola ccfx ?conversion complete flag x (x=7,6,5,4,3,2,1,0) a conversion complete flag is set at the end of each conversion in a conversion sequence. the flags are associated with the conversion position in a sequence (and also the result register number). therefore, ccf0 is set when the first conversion in a sequence is complete and the result is available in result register atddr0; ccf1 is set when the second conversion in a sequence is complete and the result is available in atddr1, and so forth. a flag ccfx (x=7,6,5,4,3,2,1,0) is cleared when one of the following occurs: a) write to atdctl5 (a new conversion sequence is started) b) if affc=0 and read of atdstat1 followed by read of result register atddrx c) if affc=1 and read of result register atddrx 1 = conversion number x has completed, result ready in atddrx 0 = conversion number x not completed atd input enable mask register (atddien) read: anytime write: anytime ienx?atd digital input enable on channel x (x=7,6,5,4,3,2,1,0) this bit controls the digital input buffer from the analog input pin (anx) to ptadx data register. 1 = enable digital input buffer to ptadx. 0 = disable digital input buffer to ptadx note: setting this bit will enable the corresponding digital input buffer continuously. if this bit is set while simultaneously using it as an analog port, there is potentially increased power consumption because the digital input buffer maybe in the linear region. address offset: $008d bit 7 654321 bit 0 read: ien 7 ien 6 ien 5 ien 4 ien 3 ien 2 ien 1 ien 0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) register descriptions mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 509 port data register (portad) the data port associated with the atd is input-only. the port pins are shared with the analog a/d inputs an7-0. read: anytime. if the digital input buffers are disabled (ienx=0), read returns a 1. write: anytime, no effect the a/d input channels may be used for general purpose digital input. ptadx ?a/d channel x (anx) digital input (x= 7,6,5,4,3,2,1,0) if the digital input buffer on the anx pin is enabled (ienx=1) read returns the logic level on anx pin (signal potentials not meeting v il or v ih specifications will have an indeterminate value)). if the digital input buffers are disabled (ienx=0), read returns a ?? reset sets all portad bits to ?? address offset: $008f bit 7 654321 bit 0 read: ptad 7 ptad6 ptad5 ptad4 ptad3 ptad2 ptad1 ptad0 write: pin function an7 an6 an5 an4 an3 an2 an1 an0 reset : 1 1111111 unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 510 analog to digital converter (atd) motorola atddrx a/d conversion result registers (atddr0?) where: x = 0, 1, 2, 3, 4, 5, 6, 7 left justified result data right justified result data address offset: $0090, $0092, $0094, $0096, $0098, $009a, $009c, $009e atddrxh bit 15 14 13 12 11 10 9 bit 8 10-bit data read: bit 9 msb 876543 bit 2 write: 8-bit data read: bit 7 msb 654321 bit 0 write: reset uuuuuuuu address offset: $0091, $0093, $0095, $0097, $0099, $009b, $009d, $009f atddrxl bit 7 654321 bit 0 10-bit data read: bit 1 bit 0 000000 write: 8-bit data read: u u 000000 write: reset uuuuuuuu address offset: $0090, $0092, $0094, $0096, $0098, $009a, $009c, $009e atddrxh bit 15 14 13 12 11 10 9 bit 8 10-bit data read: 000000 bit 9 msb bit 8 write: 8-bit data read: 00000000 write: reset at reset the data format is left justified! address offset: $0091, $0093, $0095, $0097, $0099, $009b, $009d, $009f atddrxl bit 7 654321 bit 0 10-bit data read: bit 7 654321 bit 0 write: 8-bit data read: bit 7 msb 65432 1 bit 0 write: reset at reset the data format is left justified! unimplemented or reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) functional description mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 511 read: anytime write: anytime, no effect. the a/d conversion results are stored in 8 read-only result registers. the result data is formatted in the result registers based on two criteria. first there is left and right justification; this selection is made using the djm control bit in atdctl5. second there is signed and unsigned data; this selection is made using the dsgn control bit in atdctl5. signed data is stored in 2? complement format and only exists in left justified format. signed data selected for right justified format is ignored. for 8-bit result data, the result data maps between the high (left justified) and low (right justified) order bytes of the result register. for 10-bit result data, the result data maps between bits 6?5 (left justified) and bits 0? (right justified) of the result register. therefore for each bit in the sar, there are 3 possible mappings of this bit into the result registers. functional description general the atd module is structured in an analog and a digital sub-block. analog sub-block the analog sub-block contains all analog electronics required to perform a single conversion. separate power supplies vdda and vssa allow to isolate noise of other mcu circuitry from the analog sub-block. sample and hold machine the sample and hold (s/h) machine accepts analog signals from the external surroundings and stores them as capacitor charge on a storage node. the sample process uses a two stage approach. during the first stage, the sample amplifier is used to quickly charge the storage node. the second stage connects the input directly to the storage node to complete the sample for high accuracy. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 512 analog to digital converter (atd) motorola when not sampling, the sample and hold machine disables its own clocks. the analog electronics still draw their quiescent current. the power down (adpu) bit must be set to disable both the digital clocks and the analog power consumption. the input analog signals are unipolar and must fall within the potential range of vssa to vdda. analog input multiplexer the analog input multiplexer connects one of the 8 external analog input channels to the sample and hold machine. sample buffer amplifier the sample amplifier is used to buffer the input analog signal so that the storage node can be quickly charged to the sample potential. analog-to-digital (a/d) machine the a/d machine performs analog to digital conversions. the resolution is program selectable at either 8 or 10 bits. the a/d machine uses a successive approximation architecture. it functions by comparing the stored analog sample potential with a series of digitally generated analog potentials. by following a binary search algorithm, the a/d machine locates the approximating potential that is nearest to the sampled potential. when not converting the a/d machine disables its own clocks. the analog electronics still draws quiescent current. the power down (adpu) bit must be set to disable both the digital clocks and the analog power consumption. only analog input signals within the potential range of v rl to v rh (a/d reference potentials) will result in a non-railed digital output codes. digital sub-block this subsection explains some of the digital features in more detail. see register descriptions for all details. external trigger input (etrig) the external trigger feature allows the user to synchronize atd conversions to the external environment events rather than relying on software to signal the atd module when atd conversions are to take place. the input signal (atd channel 7) is programmable to be edge or level sensitive with polarity control. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) functional description mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 513 table 95 gives a brief description of the different combinations of control bits and their affect on the external trigger function. during a conversion, if additional active edges are detected the overrun error flag etorf is set. in either level or edge triggered modes, the first conversion begins when the trigger is received. in both cases, the maximum latency time is one bus clock cycle plus any skew or delay introduced by the trigger circuitry. note: the conversion results for the external trigger atd channel 7 have no meaning while external trigger mode is enabled. once etrige is enabled, conversions cannot be started by a write to atdctl5, but rather must be triggered externally. if the level mode is active and the external trigger both de-asserts and re-asserts itself during a conversion sequence, this does not constitute an overrun. therefore, the flag is not set. if the trigger is left asserted in table 95 external trigger control bits etrigle etrigp etrige scan description xx00 ignores external trigger. performs one conversion sequence and stops. xx01 ignores external trigger. performs continuous conversion sequences. 001x falling edge triggered. performs one conversion sequence per trigger. 011x rising edge triggered. performs one conversion sequence per trigger. 101x trigger active low. performs continuous conversions while trigger is active. 111x trigger active high. performs continuous conversions while trigger is active. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 514 analog to digital converter (atd) motorola level mode while a sequence is completing, another sequence will be triggered immediately. general purpose digital input port operation the input channel pins can be multiplexed between analog and digital data. as analog inputs, they are multiplexed and sampled to supply signals to the a/d converter. as digital inputs, they supply external input data that can be accessed through the digital port register portad (input-only). the analog/digital multiplex operation is performed in the input pads. the input pad is always connected to the analog inputs of the atd module. the input pad signal is buffered to the digital port registers. this buffer can be turned on or off with the atddien register. this is important so that the buffer does not draw excess current when analog potentials are presented at its input. low power modes the atd module can be configured for lower mcu power consumption in 3 different ways: stop mode wait mode with awai=1 power down by writing adpu=0 (note that all atd registers remain accessible.) note that the reset value for the adpu bit is zero. therefore, when this module is reset, it is reset into the power down state. once the atd module is configured for low power, it aborts any conversion sequence in progress. when atd module powers up again (exit stop mode, exit wait mode with awai=1 or set adpu=1), it requires a recovery time period. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) reset initialization mc9s12t64revision 1.1.1 motorola analog to digital converter (atd) 515 reset initialization the reset state of each individual bit is listed within the register description section (see register descriptions ) which details the registers and their bit-fields. interrupts the interrupt requested by the atd module is listed in table 96 . table 96 atd module interrupt vectors interrupt source vector address ccr mask local enable sequence complete interrupt $ffd2,$ffd3 i bit ascie in atdctl2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
analog to digital converter (atd) mc9s12t64revision 1.1.1 516 analog to digital converter (atd) motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 517 fast background debug module (fbdm) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 modes of operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 low-power options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 overview the fast background debug mode (fbdm) module is a selectable single-wire or multi-wire, background debug system implemented in on-chip hardware for minimal cpu intervention. this module is a super set of the bdm module and has added capability for selection of an spi type interface in addition to the single-wire interface. this allows the interface to operate at a higher speed, through the use of three pins. features single-wire communication with host development system active out of reset in special single-chip mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 518 fast background debug module (fbdm) motorola nine hardware commands using free cycles, if available, for minimal cpu intervention hardware commands not requiring active bdm 15 firmware commands execute from on the standard bdm firmware lookup table instruction tagging capability software control of bdm operation during wait mode software selectable clocks bdm disabled when secure feature is enabled. selectable spi type interface (matches motorola standard spi phase =1, polarity =1) in spi mode, word reads are accelerated by sending next address while receiving data in spi mode, the interface will always force a steal in order to make bdm instructions faster f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) modes of operation mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 519 modes of operation bdm is available in all operating modes but must be enabled before firmware commands are executed. some on-chip peripherals have a control bit which allows suspending the peripheral function during background debug mode. in special single-chip mode, background operation is enabled and active out of reset. this allows programming a system with blank memory. bdm is also active out of special peripheral mode reset and can be turned off by clearing the bdmact bit in the bdm status (bdmsts) register. this allows testing of the bdm memory space as well as the user? memory space. note: the bdm serial system should not be used in special peripheral mode since the cpu, which in other modes interfaces with the bdm to relinquish control of the bus during a free cycle or a steal operation, is not operating in this mode. normal operation bdm operates the same in all normal modes. special operation special single-chip mode bdm is enabled and active immediately out of reset. this allows programming a system with blank memory. special peripheral mode bdm is enabled and active immediately out of reset. bdm can be disabled by clearing the bdmact bit in the bdm status (bdmsts) register. the bdm serial system should not be used in special peripheral mode. emulation modes in emulation modes, the bdm operates as in all normal modes. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 520 fast background debug module (fbdm) motorola block diagram the block diagrams of the bdm are shown in figure 99 and figure 100 below. figure 99 block diagram of bdm in single wire mode figure 100 block diagram of bdm in spi mode clksw bdmact entag trace sdv 16-bit shift register bkgd input clocks data address bus interface and control logic sckbdm / spimode enbdm instruction decode and execution standard bdm firmware lookup table bkgd data output bkgd host system mcu bdm module bkgd drive control enbdm clksw bdmact entag trace sdv 16-bit shift register bkgd_ind clocks data address bus interface and control logic bkgd_dout sckbdm spimode instruction decode and execution standard bdm firmware lookup table sck host system mcu bdm module f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) external pin descriptions mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 521 external pin descriptions from a core standpoint there are five pins making up the fbdm interface. at the chip level these pins will likely be combined with other pins. bkgd / si?background interface pin, which becomes the si (serial data into the bdm) in spi mode taghi ?high byte instruction tagging pin taglo ?low byte instruction tagging pin sckbdm / spimode ?selects spi interface or single wire interface at rising edge the reset pin, if spi mode is select, then this pin becomes the serial clock input so ?serial data out of the bdm for spi mode background interface pin (bkgd) debugging control logic communicates with external devices serially via the single-wire background interface pin (bkgd). during reset, this pin is a mode select input which selects between normal and special modes of operation. after reset, this pin becomes the dedicated serial interface pin for the background debug mode. the serial data from the host system to the fbdm uses this pin in spi mode. high byte instruction tagging pin ( taghi) this pin is used to tag the high byte of an instruction. when instruction tagging is on, a logic 0 at the falling edge of the external clock (eclk) tags the high half of the instruction word being read into the instruction queue. low byte instruction tagging pin ( taglo) this pin is used to tag the low byte of an instruction. when instruction tagging is on and low strobe is enabled, a logic 0 at the falling edge of the external clock (eclk) tags the low half of the instruction word being read into the instruction queue. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 522 fast background debug module (fbdm) motorola fbdm clock in spi mode (sckbdm) and spi mode select (spimode) while the part is in reset, this pin selects whether the fbdm will operate as a single-wire interface (spimode = 0) or multi-wire spi type interface (spimode = 1). when reset is released this mode is locked in and cannot be changed until the next reset. when the part is out of reset, if spi mode has been selected, then this pin is the serial clock input (sckbdm pin, sck inside the module). the clock indicates when data should be shifted and sampled. serial data out of fbdm in spi mode (so) the serial data from the fbdm to the host system uses this output pin in spi mode. if single wire mode is selected during reset, this pin will hold a driven low state. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) register map mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 523 register map a summary of the registers associated with the bdm is shown in figure 101 below. registers are accessed by host-driven communications to the bdm hardware using read_bd and write_bd commands. detailed descriptions of the registers and associated bits are given in the subsections that follow. figure 101 bdm register map summary address register name bit 7 654321 bit 0 $ff00 bdm reserved read: x x x x x x 0 0 write: $ff01 bdmsts read: enbdm bdmact entag sdv trace clksw unsec 0 write: $ff02 bdm reserved read: x x x x x x x x write: $ff03 bdm reserved read: x x x x x x x x write: $ff04 bdm reserved read: x x x x x x x x write: $ff05 bdm reserved read: x x x x x x x x write: $ff06 bdmccr read: ccr7 ccr6 ccr5 ccr4 ccr3 ccr2 ccr1 ccr0 write: $ff07 bdminr read: 0 reg14 reg13 reg12 reg11 0 0 0 write: = unimplemented x = indeterminate f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 524 fast background debug module (fbdm) motorola register descriptions bdm status register (bdmsts) read: all modes through bdm operation write: all modes but subject to the following: bdmact can only be set by bdm hardware upon entry into bdm. it can only be cleared by the standard bdm firmware lookup table upon exit from bdm active mode. clksw can only be written via bdm hardware or standard bdm firmware write commands. all other bits, while writable via bdm hardware or standard bdm firmware write commands, should only be altered by the bdm hardware or standard firmware lookup table as part of bdm command execution. enbdm should only be set via a bdm hardware command if the bdm firmware commands are needed. (this does not apply in special single chip mode). enbdm ?enable bdm this bit controls whether the bdm is enabled or disabled. when enabled, bdm can be made active to allow firmware commands to be executed. when disabled, bdm cannot be made active but bdm hardware commands are still allowed. address: $ff01 bit 7 6 5 4 3 2 1 bit 0 read: enbdm bdmact entag sdv trace clksw unsec 0 write: reset: special single-chip mode: 0 1 0 0 0 0 0 0 special peripheral mode: 0 1 0 0 0 0 0 0 all other modes: 0 0 0 0 0 0 0 0 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) register descriptions mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 525 1 = bdm enabled 0 = bdm disabled note: enbdm is set by the firmware immediately out of reset in special single-chip mode. in secured mode this bit will not be set by the firmware until after the flash erase verify test is complete. bdmact ?bdm active status this bit becomes set upon entering bdm. the standard bdm firmware lookup table is then enabled and put into the memory map. bdmact is cleared by a carefully timed store instruction in the standard bdm firmware as part of the exit sequence to return to user code and remove the bdm memory from the map. 1 = bdm active 0 = bdm not active entag ?tagging enable this bit indicates whether instruction tagging in enabled or disabled. it is set when the taggo command is executed and cleared when bdm is entered. the serial system is disabled and the tag function enabled 16 cycles after this bit is written. bdm cannot process serial commands while tagging is active. 1 = tagging enabled 0 = tagging not enabled, or bdm active sdv ?shift data valid this bit is set and cleared by the bdm hardware. it is set after data has been transmitted as part of a firmware read command or after data has been received as part of a firmware write command. it is cleared when the next bdm command has been received or background debug mode is exited. sdv is used by the standard bdm firmware to control program flow execution. 1 = data phase of command is complete 0 = data phase of command not complete f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 526 fast background debug module (fbdm) motorola trace ?trace1 bdm firmware command is being executed this bit gets set when a bdm trace1 firmware command is first recognized. it will stay set as long as continuous back-to-back trace1 commands are executed. this bit will get cleared when the next command that is not a trace1 command is recognized. 1 = trace1 command is being executed 0 = trace1 command is not being executed clksw ?clock switch the clksw bit controls which clock the bdm operates with. it is only writable from a hardware bdm command. a write_bd_byte command to address $ff01 changes the clksw bit. the 150 cycle delay at the clock speed that is active during the data portion of the command will occur before the new clock source is guaranteed to be active. the start of the next bdm command uses the new clock for timing subsequent bdm communications. this clock is referred as target clock in this document. 1 = bdm system operates with bus clock rate 0 = bdm system operates with oscillator clock divided by 2 when the pllsel bit is set, otherwise bdm system operates with bus clock rate. unsec ?unsecure this bit is writable only in special single chip mode from the bdm secure firmware and always resets to 0. this bit is clear as secured mode is entered so that the secure bdm firmware lookup table is enabled and put into the memory map along with the standard bdm firmware lookup table. table 97 target clock selection summary clksw pllsel target clock 0 0 bus clock 0 1 oscillator clock / 2 1 bus clock f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) register descriptions mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 527 the secure bdm firmware lookup table verifies that the flash is erased. this being the case, unsec signal is set. the bdm program jumps to start of the standard bdm firmware lookup table and the secure bdm firmware lookup table is turned off. if the erase test fails, the unsec bit will not be asserted. 1 = the part is in the unsecured mode 0 = the part is in the secured mode warning: when unsec is set, security is off and the user can change the state of the secure bits in the on-chip flash eeprom. note that if the user does not change the state of the bits to ?nsecured mode, the system will be secured again when it is next taken out of reset. bdm ccr holding register (bdmccr) read: all modes write: all modes note: when bdm is made active, the cpu stores the value of the ccr register in the bdmccr register. however, out of special single-chip reset, the bdmccr is set to $d8 and not $d0 which is the reset value of the ccr register. ccr7?cr0 ?bdm ccr holding bits when entering background debug mode, the bdm ccr holding register is used to save the contents of the condition code register of the user? program. it is also used for temporary storage in the standard bdm firmware mode. the bdm ccr holding register can be written to modify the ccr value. address: $ff06 bit 7 654321 bit 0 read: ccr7 ccr6 ccr5 ccr4 ccr3 ccr2 ccr1 ccr0 write: reset: 00000000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 528 fast background debug module (fbdm) motorola bdm internal register position register (bdminr) read: all modes write: never reg14?eg11 ?internal register map position these four bits show the state of the upper bits of the base address for the system? relocatable register block. bdminr is a shadow of the initrg register which maps the register block to any 2k byte space within the first 32k bytes of the 64k byte address space. if the register block size is 1k bytes, it will always occupy the first 1k bytes of the specified 2k byte space. functional description the bdm module receives and executes commands from a host via a single wire serial interface or via the bdm spi interface. there are two types of bdm commands, namely, hardware commands and firmware commands. hardware commands are used to read and write target system memory locations and to enter active background debug mode (see bdm hardware commands ). target system memory includes all memory that is accessible by the cpu. firmware commands are used to read and write cpu resources and to exit from active background debug mode (see standard bdm firmware commands ). the cpu resources referred to are the accumulator (d), x address: $ff07 bit 7 6 5 4321 bit 0 read: 0 reg14 reg13 reg12 reg11 0 0 0 write: reset: 0 0 0 00000 = unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 529 index register (x), y index register (y), stack pointer (sp), and program counter (pc). hardware commands can be executed at any time and in any mode excluding a few exceptions as highlighted in modes of operation below. firmware commands can only be executed when the system is in active background debug mode (bdm). spi mode an spi mode option has been added to this module. when spi mode is selected, the single wire interface becomes three wires: serial slave data in (si), serial slave data out (so) and serial slave clock in (sck). as in the single wire mode, the external system still initiates and controls all transfers. the dedicated pins allow faster transfer rates, up to one quarter the bus frequency per bit. while in spi mode, the delay time between an address and read data is shortened to always steal the next available cycle. on parts operating in single chip mode, this will be 8 target clock cycles (detailed explanation in hardware delay in spi mode ). it will take 21 target clock cycles for parts with memory and / or peripherals on an external bus (to allow for misaligned, narrow bus and stretched accesses on the cycle before the steal and to allow for narrow bus and stretched accesses on the steal cycle). also while in spi mode, there is one hardware command with added functionality. the read word instruction will take in a new address while the data is being output. then another address can be sent in while the data from the previous address is sent out (full duplex operation). when the user has completed the operation, an $ffff needs to be sent in as the address. this will quit the read word instruction and the next input will be a new command. note that this is the only instruction with this operation enhancement. selecting spi mode the core has an input (sckbdm / spimode) which selects whether the bdm will use a single wire interface or the spi type interface. this selection occurs at the release of reset and cannot be changed until the next reset. spimode = 1 during reset for selecting the spi type interface and spimode = 0 during reset for selecting the single wire interface. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 530 fast background debug module (fbdm) motorola secured mode if the user resets into special single chip mode with the part secured, a secure bdm firmware lookup table is brought into the map along with the standard bdm firmware lookup table. the secure bdm firmware is higher priority than the standard bdm firmware. the secure bdm firmware verifies that the flash is erased. this being the case, the unsec bit is asserted (written to one). the bdm program jumps to start of the standard bdm firmware and the secure bdm firmware is turned off. if the flash do not verify as erased, the bdm firmware sets the enbdm bit, without asserting unsec, and the firmware enters a loop. this causes the bdm hardware commands to become enabled, but does not enable the software commands. this allows the bdm hardware commands to be used to erase the flash. enabling and activating bdm the system must be in active bdm to execute standard bdm firmware commands. bdm can be activated only after being enabled. bdm is enabled by setting the enbdm bit in the bdm status (bdmsts) register. the enbdm bit is set by writing to the bdm status (bdmsts) register, via the single-wire interface or via the bdm spi interface, using a hardware command such as write_bd_byte. after being enabled, bdm is activated by one of the following 1 : hardware background command bdm external instruction tagging mechanism cpu bgnd instruction breakpoint sub-block? force or tag mechanism 2 when bdm is activated, the cpu finishes executing the current instruction and then begins executing the firmware in the standard bdm firmware lookup table. when bdm is activated by the breakpoint sub-block, the type of breakpoint used determines if bdm becomes active before or after execution of the next instruction. 1. bdm is enabled and active immediately out of special single-chip reset (see special opera- tion ). 2. this method is only available on systems that have a a breakpoint sub-block. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 531 note: if an attempt is made to activate bdm before being enabled, the cpu resumes normal instruction execution after a brief delay. if bdm is not enabled, any hardware background commands issued are ignored by the bdm and the cpu is not delayed. in active bdm, the bdm registers and standard bdm firmware lookup table are mapped to addresses $ff00 to $ffff. bdm registers are mapped to addresses $ff00 to $ff07. the bdm module uses these registers which are readable anytime by the bdm module, not user programs. note: when the background debug mode is activated, the pwm, ect and atd modules enter freeze mode and control bits determine if the module is stopped during active bdm. see each module section about freeze mode. bdm hardware commands hardware commands are used to read and write target system memory locations and to enter active background debug mode. target system memory includes all memory that is accessible by the cpu such as on-chip ram, eeprom, flash eeprom, i/o and control registers, and all external memory. hardware commands are executed with minimal or no cpu intervention and do not require the mcu to be in active bdm for execution, although, they can still be executed in this mode. when executing a hardware command in single wire mode, the bdm sub-block waits for a free cpu bus cycle so that the background access does not disturb the running application programs. if a free cycle is not found within 128 clock cycles, the cpu is momentarily frozen so that the bdm module can steal a cycle. when the bdm module finds a free cycle, the operation does not intrude on normal cpu operation provided that it can be completed in a single cycle. however, if an operation requires multiple cycles, cpu clocks are frozen until the operation is complete, even though the bdm module found a free cycle. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 532 fast background debug module (fbdm) motorola the bdm hardware commands are listed in table 98 . the read_bd and write_bd commands are used for reading the on standard bdm firmware lookup table locations and for reading and writing to the bdm register locations. these locations are not normally in the system memory map but share addresses with the application in memory. to distinguish between physical memory locations that share the same address, bdm memory resources are enabled just for the read_bd and write_bd access cycle. this allows the bdm system to access table 98 hardware commands command opcode (hex) data description background 90 none enter background debug mode if ?mware is enabled. read_bd_byte e4 16-bit address 16-bit data out read from memory with standard bdm ?mware lookup table in map. odd address data on low byte; even address data on high byte read_bd_word ec 16-bit address 16-bit data out read from memory with standard bdm ?mware lookup table in map . must be aligned access. read_byte e0 16-bit address 16-bit data out read from memory with standard bdm ?mware lookup table out of map. odd address data on low byte; even address data on high byte read_word (single wire mode) e8 16-bit address 16-bit data out read from memory with standard bdm ?mware lookup table out of map . must be aligned access. read_word (spi mode) e8 16-bit address 16-bit data out / next address read from memory with standard bdm ?mware lookup table out of map . must be aligned access. spi interface only: next address must be sent in with data out, use address = $ffff to end read word operation. write_bd_byte c4 16-bit address 16-bit data in write to memory with standard bdm ?mware lookup table in map. odd address data on low byte; even address data on high byte write_bd_word cc 16-bit address 16-bit data in write to memory with standard bdm ?mware lookup table in map . must be aligned access write_byte c0 16-bit address 16-bit data in write to memory with standard bdm ?mware lookup table out of map. odd address data on low byte; even address data on high byte write_word c8 16-bit address 16-bit data in write to memory with standard bdm ?mware lookup table out of map. must be aligned access. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 533 bdm locations unobtrusively, even if the addresses conflict with the application memory map. standard bdm firmware commands firmware commands are used to access and manipulate cpu resources. the system must be in active bdm to execute standard bdm firmware commands (see enabling and activating bdm ). normal instruction execution is suspended while the cpu executes the firmware located in the standard bdm firmware lookup table. the hardware command background is the usual way to activate bdm. as the system enters active bdm, the standard bdm firmware lookup table and bdm registers become visible in the on-chip memory map at $ff00-$ffff, and the cpu begins executing the standard bdm firmware. the standard bdm firmware watches for serial commands and executes them as they are received. the firmware commands are shown in table 99 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 534 fast background debug module (fbdm) motorola table 99 firmware commands command opcode (hex) data description read_next 62 16-bit data out increment x by 2 (x = x + 2), then read word x points to. read_pc 63 16-bit data out read program counter. read_d 64 16-bit data out read d accumulator. read_x 65 16-bit data out read x index register. read_y 66 16-bit data out read y index register. read_sp 67 16-bit data out read stack pointer. write_next 42 16-bit data in increment x by 2 (x=x+2), then write word to location pointed to by x. write_pc 43 16-bit data in write program counter. write_d 44 16-bit data in write d accumulator. write_x 45 16-bit data in write x index register. write_y 46 16-bit data in write y index register. write_sp 47 16-bit data in write stack pointer. go 08 none go to user program. trace1 10 none execute one user instruction then return to active bdm. taggo 18 none enable tagging and go to user program. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 535 bdm command structure hardware and firmware bdm commands start with an 8-bit opcode followed by a 16-bit address and/or a 16-bit data word depending on the command. all the read commands return 16 bits of data despite the byte or word implication in the command name. note: 8-bit reads return 16-bits of data, of which, only one byte will contain valid data. if reading an even address, the valid data will appear in the msb. if reading an odd address, the valid data will appear in the lsb. note: 16-bit misaligned reads and writes are not allowed. if attempted, the bdm module will ignore the least significant bit of the address and will assume an even address from the remaining bits. hardware commands in single wire mode for hardware data read commands, the external host must wait 150 target clock cycles 1 after sending the address before attempting to obtain the read data. this is to be certain that valid data is available in the bdm shift register, ready to be shifted out. for hardware write commands, the external host must wait 150 target clock cycles after sending the data to be written before attempting to send a new command. this is to avoid disturbing the bdm shift register before the write has been completed. the 150 target clock cycle delay in both cases includes the maximum 128 cycle delay that can be incurred as the bdm waits for a free cycle before stealing a cycle. hardware commands in spi mode for hardware data read commands, the external host must wait the hardware delay after sending the address before attempting to obtain the read data. this is to be certain that valid data is available in the bdm shift register, ready to be shifted out. for hardware write commands, the external host must wait the hardware delay after sending the data to be written before attempting to send a new command. this is to avoid disturbing the bdm shift register before the write has been completed. refer to hardware delay in spi mode in page 539. 1. target clock cycles are cycles measured using the target system? serial clock rate. see bdm serial interface and bdm status register (bdmsts) for information on how serial clock rate is selected. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 536 fast background debug module (fbdm) motorola firmware commands for firmware read commands, the external host must wait 32 target clock cycles after sending the command opcode before attempting to obtain the read data. if the access is external with a narrow bus access (+1 cycle) and / or a stretch (+1, 2 or 3 cycles), up to an additional 7 cycles could be needed if both occur (39 target clock cycles total). this allows enough time for the requested data to be made available in the bdm shift register, ready to be shifted out. for firmware write commands, the external host must wait 32 target clock cycles after sending the data to be written, before attempting to send a new command. this is to avoid disturbing the bdm shift register before the write has been completed. the external host should wait 64 target clock cycles after a trace1 or go command before starting any new serial command. this is to allow the cpu to exit gracefully from the standard bdm firmware lookup table and resume execution of the user code. disturbing the bdm shift register prematurely may adversely affect the exit from the standard bdm firmware lookup table. figure 102 represents the bdm command structure in single wire mode. the command blocks illustrate a series of eight bit times starting with a falling edge. the bar across the top of the blocks indicates that the bkgd line idles in the high state. the minimum time for an 8-bit command is 8 16 target clock cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 537 figure 102 bdm command structure - single wire mode figure 103 represents the bdm command structure in spi mode. the command blocks illustrate a series of eight bit times starting with a falling edge. the bar across the top of the blocks indicates that the si and so lines idle in the high state. the minimum time for an 8-bit command is 8 4 target clock cycles. hardware hardware firmware firmware go, 32-tc ** tc = target clock cycles command address 150-tc delay next delay 8 bits at ~16 tc/bit 16 bits at ~16 tc/bit 16 bits at ~16 tc/bit command address data next data read write read write trace command next command data 64-tc delay next command 150-tc delay 32-tc delay command command command command data next command ** allow 39 target clocks if read is external with stretch and / or narrow bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 538 fast background debug module (fbdm) motorola figure 103 bdm command structure - spi mode hardware hardware firmware firmware go, 32-tc ** tc = target clock cycles command address 1 hardware delay delay 8 bits 16 bits 16 bits command address data next address 2 read_word write read write trace, command next command data 64-tc delay next command hardware delay 32-tc delay command command command next command serial in (si) data 1 hardware delay 16 bits address 3 data 2 serial out (so) serial in (si) serial out (so) serial in (si) serial out (so) data serial in (si) serial out (so) serial in (si) serial out (so) example 1 hardware command address $ffff read_word serial in (si) data serial out (so) example 2 next command hardware command address read serial in (si) data serial out (so) (all others) next command taggo hardware delay = 8-tc if no stretch and no narrow bus. = 21-tc stretch and or narrow bus can occur ** allow 39 target clocks if read is external with stretch and / or narrow bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 539 hardware delay in spi mode a hardware delay is required between serial transfers when the bdm needs to access the bus to complete an operation. for example, on a hardware read a hardware delay is required after the address is sent so that the data can be accessed before it is returned. on a hardware write, a hardware delay is required after the write data is sent so that the write occurs before the next command is sent. in spi mode, the hardware delay allows the bdm to synchronize to the incoming serial data, load up the appropriate registers for the bus access, synchronize with the cpu to steal the bus, complete the bus access and for a read, put the read data into the shifter to return it. the hardware delay takes into account the part of the operation that occurs between the rising edges of the serial clock. at the fastest transfer rate this is a total of eight target clocks. at the fastest rate, the user must wait eight target clocks which is the hardware delay. if sckbdm was running slower, at 12 target clocks per bit, the hardware delay reduces to zero for single chip mode and to 13 for expanded mode (worst case). this can be determined with the equations: for internal-only accesses hardware delay = 12tc ?(sckbdm period) for external accesses allowing for stretch and wide bus hardware delay = 21tc ?(sckbdm period) for external accesses allowing for stretch and narrow bus hardware delay = 25tc ?(sckbdm period) where: if the hardware delay goes negative, it is zero. for example, if the spi is running at 8 target clocks per bit, we get a 4 tc delay for internal accesses, a 13 tc delay for external accesses with a wide bus and stretch, and a 17 tc delay for external accesses with a narrow bus and stretch. bdm serial interface the bdm module communicates with external devices serially via the mcu mode control bkgd pin. during reset, this pin is a mode select input which selects between normal and special modes of operation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 540 fast background debug module (fbdm) motorola after reset, this pin becomes the dedicated serial interface pin for the bdm module. the bdm serial interface is timed using the clock selected by the clksw bit in the status register (see bdm status register (bdmsts) ). this clock will be referred to as the target clock in the following explanation. the bdm serial interface uses a clocking scheme in which the external host generates a falling edge on the bkgd pin to indicate the start of each bit time. this falling edge is sent for every bit whether data is transmitted or received. data is transferred most significant bit (msb) first at 16 target clock cycles per bit. the interface times out if 512 clock cycles occur between falling edges from the host. the bkgd pin is a pseudo open-drain pin and has an weak on-chip active pull-up that is enabled at all times. it is assumed that there is an external pullup and that drivers connected to bkgd do not typically drive the high level. since r-c rise time could be unacceptably long, the target system and host provide brief driven-high (speedup) pulses to drive bkgd to a logic 1. the source of this speedup pulse is the host for transmit cases and the target for receive cases. diagrams in figure 104 , figure 105 , and figure 106 show timing of bit-time cases in single wire mode. each case begins when the host drives the bkgd pin low to generate a falling edge. since the host and target are operating from separate clocks, it can take the target mcu up to one full clock cycle to recognize this edge. the target measures delays from this perceived start of the bit time while the host measures delays from the point it actually drove bkgd low to start the bit up to one target clock cycle earlier. synchronization between the host and target is established in this manner at the start of every bit time. figure 104 shows an external host transmitting a logic 1 and transmitting a logic 0 to the bkgd pin of a target system. the host is asynchronous to the target, so there is up to a one clock-cycle delay from the host-generated falling edge to where the target recognizes this edge as the beginning of the bit time. ten target clock cycles later, the target senses the bit level on the bkgd pin. internal glitch detect logic requires f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 541 the pin be driven high no later that eight target clock cycles after the falling edge for a logic 1 transmission. since the host drives the high speedup pulses in these two cases, the rising edges look like digitally driven signals. figure 104 bdm host-to-target serial bit timing the receive cases are more complicated. figure 105 shows the host receiving a logic 1 from the target mcu. since the host is asynchronous to the target mcu, there is up to one clock-cycle delay from the host-generated falling edge on bkgd to the perceived start of the bit time in the target mcu. the host holds the bkgd pin low long enough for the target to recognize it (at least two target clock cycles). the host must release the low drive before the target mcu drives a brief high speedup pulse seven target clock cycles after the perceived start of the bit time. the host should sample the bit level about 10 target clock cycles after it started the bit time. earliest start of next bit target senses bit 10 cycles synchronization uncertainty clock target system host transmit 1 host transmit 0 perceived start of bit time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 542 fast background debug module (fbdm) motorola figure 105 bdm target-to-host serial bit timing (logic 1) figure 106 shows the host receiving a logic 0 from the target mcu. since the host is asynchronous to the target mcu, there is up to a one clock-cycle delay from the host-generated falling edge on bkgd to the start of the bit time as perceived by the target mcu. the host initiates the bit time but the target mcu finishes it. since the target wants the host to receive a logic 0, it drives the bkgd pin low for 13 target clock cycles then briefly drives it high to speed up the rising edge. the host samples the bit level about 10 target clock cycles after starting the bit time. high-impedance earliest start of next bit r-c rise 10 cycles 10 cycles host samples bkgd pin perceived start of bit time bkgd pin clock target system host drive to bkgd pin target system speedup pulse high-impedance high-impedance f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 543 figure 106 bdm target-to-host serial bit timing (logic 0) bdm serial interface in spi mode an eight bit transfer in spi mode is shown in the diagram (see figure 107 ). the data is shifted (changes) on the falling edges of sck and it is sampled (registered) on the rising edges of sck. the sck clock is always driven into the bdm and initiates a transfer. it? idle state is one. commands, addresses and write data are driven into the bdm on si and read data is driven out of the bdm on so. figure 107 8-bit data transfer in spi mode timing specifications for the spi mode interface are described in the table (see table 100 ). sck must be no faster than 4 target clocks. when earliest start of next bit clock target sys. host drive to bkgd pin bkgd pin perceived start of bit time 10 cycles 10 cycles host samples bkgd pin target sys. drive and speedup pulse speedup pulse high-impedance sck si so data is shifted at sck falling edges and sampled at sck rising edges msb654321 lsb msb 6 5 4 3 2 1 lsb f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 544 fast background debug module (fbdm) motorola running at the fastest rate, it is important that sck be a 50% duty cycle because both edges of sck are used (sampling and shifting). instruction tracing when a trace1 command is issued to the bdm module in active bdm, the cpu exits the standard bdm firmware and executes a single instruction in the user code. once this has occurred, the cpu is forced to return to the standard bdm firmware and the bdm module is active and ready to receive a new command. if the trace1 command is issued again, the next user instruction will be executed. this facilitates stepping or tracing through the user code one instruction at a time. if an interrupt is pending when a trace1 command is issued, the interrupt stacking operation occurs but no user instruction is executed. once back in standard bdm firmware execution, the program counter points to the first instruction in the interrupt service routine. instruction tagging the instruction queue and cycle-by-cycle cpu activity are reconstructible in real time or from trace history that is captured by a logic analyzer. however, the reconstructed queue cannot be used to stop the cpu at a specific instruction, because execution already has begun by the time an operation is visible outside the system. a separate instruction tagging mechanism is provided for this purpose. table 100 spi mode timing characteristic minimum maximum sck period 4 target clocks 500 target clocks sck high time 2 target clocks 250 target clocks sck low time 2 target clocks 250 target clocks si data valid before rising edge of sck 0.5 target clocks - si data hold after rising edge of sck 2 target clocks - so data valid before rising edge of sck 0.5 target clocks - so data hold after rising edge of sck 2 target clocks - f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) functional description mc9s12t64revision 1.1.1 motorola fast background debug module (fbdm) 545 the tag follows program information as it advances through the instruction queue. when a tagged instruction reaches the head of the queue, the cpu enters active bdm rather than executing the instruction. note: tagging is disabled when bdm becomes active and bdm serial commands are not processed while tagging is active. executing the bdm taggo command configures two mcu pins for tagging. on mcus with an [muxed] external bus interface (mebi or ebi), the taglo signal shares a pin with the lstrb signal, and the taghi signal shares a pin with the bkgd signal. on mcus with a development tools interface (dti), taglo will generally be bonded out separately. warning: if tagging is used in spi mode, the bkgd pin needs to be brought to a high level soon after the taggo command is sent. since the bkgd pin is used for taghi, it must be high within 15 target cycles, or the next instruction may get tagged. table 101 shows the functions of the two tagging pins. the pins operate independently, that is, the state of one pin does not affect the function of the other. the presence of logic level 0 on either pin at the fall of the external clock (eclk) performs the indicated function. high tagging is allowed in all modes. on mcus with a [muxed] external bus interface (mebi or ebi), low tagging is allowed only when low strobe is enabled (lstrb is allowed only in wide expanded modes and emulation expanded narrow mode). on mcus with a development tools interface (dti), low tagging is allowed in all modes. table 101 tag pin function taghi taglo tag 1 1 no tag 1 0 low byte 0 1 high byte 0 0 both bytes f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
fast background debug module (fbdm) mc9s12t64revision 1.1.1 546 fast background debug module (fbdm) motorola low-power options run mode the bdm does not include disable controls that would conserve power during run mode. wait mode the bdm cannot be used in wait mode if the system disables the clocks to the bdm. stop mode the bdm is completely shutdown in stop mode. interrupts the bdm does not generate interrupt requests. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 547 breakpoint (bkp) contents overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 external pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 breakpoint priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 reset initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 overview the breakpoint sub-block of the core provides for hardware breakpoints that are used to debug software on the cpu by comparing actual address and data values to predetermined data in setup registers. a successful comparison will place the cpu in background debug mode or initiate a software interrupt (swi). the breakpoint module contains two modes of operation: 1. dual address mode, where a match on either of two addresses will cause the system to enter background debug mode or initiate a software interrupt (swi). 2. full breakpoint mode, where a match on address and data will cause the system to enter background debug mode or initiate a software interrupt (swi). there are two types of breakpoints, forced and tagged. forced breakpoints occur at the next instruction boundary if a match occurs and f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 548 breakpoint (bkp) motorola tagged breakpoints allow for breaking just before a specific instruction executes. tagged breakpoints will only occur on addresses. tagging on data is not allowed; however, if this occurs, nothing will happen within the bkp. the bkp allows breaking within a 256 byte address range and/or within expanded memory. it allows matching of the data as well as address matching and to match 8 bit or 16 bit data. forced breakpoints can match on a read or a write cycle. features full or dual breakpoint mode compare on address and data (full) compare on either of two addresses (dual) bdm or swi breakpoint enter bdm on breakpoint (bdm) execute swi on breakpoint (swi) tagged or forced breakpoint break just before a specific instruction will begin execution (tag) break on the first instruction boundary after a match occurs (force) single, range, or page address compares compare on address (single) compare on address 256 byte (range) compare on any 16k page (page) compare address on read or write on forced breakpoints high and/or low byte data compares f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) modes of operation mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 549 modes of operation the breakpoint can operate in dual address mode or full breakpoint mode. each of these modes is discussed in the subsections below. dual address mode when dual address mode is enabled, two address breakpoints can be set. each breakpoint can cause the system to enter background debug mode or to initiate a software interrupt based upon the state of the bkbdm bit in the bkpct0 register being logic one or logic zero, respectively. bdm requests have a higher priority than the swi requests. no data breakpoints are allowed in this mode. the bktag bit in the bkpct0 register selects whether the breakpoint mode is force or tag. the bkxmbh:l bits in the bkpct1 register select whether or not the breakpoint is matched exactly or is a range breakpoint. they also select whether the address is matched on the high byte, low byte, both bytes, and/or memory expansion. the bkxrw and bkxrwe bits in the bkpct1 register select whether the type of bus cycle to match is a read, write, or both when performing forced breakpoints. full breakpoint mode full breakpoint mode requires a match on address and data for a breakpoint to occur. upon a successful match, the system will enter background debug mode or initiate a software interrupt based upon the state of the bkbdm bit in the bkpct0 register being logic one or logic zero, respectively. the bdm requests have a higher priority than the swi requests. r/w matches are also allowed in this mode. the bktag bit in the bkpct0 register selects whether the breakpoint mode is forced or tagged. if the bktag bit is set in bkpct0, then only address is matched, data is ignored. the bk0mbh:l bits in the bkpct1 register select whether or not the breakpoint is matched exactly, is a range breakpoint, or is in page space. the bk1mbh:l bits in the bkpct1 register select whether the data is matched on the high byte, low byte, or both bytes. the bk0rw and bk0rwe bits in the bkpct1 register select whether the type of bus cycle to match is a read or a write f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 550 breakpoint (bkp) motorola when performing forced breakpoints. bk1rw and bk1rwe bits in the bkpct1 register are not used in full breakpoint mode. block diagram a block diagram of the breakpoint sub-block is shown in figure 108 below. the breakpoint contains three main sub-blocks: the register block, the compare block and the control block. the register block consists of the eight registers that make up the breakpoint register space. the compare block performs all required address and data signal comparisons. the control block generates the signals for the cpu for the tag high, tag low, force swi and force bdm functions. in addition, it generates the register read and write signals and the comparator block enable signals. note: there is a two cycle latency for address compares for forces, a two cycle latency for write data compares, and a three cycle latency for read data compares. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) block diagram mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 551 figure 108 breakpoint block diagram breakpoint modes and generation of swi, force bdm & tags comparator bkp0h bkp0l bkp0x bkpct0 bkp1x compare block register block control block bkpct1 bkp1l bkp1h comparator comparator comparator comparator comparator data/address high mux data/address low mux expansion addresses expansion addresses address high address low data high data low address high address low control sigs results sigs control bits read/write ctl address expansion address write data comparator comparator read data high read data low read data . . . . . . clocks and control signals bkp read data bus write data bus bkp control signals . . . . . . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 552 breakpoint (bkp) motorola external pin descriptions the bkp sub-block does not access any external pins. register map note: register address = base address (initrg) + address offset register name bit 7 6 5 4 3 2 1 bit 0 address offset bkpct0 read: bken bkfull bkbdm bktag 0000 $0028 write: bkpct1 read: bk0mbh bk0mbl bk1mbh bk1mbl bk0rwe bk0rw bk1rwe bk1rw $0029 write: bkp0x read: 0 0 bk0v5 bk0v4 bk0v3 bk0v2 bk0v1 bk0v0 $002a write: bkp0h read: bit 15 14 13 12 11 10 9 bit 8 $002b write: bkp0l read: bit 7 6 5 4 3 2 1 bit 0 $002c write: bkp1x read: 0 0 bk1v5 bk1v4 bk1v3 bk1v2 bk1v1 bk1v0 $002d write: bkp1h read: bit 15 14 13 12 11 10 9 bit 8 $002e write: bkp1l read: bit 7 6 5 4 3 2 1 bit 0 $002f write: = unimplemented or reserved figure 109 breakpoint register map f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) register descriptions mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 553 register descriptions there are eight 8-bit registers in the bkp module. note: all bits of all registers in this module are completely synchronous to internal clocks during a register read. breakpoint control register 0 (bkpct0 ) this register is used to set the breakpoint modes. read and write: anytime. bken ?breakpoint enable this bit enables the module. 1 = breakpoint module on. 0 = breakpoint module off. bkfull?full breakpoint mode enable this bit controls whether the breakpoint module is in dual address mode or full breakpoint mode 1 = full breakpoint mode enabled. 0 = dual address mode enabled. bkbdm ?breakpoint background debug mode enable this bit determines if the breakpoint causes the system to enter background debug mode (bdm) or initiate a software interrupt (swi) 1 = go to bdm on a compare. 0 = go to software interrupt on a compare. address offset $0028 bit 7 654321 bit 0 read: bken bkfull bkbdm bktag 0000 write: reset: 00000000 = reserved or unimplemented f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 554 breakpoint (bkp) motorola bktag ?breakpoint on tag this bit controls whether the breakpoint will cause a break on the next instruction boundary (force) or on a match that will be an executable opcode (tagged). non-executed opcodes cannot cause a tagged breakpoint 1 = on match, break if the match is an instruction that will be executed (tagged). 0 = on match, break at the next instruction boundary (force). breakpoint control register 1 (bkpct1) this register is used to control the breakpoint logic that resides within the core. read and write: anytime. bk0mbh:bk0mbl breakpoint mask high byte and low byte for first address in dual address or full breakpoint mode, these bits may be used to mask (disable) the comparison of the high and low bytes of the first address breakpoint. the functionality is as given in table 102 below. address offset $0029 bit 7 6 5 4 3 2 1 bit 0 read: bk0mbh bk0mbl bk1mbh bk1mbl bk0rwe bk0rw bk1rwe bk1rw write: reset: 0 0 0 0 0 0 0 0 table 102 breakpoint mask bits for first address bk0mbh:bk0mbl address compare bkp0x bkp0h bkp0l x:0 full address compare ye s (1) ye s ye s 0:1 256 byte address range ye s (1) ye s n o 1:1 16k byte address range ye s (1) no no 1. if page is selected. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) register descriptions mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 555 the x:0 case is for a full address compare. when a program page is selected, the full address compare will be based on bits for a 20-bit compare. the registers used for the compare are {bkp0x[5:0],bkp0h[5:0],bkp0l[7:0]}. when a program page is not selected the full address compare will be based on bits for a 16-bit compare. the registers used for the compare are {bkp0h[7:0],bkp0l[7:0]}. the 1:0 case is not sensible because it would ignore the high order address and compare the low order and expansion addresses. logic forces this case to compare all address lines (effectively ignoring the bk0mbh control bit). the 1:1 case is useful for triggering a breakpoint on any access to a particular expansion page. this only makes sense if a program page is being accessed so that the breakpoint trigger will only occur if bkp0x compares. bk1mbh:bk1mbl breakpoint mask high byte and low byte of data (second address) in dual address mode, these bits may be used to mask (disable) the comparison of the high and/or low bytes of the second address breakpoint. the functionality is as given in table 103 below. the x:0 case is for a full address compare. when a program page is selected the full address compare will be based on bits for a 20-bit compare. the registers used for the compare are {bkp1x[5:0],bkp1h[5:0],bkp1l[7:0]}. when a program page is not selected the full address compare will be based on bits for a 16-bit compare. the registers used for the compare are {bkp1h[7:0],bkp1l[7:0]}. table 103 breakpoint mask bits for second address (dual address mode) bk1mbh:bk1mbl address compare bkp1x bkp1h bkp1l x:0 full address compare ye s (1) ye s ye s 0:1 256 byte address range ye s (1) ye s n o 1:1 16k byte address range ye s (1) no no 1. if page is selected. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 556 breakpoint (bkp) motorola the 1:0 case is not sensible because it would ignore the high order address and compare the low order and expansion addresses. logic forces this case to compare all address lines (effectively ignoring the bk1mbh control bit). the 1:1 case is useful for triggering a breakpoint on any access to a particular expansion page. this only makes sense if a program page is being accessed so that the breakpoint trigger will only occur if bkp1x compares. in full breakpoint mode, these bits may be used to mask (disable) the comparison of the high and/or low bytes of the data breakpoint. the functionality is as given in table 104 below. bk0rwe ?r/ w compare enable enables the comparison of the r/ w signal for first address breakpoint. this bit is not useful in tagged breakpoints. 1 = r/ w is used in comparisons. 0 = r/ w is not used in the comparisons. bk0rw?r/ w compare value when bk0rwe=1, this bit determines the type of bus cycle to match on first address breakpoint. when bk0rwe=0, this bit has no effect. 1 = read cycle will be matched 0 = write cycle will be matched. table 104 breakpoint mask bits for data breakpoints (full breakpoint mode) bk1mbh:bk1mbl data compare bkp1x bkp1h bkp1l 0:0 high and low byte compare no (1) ye s ye s 0:1 high byte no (1) ye s n o 1:0 low byte no (1) no yes 1:1 no compare no (1) no no 1. expansion addresses for breakpoint 1 are not available in this mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) register descriptions mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 557 bk1rwe ?r/ w compare enable in dual address mode, this bit enables the comparison of the r/ w signal to further specify what causes a match for the second address breakpoint. this bit is not useful on tagged breakpoints or in full breakpoint mode and is therefore a don? care. 1 = r/ w is used in comparisons. 0 = r/ w is not used in comparisons. bk1rw ?r/ w compare value when bk1rwe=1, this bit determines the type of bus cycle to match on the second address breakpoint.when bk1rwe=0, this bit has no effect. 1 = read cycle will be matched. 0 = write cycle will be matched. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 558 breakpoint (bkp) motorola breakpoint first address expansion register (bkp0x) this register contains the data to be matched against expansion address lines for the first address breakpoint when a page is selected. read and write: anytime. bk0v[5:0] ?first address breakpoint expansion address value breakpoint first address high byte register (bkp0h ) this register is used to set the breakpoint when compared against the high byte of the address. read and write: anytime breakpoint first address low byte register (bkp0l ) this register is used to set the breakpoint when compared against the low byte of the address. read and write: anytime address offset $002a bit 7 6 5 4 3 2 1 bit 0 read: 0 0 bk0v5 bk0v4 bk0v3 bk0v2 bk0v1 bk0v0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented address offset $002b bit 7 6 5 4 3 2 1 bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: 00000000 address offset $002c bit 7 6 5 4 3 2 1 bit 0 read: bit 7 6 5 4 3 2 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) register descriptions mc9s12t64revision 1.1.1 motorola breakpoint (bkp) 559 breakpoint second address expansion register(bkp1x) in dual address mode, this register contains the data to be matched against expansion address lines for the second address breakpoint when a page is selected. in full breakpoint mode, this register is not used. read and write: anytime bk1v[5:0] ?second address breakpoint expansion address value breakpoint data (second address) high byte register (bkp1h ) in dual address mode, this register is used to compare against the high order address lines. in full breakpoint mode, this register is used to compare against the high order data lines. read and write: anytime breakpoint data (second address) low byte register (bkp1l) in dual address mode, this register is used to compare against the low order address lines. in full breakpoint mode, this register is used to compare against the low order data lines. read and write: anytime address offset $002d bit 7 6 5 4 3 2 1 bit 0 read: 0 0 bk1v5 bk1v4 bk1v3 bk1v2 bk1v1 bk1v0 write: reset: 0 0 0 0 0 0 0 0 = reserved or unimplemented address offset $002e bit 7 6 5 4 3 2 1 bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 address offset $002f bit 7 6 5 4321 bit 0 read: bit 7 6 5 4321 bit 0 write: reset: 0 0 0 00000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
breakpoint (bkp) mc9s12t64revision 1.1.1 560 breakpoint (bkp) motorola breakpoint priority breakpoint operation is first determined by the state of bdm. if bdm is already active, meaning the cpu is executing out of bdm firmware, breakpoints are not allowed. in addition, while in bdm trace mode, tagging into bdm is not allowed. if bdm is not active, the breakpoint will give priority to bdm requests over swi requests. this condition applies to both forced and tagged breakpoints. in all cases, bdm related breakpoints will have priority over those generated by the breakpoint sub-block. this priority includes breakpoints enabled by the taglo and taghi external pins of the system that interface with the bdm directly and whose signal information passes through and is used by the breakpoint sub-block.enabled. note: bdm should not be entered from a breakpoint unless the enable bit is set in the bdm. even if the enable bit in the bdm is negated, the cpu actually executes the bdm rom code. it checks the enable and returns if enable is not set. if the bdm is not serviced by the monitor, then the breakpoint would be re-asserted when the bdm returns to normal cpu flow. there is no hardware to enforce restriction of breakpoint operation if the bdm is not enabled. reset initialization the reset state of each individual bit is listed within the register description section, which details the registers and their bit-fields. all registers are reset by the system reset. interrupts the bkp sub-block causes the cpu to generate swi interrupts when bkbdm bit is equal to zero. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola electrical characteristics 561 electrical characteristics contents general . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 atd characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 flash eeprom characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 voltage regulator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . 577 reset, oscillator and pll characteristics. . . . . . . . . . . . . . . . . . . . . 578 spi timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 external bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 general note: the electrical characteristics given in this section are preliminary and should be used as a guide only. values cannot be guaranteed by motorola and are subject to change without notice. this section contains the most accurate electrical information for the mc9s12t64 microcontroller available at the time of publication. the information should be considered preliminary and is subject to change. this introduction is intended to give an overview on several common topics like power supply, current injection etc. power supply the mc9s12t64 utilizes several pins to supply power to the i/o ports, a/d converter, oscillator and pll as well as the digital core. the vdda, vssa pair supplies the a/d converter and the resistor ladder of the internal voltage regulator. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 562 electrical characteristics motorola the vddx, vssx, vddr and vssr pairs supply the i/o pins. vddr supplies also the internal voltage regulator. vdd1, vss1, vdd2 and vss2 are the supply pins for the digital logic, vddpll, vsspll supply the oscillator and the pll. vss1 and vss2 are internally connected by metal. vdda, vddx, vddr as well as vssa, vssx, vssr are connected by anti-parallel diodes for esd protection. note: in the following context vdd5 is used for either vdda, vddr and vddx; vss5 is used for either vssa, vssr and vssx unless otherwise noted. idd5 denotes the sum of the currents flowing into the vdda, vddx and vddr pins. vdd is used for vdd1, vdd2 and vddpll, vss is used for vss1, vss2 and vsspll. idd is used for the sum of the currents flowing into vdd1 and vdd2. pins there are four groups of functional pins. 5v i/o pins those i/o pins have a nominal level of 5v. this class of pins is comprised of all port i/o pins, the analog inputs, bkgd and the reset pins.the internal structure of all those pins is identical, however some of the functionality may be disabled. e.g. for the analog inputs the output drivers, pull-up and pull-down resistors are disabled permanently. analog reference this group is made up by the vrh and vrl pins. oscillator the pins xfc, extal, xtal dedicated to the oscillator have a nominal 2.5v level. they are supplied by vddpll. test this pin is used for production testing only. vregen this pin is used to enable the on chip voltage regulator. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics general mc9s12t64revision 1.1.1 motorola electrical characteristics 563 current injection power supply must maintain regulation within operating v dd5 or v dd range during instantaneous and operating maximum current conditions. if positive injection current (v in >v dd5 ) is greater than i dd5 , the injection current may flow out of vdd5 and could result in external power supply going out of regulation. ensure external vdd5 load will shunt current greater than maximum injection current. this will be the greatest risk when the mcu is not consuming power; e.g. if no system clock is present, or if clock rate is very low which would reduce overall power consumption. absolute maximum ratings absolute maximum ratings are stress ratings only. a functional operation under or outside those maxima is not guaranteed. stress beyond those limits may affect the reliability or cause permanent damage of the device. this device contains circuitry protecting against damage due to high static voltage or electrical fields; however, it is advised that normal precautions be taken to avoid application of any voltages higher than maximum-rated voltages to this high-impedance circuit. reliability of f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 564 electrical characteristics motorola operation is enhanced if unused inputs are tied to an appropriate logic voltage level (e.g., either v ss5 or v dd5 ). operating conditions this chapter describes the operating conditions of the device. unless otherwise noted those conditions apply to all the following data. note: please refer to the temperature rating of the device (c, v, m) with regards to the ambient temperature t a and the junction temperature t j . table 105 absolute maximum ratings (1) num rating symbol min max unit 1 i/o, regulator and analog supply voltage v dd5 ?.3 6.0 v 2 digital logic supply voltage (2) v dd ?.3 3.0 v 3 pll supply voltage (2) v ddpll ?.3 3.0 v 4 voltage difference vddx to vddr and vdda ? vddx ?.3 0.3 v 5 voltage difference vssx to vssr and vssa ? vssx ?.3 0.3 v 6 digital i/o input voltage v in ?.3 6.0 v 7 analog reference v rh, v rl ?.3 6.0 v 8 xfc, extal, xtal inputs v ilv ?.3 3.0 v 9 test input v test ?.3 10.0 v 10 instantaneous maximum current single pin limit for all digital i/o pins (3) i d ?5 +25 ma 11 instantaneous maximum current single pin limit for xfc, extal, xtal (4) i dl ?5 +25 ma 12 instantaneous maximum current single pin limit for test (5) i dt ?.25 0 ma 13 storage temperature range t stg ?5 155 ?c 1. functional operation beyond absolute maximum ratings might damage the device. 2. the device contains an internal voltage regulator to generate the logic and pll supply out of the i/o supply. the absolute maximum ratings apply when the device is powered from an external source. 3. all digital i/o pins are internally clamped to v ssx and v ddx , v ssr and v ddr or v ssa and v dda . 4. those pins are internally clamped to v sspll and v ddpll 5. this pin is clamped low to v sspll , but not clamped high. this pin must be tied low in applications. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics general mc9s12t64revision 1.1.1 motorola electrical characteristics 565 for power dissipation calculations refer to the subsection power dissipation and thermal characteristics . power dissipation and thermal characteristics power dissipation and thermal characteristics are closely related. the user must assure that the maximum operating junction temperature is not exceeded. the average chip-junction temperature (t j ) in ?c can be obtained from: table 106 operating conditions rating symbol min typ max unit i/o, regulator and analog supply voltage v dd5 4.75 5 5.25 v digital logic supply voltage (1) v dd 2.25 2.5 2.75 v pll supply voltage (2) v ddpll 2.25 2.5 2.75 v voltage difference vddx to vddr and vdda ? vddx ?.1 0 0.1 v voltage difference vssx to vssr and vssa ? vssx ?.1 0 0.1 v oscillator f osc 2 16 mhz bus frequency f bus (1/t bus ) 1 16.0 mhz mc9s12t64 c operating ambient temperature range (2) operating junction temperature range t a t j ?0 ?0 27 85 100 ?c mc9s12t64 v operating ambient temperature range (2) operating junction temperature range t a t j ?0 ?0 27 105 120 ?c mc9s12t64 m operating ambient temperature range (2) operating junction temperature range t a t j ?0 ?0 27 125 140 ?c 1. the device contains an internal voltage regulator to generate the logic and pll supply out of the i/o supply. the absolute maximum ratings apply when this regulator is disabled and the device is powered from an external source. 2. please refer to the subsection power dissipation and thermal characteristics for more details about the relation between ambient temperature t a and device junction temperature t j . t j t a p d ja ? () + = t j junction temperature, [ c ] = t a ambient temperature, [ c ] = p d total chip power dissipation, [w] = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 566 electrical characteristics motorola the total power dissipation can be calculated from: two cases with internal voltage regulator enabled and disabled must be considered: 1. internal voltage regulator disabled p io is the sum of all output currents on i/o ports associated with vddx and vddr. for r dson is valid: respectively 2. internal voltage regulator enabled i ddr is the current shown in table 109 and not the overall current flowing into vddr, which additionally contains the current flowing into the external loads with output high. p io is the sum of all output currents on i/o ports associated with vddx and vddr. ja package thermal resistance, [ c/w] = p d p int p io + = p int chip internal power dissipation, [w] = p int i dd v dd ? i ddpll v ddpll ? i dda +v dda ? + = p io r dson i i io i 2 ? = r dson v ol i ol ------------ for outputs driven low ; = r dson v dd5 v oh i oh ------------------------------------ for outputs driven high ; = p int i ddr v ddr ? i dda v dda ? + = p io r dson i i io i 2 ? = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics general mc9s12t64revision 1.1.1 motorola electrical characteristics 567 i/o characteristics this section describes the characteristics of all 5v i/o pins. all parameters are not always applicable, e.g. not all pins feature pull up/down resistances. table 107 thermal package characteristics (1) 1. the values for thermal resistance are achieved by package simulations num rating symbol min typ max unit 1 thermal resistance ja 51 ?c/w table 108 5v i/o characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 input high voltage v ih 0.70*v dd5 ? dd5 + 0.3 v 2 input low voltage v il v ss5 ?0.3 0.30*v dd5 v 3 input hysteresis v hys 250 mv 4 input leakage current (pins in high ohmic input mode) (1) v in = v dd5 or v ss5 i in ?.5 2.5 a 5 output high voltage (pins in output mode) partial drive i oh = ?.25ma full drive i oh = ?ma v oh v dd5 ?0.8 v 6 output low voltage (pins in output mode) partial drive i ol = +1.25ma full drive i ol = +3ma v ol 0.8 v 7 internal pull up device current, tested at v il max. i pul ?30 a 8 internal pull up device current, tested at v ih min. i puh ?0 a 9 internal pull down device current, tested at v ih min. i pdh 130 a 10 internal pull down device current, tested at v il max. i pdl 10 a 11 input capacitance c in 7pf 12 injection current (2) single pin limit total device limit. sum of all injected currents i ics i icp ?.5 ?5 2.5 25 ma f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 568 electrical characteristics motorola supply currents this section describes the current consumption characteristics of the device as well as the conditions for the measurements. measurement conditions all measurements are without output loads. unless otherwise noted the currents are measured in single chip mode, internal voltage regulator enabled and at 16mhz bus frequency using a 4mhz oscillator in colpitts mode. production testing is performed using a square wave signal at the extal input. additional remarks in expanded modes the currents flowing in the system are highly dependent on the load at the address, data and control signals as well as on the duty cycle of those signals. no generally applicable numbers can be given. a very good estimate is to take the single chip currents and add the currents due to the external loads. 1. maximum leakage current occurs at maximum operating temperature. current decreases by approximately one-half for each 8 c to 12 c in the temperature range from 50?c to 125?c. 2. refer to the subsection current injection (page 563 ), for more details table 109 supply current characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 run supply currents single chip mode i dd5 30 ma 2 wait supply current all modules enabled, pll on only rti enabled, pll off i ddw 25 10 ma 3 pseudo stop current (1) rti and cop enabled rti and cop disabled 1. pll off i ddps 500 250 7,000 6,500 a 4 stop current i dds 60 6,000 a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics atd characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 569 atd characteristics this section describes the characteristics of the analog to digital converter. atd operating characteristics the table 110 shows conditions under which the atd operates. the following constraints exist to obtain full-scale, full range results: v ssa v rl v in v rh v dda . this constraint exists since the sample buffer amplifier can not drive beyond the power supply levels that it ties to. if the input level goes outside of this range it will effectively be clipped. factors influencing accuracy two factors - source resistance and source capacitance - have an influence on the accuracy of the atd. table 110 atd operating characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 reference potential low high v rl v rh v ssa v dda /2 v dda /2 v dda v v 2 differential reference voltage (1) 1. full accuracy is not guaranteed when differential voltage is less than 4.75v v rh ? rl 4.75 5.0 5.25 v 3 atd clock frequency f atdclk 0.5 2.0 mhz 4 atd 10-bit conversion period clock cycles (2) conv, time at 2.0mhz atd clock f atdclk 2. the minimum time assumes a final sample period of 2 atd clocks cycles while the maximum time assumes a final sample period of 16 atd clocks. n conv10 t conv10 14 7 28 14 cycles s 5 atd 8-bit conversion period clock cycles (2) conv, time at 2.0mhz atd clock f atdclk n conv8 t conv8 12 6 26 13 cycles s 5 stop recovery time (v dda =5.0 volts) t sr 20 s 6 reference supply current i ref 0.75 ma f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 570 electrical characteristics motorola source resistance: due to the input pin leakage current as specified in table 108 in conjunction with the source resistance there will be a voltage drop from the signal source to the atd input. the maximum source resistance r s specifies results in an error of less than 1/2 lsb (2.5mv) at the maximum leakage current. if device or operating conditions are less than worst case or leakage-induced error is acceptable, larger values of source resistance is allowed. source capacitance when sampling an additional internal capacitor is switched to the input. this can cause a voltage drop due to charge sharing with the external and the pin capacitance. for a maximum sampling error of the input voltage 1lsb, then the external filter capacitor, c f 1024 * (c ins c inn ). atd accuracy table 112 specifies the atd conversion performance excluding any errors due to current injection, input capacitance and source resistance. table 111 atd electrical characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 max input source resistance r s 1k ? 2 total input capacitance non sampling sampling c inn c ins 10 15 pf 3 disruptive analog input current i na ?.5 2.5 ma f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics atd characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 571 for the following definitions see also figure 110 . differential non-linearity (dnl) is defined as the difference between two adjacent switching steps. the integral non-linearity (inl) is defined as the sum of all dnls: table 112 atd conversion performance conditions are shown in table 106 unless otherwise noted v ref = v rh ?v rl = 5.12v. resulting to one 8 bit count = 20mv and one 10 bit count = 5mv f atdclk = 2.0mhz num rating symbol min typ max unit 1 10-bit resolution lsb 5 mv 2 10-bit differential nonlinearity dnl ? 1 counts 3 10-bit integral nonlinearity inl ?.5 1.5 2.5 counts 4 10-bit absolute error (1) 1. these values include quantization error which is inherently 1/2 count for any a/d converter. ae ? 2.0 3 counts 5 8-bit resolution lsb 20 mv 6 8-bit differential nonlinearity dnl ?.5 0.5 counts 7 8-bit integral nonlinearity inl ?.0 0.5 1.0 counts 8 8-bit absolute error (1) ae ?.5 1.0 1.5 counts dnl i () v i v i1 1lsb ------------------------ 1 = inl n () dnl i () i1 = n v n v 0 1lsb ------------------- -n == f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 572 electrical characteristics motorola figure 110 atd accuracy definitions note: figure 110 shows only definitions, for specification values refer to table 112 . 1 5 vin mv 10 15 20 25 30 35 40 5085 5090 5095 5100 5105 5110 5115 5120 5065 5070 5075 5080 5060 0 3 2 5 4 7 6 50 $3f7 $3f9 $3f8 $3fb $3fa $3fd $3fc $3fe $3ff $3f4 $3f6 $3f5 8 9 1 2 $ff $fe $fd $3f3 10-bit resolution 8-bit resolution ideal transfer curve 10-bit transfer curve 8-bit transfer curve 5055 10-bit absolute error boundary 8-bit absolute error boundary lsb v i-1 v i dnl f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics flash eeprom characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 573 flash eeprom characteristics flash eeprom timing the time base for all flash eeprom program or erase operations is derived from the oscillator. a minimum oscillator frequency f nvmosc is required for performing program or erase operations. the flash eeprom module does not have any means to monitor the frequency and will not prevent program or erase operation at frequencies above or below the specified minimum. attempting to program or erase the flash eeprom module at a lower frequency a full program or erase transition is not assured. the flash eeprom program and erase operations are timed using a clock derived from the oscillator using the fclkdiv register. the frequency of this clock must be set within the limits specified as f nvmop . the minimum program and erase times shown in table 113 are calculated for maximum f nvmop and maximum f bus . the maximum times are calculated for minimum f nvmop and minimum f bus . single word programming the programming time for single word programming is dependant on the bus frequency as a well as on the frequency f nvmop and can be calculated according to the following formula. burst programming this applies only to the flash where up to 32 words in a row can be programmed consecutively using burst programming by keeping the command pipeline filled. the time to program a consecutive word can be calculated as: the time to program a whole row is: t swpgm 9 1 f nvmop --------------------- ? 25 1 f bus ---------- ? + = t bwpgm 4 1 f nvmop --------------------- ? 9 1 f bus ---------- ? + = f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 574 electrical characteristics motorola burst programming is more than 2 times faster than single word programming. sector erase erasing a 512 byte flash sector or a 4 byte eeprom sector takes: the setup times can be ignored for this operation. mass erase erasing a nvm block takes: the setup times can be ignored for this operation. blank check the time it takes to perform a blank check on the flash is dependent on the location of the first non-blank word starting at relative address zero. it takes one bus cycle per word to verify plus a setup of the command. t brpgm t swpgm 31 t bwpgm ? + = t era 4000 1 f nvmop --------------------- ? t mass 20000 1 f nvmop --------------------- ? ; */,*2 36*(;065 ; )<: ? ? ; )<: ? + ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics flash eeprom characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 575 nvm reliability the reliability of the nvm blocks is guaranteed by stress test during qualification, constant process monitors and burn-in to screen early life failures. the program/erase cycle count on the sector is incremented every time a sector or mass erase event is executed. note: all values shown in table 114 are target values and subject to further extensive characterization. table 113 nvm timing characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 external oscillator clock f nvmosc 216 (1) 1. restrictions for oscillator in crystal mode apply! mhz 2 bus frequency for programming or erase operations f nvmbus 1mhz 3 operating frequency f nvmop 150 200 khz 4 single word programming time t swpgm 46 (2) 2. minimum programming times are achieved under maximum nvm operating frequency f nvmop and maximum bus frequen- cy f bus . 85 (3) 3. maximum erase and programming times are achieved under particular combinations of f nvmop and bus frequency f bus . refer to formulae in subsections from single word programming through mass erase for guidance. s 5 flash burst programming time for consecutive word t bwpgm 20.4 (2) 35.7 (3) s 6 flash burst programming time for 32 words t brpgm 678.4 (2) 1190.7 (3) s 7 sector erase time t era 20 (4) 4. minimum erase times are achieved under maximum nvm operating frequency f nvmop . 26.7 (3) ms 8 mass erase time t mass 100 (4) 133 (3) ms 9 blank check time per block t check 11 (5) 5. minimum time. if first word in the array is not blank. 32778 (6) 6. maximum time to complete check on erased block. t bus f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 576 electrical characteristics motorola table 114 nvm reliability characteristics conditions are shown in table 106 unless otherwise noted num rating symbol unit 1 data retention at an average junction temperature of t javg = 65?c t nvmret 10 years 2 flash number of program/erase cycles n flpe 100 cycles f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics voltage regulator characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 577 voltage regulator characteristics the on-chip voltage regulator is intended to supply the internal logic and oscillator circuits. no external dc load is allowed. table 115 voltage regulator recommended load capacitance rating symbol min typ max unit load capacitance on vdd1, 2 c lvdd 220 nf load capacitance on vddpll c lvpll 220 nf f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 578 electrical characteristics motorola reset, oscillator and pll characteristics this section summarizes the electrical characteristics of the various startup scenarios for oscillator and phase-locked-loop (pll). startup table 116 summarizes several startup characteristics explained in this section. detailed description of the startup behavior can be found in the clocks and reset generator (crg) section in page 271 . por and low-voltage detector (lvd) reset the release level v lvrr and the detection level v lvr are derived from the v ddr , while the rearm level v por is derived from the v dd . they are also valid if the device is powered externally. external reset when external reset is asserted for a time greater than pw rstl the crg module generates an internal reset, and the cpu starts fetching the table 116 startup characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 reset input pulse width, minimum input time pw rstl 2t osc 2 startup from reset n rst 192 196 n osc 3 interrupt pulse width, irq edge-sensitive mode pw irq 20 ns 4 wait recovery startup time t wrs 14 t bus 5 low-voltage detector reset release level v lvrr 4.75 v 6 low voltage detection level v lv r 3.9 v 7 low-voltage detector reset/recover hysteresis v lvhys 200 mv 8 por rearm level (1) 1. maximum is highest voltage that por is guaranteed. v por 0 100 mv 9 por rise time ramp rate (2) 2. if minimum v dd is not reached before the internal por reset is released, reset must be driven low externally until mini- mum v dd is reached. r por 0.035 v/ms f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics reset, oscillator and pll characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 579 reset vector without doing a clock quality check, if there was an oscillation before reset. stop recovery out of stop the controller can be woken up by an external interrupt. a clock quality check as after por is performed before releasing the clocks to the system. pseudo stop and wait recovery the recovery from pseudo stop and wait are essentially the same since the oscillator was not stopped in both modes. the controller can be woken up by internal or external interrupts. after t wrs the cpu starts fetching the interrupt vector. oscillator the device features internal colpitts and pierce oscillators. by asserting the xclks input during reset the colpitts oscillator can be bypassed allowing the input of a square wave or the pierce oscillator. before asserting the oscillator to the internal system clocks the quality of the oscillation is checked for each start from either power-on, lvd reset, stop or oscillator fail. t cqout specifies the maximum time before switching to the internal self clock mode after por/lvdr or stop if a proper oscillation is not detected. the fastest startup time possible is given by n uposc . the quality check also determines the minimum oscillator start-up time t uposc . the device also features a clock monitor. a clock monitor failure is asserted if the frequency of the incoming clock signal is below the clock monitor failure assert frequency f cmfa . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 580 electrical characteristics motorola table 117 oscillator characteristics (1) 1. when colpitts oscillator is selected during reset. conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 crystal oscillator range (colpitts) f osc 216mhz 2 startup current i osc 100 a 3 oscillator start-up time (2) 2. the oscillator start-up time is measured as the time necessary to detect a stable eclk on pin pe4 after por. t uposc 8 (3) 3. f osc = 4mhz, c = 22pf 400 (4) 4. maximum value is for extreme cases using high q, low frequency crystals ms 4 clock quality check time-out t cqout 0.45 2.5 s 5 clock monitor failure assert frequency f cmfa 50 100 200 khz 6 external square wave input frequency (5) 5. xclks =0 during reset f ext 232mhz 7 external square wave pulse width low t extl 30 ns 8 external square wave pulse width high t exth 30 ns 9 external square wave rise time t extr 1ns 10 external square wave fall time t extf 1ns 11 input capacitance (extal, xtal inputs) c in 9pf 12 dc operating bias in colpitts con?uration on extal pin v dcbias 1.1 v f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics reset, oscillator and pll characteristics mc9s12t64revision 1.1.1 motorola electrical characteristics 581 phase locked loop the oscillator provides the reference clock for the pll. the plls voltage controlled oscillator (vco) is also the system clock source in self clock mode. xfc component selection this section describes the selection of the xfc components to achieve a good filter characteristics. motorola suggest the use of the following values r= 2.2 k ? , cs=33 nf, and cp = 3.3 nf when f ref = 4mhz, f bus = 16mhz, f vco = 32mhz, refdv = #$00, and synr = #$03. see figure 111 . these values are preliminary and should be used as a guide only. values cannot be guaranteed by motorola and are subject to change without notice. figure 111 pll loop filter connections mcu xfc r s c s vddpll c p f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 582 electrical characteristics motorola spi timing master mode figure 112 and figure 113 illustrate the master mode timing. timing values are shown in table 119 . table 118 pll characteristics conditions are shown in table 106 unless otherwise noted num rating symbol min typ max unit 1 self clock mode frequency f scm 3mhz 2 vco locking range f vco 832mhz 3 pll lock time (1) t lock 1ms 4 jitter (2) short term (5 s interval) long term (5 00 s interval) j short j long ?.26 ?.05 0.26 0.05 % 1. lock time is defined as the time necessary for the pll to have its lock bit asserted after its multiplication factor was changed. 2. jitter is defined as the average deviation from the programmed target frequency measured over an specific time interval (5 s or 500 s) at maximum f vco .   ? + ?? ?    ? + ?? ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics spi timing mc9s12t64revision 1.1.1 motorola electrical characteristics 583 figure 112 spi master timing (cpha = 0) figure 113 spi master timing (cpha =1) sck (output) sck (output) miso (input) mosi (output) ss 1 (output) 1 9 5 6 msb in 2 bit 6 . . . 1 lsb in msb out 2 lsb out bit 6 . . . 1 10 4 4 2 9 (cpol = 0) (cpol = 1) 3 11 12 1. if configured as output. 2. lsbf = 0. for lsbf = 1, bit order is lsb, bit 1, ..., bit 6, msb. sck (output) sck (output) miso (input) mosi (output) 1 5 6 msb in 2 bit 6 . . . 1 lsb in master msb out 2 master lsb out bit 6 . . . 1 4 4 9 11 12 10 port data (cpol = 0) (cpol = 1) port data ss 1 (output) 2 12 11 3 1. if configured as output 2. lsbf = 0. for lsbf = 1, bit order is lsb, bit 1, ..., bit 6, msb. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 584 electrical characteristics motorola slave mode figure 114 and figure 115 illustrate the slave mode timing. timing values are shown in table 120 . table 119 spi master mode timing characteristics (1) 1. the numbers 7, 8 in the column labeled ?um are missing. this has been done on purpose to be consistent between the master and the slave timing shown in table 120 . conditions are shown in table 106 unless otherwise noted, cload = 200pf on all outputs num rating symbol min typ max unit 1 operating frequency f op dc 1 / 4 f bus 1 sck period t sck = 1/ f op t sck 4 2048 t bus 2 enable lead time t lead 1 / 2 t sck 3 enable lag time t lag 1 / 2 t sck 4 clock (sck) high or low time t wsck t bus ? 30 1024 t bus ns 5 data setup time (inputs) t su 25 ns 6 data hold time (inputs) t hi 0ns 9 data valid (after sck edge) t v 25 ns 10 data hold time (outputs) t ho 0ns 11 rise time inputs and outputs t r 25 ns 12 fall time inputs and outputs t f 25 ns f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics spi timing mc9s12t64revision 1.1.1 motorola electrical characteristics 585 figure 114 spi slave timing (cpha = 0) figure 115 spi slave timing (cpha =1) sck (input) sck (input) mosi (input) miso (output) ss (input) 1 9 5 6 msb in bit 6 . . . 1 lsb in msb out slave lsb out bit 6 . . . 1 10 4 4 2 7 (cpol = 0) (cpol = 1) 3 12 slave 12 11 10 11 8 sck (input) sck (input) mosi (input) miso (output) 1 5 6 msb in bit 6 . . . 1 lsb in msb out slave lsb out bit 6 . . . 1 4 4 9 11 12 10 (cpol = 0) (cpol = 1) ss (input) 2 12 11 3 slave 7 8 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 586 electrical characteristics motorola table 120 spi slave mode timing characteristics conditions are shown in table 106 unless otherwise noted, cload = 200pf on all outputs num rating symbol min typ max unit 1 operating frequency f op dc 1 / 4f bus 1 sck period f sck = 1 / f op t sck 4 2048 t bus 2 enable lead time t lead 1t bus 3 enable lag time t lag 1t bus 4 clock (sck) high or low time t wsck t bus ? 30 ns 5 data setup time (inputs) t su 25 ns 6 data hold time (inputs) t hi 25 ns 7 slave access time t a 1t bus 8 slave miso disable time t dis 1t bus 9 data valid (after sck edge) t v 25 ns 10 data hold time (outputs) t ho 0ns 11 rise time inputs and outputs t r 25 ns 12 fall time inputs and outputs t f 25 ns f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics external bus timing mc9s12t64revision 1.1.1 motorola electrical characteristics 587 external bus timing a timing diagram of the external multiplexed-bus is illustrated in figure 116 with the actual timing values shown on table table 121 . all major bus signals are included in the diagram. while both a data write and data read cycle are shown, only one or the other would occur on a particular bus cycle. general muxed bus timing the expanded bus timings are highly dependent on the load conditions. the timing parameters shown assume a balanced load across all outputs. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 588 electrical characteristics motorola figure 116 general external bus timing addr/data (read) addr/data (write) addr data data 5 10 11 8 16 6 eclk 1, 2 3 4 addr data data 12 15 9 7 14 13 ecs 21 20 22 23 lstrb 29 no a cc 32 ipipe[1:0] pe[6:5] 35 27 28 30 33 36 31 34 r/ w 24 26 25 pe4 pa, pb pa, pb pk7 pe2 pe3 pe7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics external bus timing mc9s12t64revision 1.1.1 motorola electrical characteristics 589 table 121 expanded bus timing characteristics ?16mhz conditions are shown in table 106 unless otherwise noted, c load = 50pf num rating symbol min typ max unit 1 frequency of operation (e-clock) f o 0 16.0 mhz 2 cycle time t cyc 62.5 ns 3 pulse width, e low pw el 29 ns 4 pulse width, e high (1) pw eh 29 ns 5 address delay time t ad 18 ns 6 address valid time to e rise (pw el ? ad )t av 11 ns 7 muxed address hold time t mah ? ns 8 address hold to data valid t ahds 9ns 9 data hold to address t dha ? ns 10 read data setup time t dsr 25 ns 11 read data hold time t dhr ? ns 12 write data delay time t ddw 16 ns 13 write data hold time t dhw ? ns 14 write data setup time (1) (pw eh ? ddw )t dsw 13 ns 15 address access time (1) (t cyc ? ad ? dsr )t acca 19 ns 16 e high access time (1) (pw eh ? dsr )t acce 4ns 20 chip select delay time t csd 20 ns 21 chip select access time (1) (t cyc ? csd ? dsr )t accs 17 ns 22 chip select hold time t csh ? ns 23 chip select negated time t csn 11 ns 24 read/write delay time t rwd 15 ns 25 read/write valid time to e rise (pw el ? rwd )t rwv 14 ns 26 read/write hold time t rwh ? ns 27 low strobe delay time t lsd 15 ns 28 low strobe valid time to e rise (pw el ? lsd )t lsv 14 ns 29 low strobe hold time t lsh ? ns 30 noacc strobe delay time t nod 14 ns 31 noacc valid time to e rise (pw el ? nod )t nov 15 ns 32 noacc hold time t noh ? ns 33 eclk low to ipipe[1:0] delay time t p0d 012ns 34 ipipe[1:0] valid time to e rise (pw el ? p0d )t p0v 16 ns f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
electrical characteristics mc9s12t64revision 1.1.1 590 electrical characteristics motorola 35 eclk high to ipipe[1:0] delay time (1) (pw eh ? p1v ) t p1d 040ns 36 ipipe[1:0] valid time to e fall t p1v 16 ns 1. affected by clock stretch: add n x t cyc where n=0,1,2 or 3, depending on the number of clock stretches. table 121 expanded bus timing characteristics ?16mhz (continued) conditions are shown in table 106 unless otherwise noted, c load = 50pf f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola 591 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 592 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola 593 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 594 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc9s12t64revision 1.1.1 motorola glossary 595 glossary a ?see ?ccumulators (a and b or d). accumulators (a and b or d) two 8-bit (a and b) or one 16-bit (d) general-purpose registers in the cpu. the cpu uses the accumulators to hold operands and results of arithmetic and logic operations. acquisition mode ?a mode of pll operation with large loop bandwidth. also see ?racking mode? address bus the set of wires that the cpu or dma uses to read and write memory locations. addressing mode the way that the cpu determines the operand address for an instruction. the m68hc12 cpu has 15 addressing modes. alu ?see ?rithmetic logic unit (alu). analogue-to-digital converter (atd) ?the atd module is an 8-channel, multiplexed-input successive-approximation analog-to-digital converter. arithmetic logic unit (alu) the portion of the cpu that contains the logic circuitry to perform arithmetic, logic, and manipulation operations on operands. asynchronous refers to logic circuits and operations that are not synchronized by a common reference signal. atd ?see ?nalogue-to-digital converter? b ?see ?ccumulators (a and b or d). baud rate ?the total number of bits transmitted per unit of time. bcd ?see ?inary-coded decimal (bcd). binary ?relating to the base 2 number system. binary number system ?the base 2 number system, having two digits, 0 and 1. binary arithmetic is convenient in digital circuit design because digital circuits have two permissible voltage levels, low and high. the binary digits 0 and 1 can be interpreted to correspond to the two digital voltage levels. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 596 glossary motorola binary-coded decimal (bcd) a notation that uses 4-bit binary numbers to represent the 10 decimal digits and that retains the same positional structure of a decimal number. for example, 234 (decimal) = 0010 0011 0100 (bcd) bit ?a binary digit. a bit has a value of either logic 0 or logic 1. branch instruction an instruction that causes the cpu to continue processing at a memory location other than the next sequential address. break module ?the break module allows software to halt program execution at a programmable point in order to enter a background routine. breakpoint ?a number written into the break address registers of the break module. when a number appears on the internal address bus that is the same as the number in the break address registers, the cpu executes the software interrupt instruction (swi). break interrupt ?a software interrupt caused by the appearance on the internal address bus of the same value that is written in the break address registers. bus ?a set of wires that transfers logic signals. bus clock ?see ?pu clock? byte ?a set of eight bits. can ?see ?otorola scalable can. ccr ?see ?ondition code register. central processor unit (cpu) ?the primary functioning unit of any computer system. the cpu controls the execution of instructions. cgm ?see ?lock generator module (cgm). clear ?to change a bit from logic 1 to logic 0; the opposite of set. clock ?a square wave signal used to synchronize events in a computer. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 motorola glossary 597 clock generator module (cgm) the cgm module generates a base clock signal from which the system clocks are derived. the cgm may include a crystal oscillator circuit and/or phase-locked loop (pll) circuit. comparator a device that compares the magnitude of two inputs. a digital comparator defines the equality or relative differences between two binary numbers. computer operating properly module (cop) ?a counter module that resets the mcu if allowed to overflow. condition code register (ccr) an 8-bit register in the cpu that contains the interrupt mask bit and five bits that indicate the results of the instruction just executed. control bit ?one bit of a register manipulated by software to control the operation of the module. control unit one of two major units of the cpu. the control unit contains logic functions that synchronize the machine and direct various operations. the control unit decodes instructions and generates the internal control signals that perform the requested operations. the outputs of the control unit drive the execution unit, which contains the arithmetic logic unit (alu), cpu registers, and bus interface. cop ?see ?omputer operating properly module (cop). cpu ?see ?entral processor unit (cpu). cpu12 ?the cpu of the mc68hc12 family. cpu clock ?bus clock select bits bcsp and bcss in the clock select register (clksel) determine which clock drives sysclk for the main system, including the cpu and buses. when extali drives the sysclk, the cpu or bus clock frequency (f o ) is equal to the extali frequency divided by 2. cpu cycles a cpu cycle is one period of the internal bus clock, normally derived by dividing a crystal oscillator source by two or more so the high and low times will be equal. the length of time required to execute an instruction is measured in cpu clock cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 598 glossary motorola cpu registers ?memory locations that are wired directly into the cpu logic instead of being part of the addressable memory map. the cpu always has direct access to the information in these registers. the cpu registers in an m68hc12 are: a (8-bit accumulator) b (8-bit accumulator) d (16-bit accumulator formed by concatenation of accumulators a and b) ix (16-bit index register) iy (16-bit index register) sp (16-bit stack pointer) pc (16-bit program counter) ccr (8-bit condition code register) cycle time ?the period of the operating frequency: t cyc = 1/f op . d ?see ?ccumulators (a and b or d). decimal number system base 10 numbering system that uses the digits zero through nine. duty cycle a ratio of the amount of time the signal is on versus the time it is off. duty cycle is usually represented by a percentage. ect ?see ?nhanced capture timer. eeprom ?electrically erasable, programmable, read-only memory. a nonvolatile type of memory that can be electrically erased and reprogrammed. eprom erasable, programmable, read-only memory. a nonvolatile type of memory that can be erased by exposure to an ultraviolet light source and then reprogrammed. enhanced capture timer (ect) the hc12 enhanced capture timer module has the features of the hc12 standard timer module enhanced by additional features in order to enlarge the field of applications. exception an event such as an interrupt or a reset that stops the sequential execution of the instructions in the main program. fetch ?to copy data from a memory location into the accumulator. firmware ?instructions and data programmed into nonvolatile memory. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 motorola glossary 599 flash eeprom ?electrically erasable, programmable, read-only memory. a nonvolatile type of memory that can be electrically erased and reprogrammed. does not support byte or word erase. free-running counter a device that counts from zero to a predetermined number, then rolls over to zero and begins counting again. full-duplex transmission ?communication on a channel in which data can be sent and received simultaneously. hexadecimal ?base 16 numbering system that uses the digits 0 through 9 and the letters a through f. high byte ?the most significant eight bits of a word. illegal address ?an address not within the memory map illegal opcode ?a nonexistent opcode. index registers (ix and iy) ?two 16-bit registers in the cpu. in the indexed addressing modes, the cpu uses the contents of ix or iy to determine the effective address of the operand. ix and iy can also serve as a temporary data storage locations. input/output (i/o) input/output interfaces between a computer system and the external world. a cpu reads an input to sense the level of an external signal and writes to an output to change the level on an external signal. instructions operations that a cpu can perform. instructions are expressed by programmers as assembly language mnemonics. a cpu interprets an opcode and its associated operand(s) and instruction. interrupt ?a temporary break in the sequential execution of a program to respond to signals from peripheral devices by executing a subroutine. interrupt request ?a signal from a peripheral to the cpu intended to cause the cpu to execute a subroutine. i/o ?see ?nput/output (i/0). jitter ?short-term signal instability. latch a circuit that retains the voltage level (logic 1 or logic 0) written to it for as long as power is applied to the circuit. latency ?the time lag between instruction completion and data movement. least significant bit (lsb) ?the rightmost digit of a binary number. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 600 glossary motorola logic 1 ?a voltage level approximately equal to the input power voltage (v dd ). logic 0 ?a voltage level approximately equal to the ground voltage (v ss ). low byte ?the least significant eight bits of a word. m68hc12 ?a motorola family of 16-bit mcus. mark/space ?the logic 1/logic 0 convention used in formatting data in serial communication. mask 1. a logic circuit that forces a bit or group of bits to a desired state. 2. a photomask used in integrated circuit fabrication to transfer an image onto silicon. mcu ?microcontroller unit. see ?icrocontroller. memory location each m68hc12 memory location holds one byte of data and has a unique address. to store information in a memory location, the cpu places the address of the location on the address bus, the data information on the data bus, and asserts the write signal. to read information from a memory location, the cpu places the address of the location on the address bus and asserts the read signal. in response to the read signal, the selected memory location places its data onto the data bus. memory map ?a pictorial representation of all memory locations in a computer system. mi-bus see ?otorola interconnect bus? microcontroller microcontroller unit (mcu). a complete computer system, including a cpu, memory, a clock oscillator, and input/output (i/o) on a single integrated circuit. modulo counter a counter that can be programmed to count to any number from zero to its maximum possible modulus. most significant bit (msb) ?the leftmost digit of a binary number. motorola interconnect bus (mi-bus) ?the motorola interconnect bus (mi bus) is a serial communications protocol which supports distributed real-time control efficiently and with a high degree of noise immunity. motorola scalable can (mscan) the motorola scalable controller area network is a serial communications protocol that efficiently supports distributed real-time control with a very high level of data integrity. mscan see ?otorola scalable can? msi see ?ultiple serial interface? multiple serial interface a module consisting of multiple independent serial i/o sub-systems, e.g. two sci and one spi. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 motorola glossary 601 multiplexer a device that can select one of a number of inputs and pass the logic level of that input on to the output. nibble ?a set of four bits (half of a byte). object code the output from an assembler or compiler that is itself executable machine code, or is suitable for processing to produce executable machine code. opcode ?a binary code that instructs the cpu to perform an operation. open-drain ?an output that has no pullup transistor. an external pullup device can be connected to the power supply to provide the logic 1 output voltage. operand ?data on which an operation is performed. usually a statement consists of an operator and an operand. for example, the operator may be an add instruction, and the operand may be the quantity to be added. oscillator ?a circuit that produces a constant frequency square wave that is used by the computer as a timing and sequencing reference. otprom ?one-time programmable read-only memory. a nonvolatile type of memory that cannot be reprogrammed. overflow ?a quantity that is too large to be contained in one byte or one word. page zero ?the first 256 bytes of memory (addresses $0000?00ff). parity an error-checking scheme that counts the number of logic 1s in each byte transmitted. in a system that uses odd parity, every byte is expected to have an odd number of logic 1s. in an even parity system, every byte should have an even number of logic 1s. in the transmitter, a parity generator appends an extra bit to each byte to make the number of logic 1s odd for odd parity or even for even parity. a parity checker in the receiver counts the number of logic 1s in each byte. the parity checker generates an error signal if it finds a byte with an incorrect number of logic 1s. pc ?see ?rogram counter (pc). peripheral ?a circuit not under direct cpu control. phase-locked loop (pll) ?a clock generator circuit in which a voltage controlled oscillator produces an oscillation which is synchronized to a reference signal. pll ?see ?hase-locked loop (pll). pointer pointer register. an index register is sometimes called a pointer register because its contents are used in the calculation of the address of an operand, and therefore points to the operand. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 602 glossary motorola polarity the two opposite logic levels, logic 1 and logic 0, which correspond to two different voltage levels, v dd and v ss . polling ?periodically reading a status bit to monitor the condition of a peripheral device. port ?a set of wires for communicating with off-chip devices. prescaler ?a circuit that generates an output signal related to the input signal by a fractional scale factor such as 1/2, 1/8, 1/10 etc. program a set of computer instructions that cause a computer to perform a desired operation or operations. program counter (pc) a 16-bit register in the cpu. the pc register holds the address of the next instruction or operand that the cpu will use. pull an instruction that copies into the accumulator the contents of a stack ram location. the stack ram address is in the stack pointer. pullup a transistor in the output of a logic gate that connects the output to the logic 1 voltage of the power supply. pulse-width ?the amount of time a signal is on as opposed to being in its off state. pulse-width modulation (pwm) ?controlled variation (modulation) of the pulse width of a signal with a constant frequency. push an instruction that copies the contents of the accumulator to the stack ram. the stack ram address is in the stack pointer. pwm period ?the time required for one complete cycle of a pwm waveform. ram ?random access memory. all ram locations can be read or written by the cpu. the contents of a ram memory location remain valid until the cpu writes a different value or until power is turned off. rc circuit ?a circuit consisting of capacitors and resistors having a defined time constant. read ?to copy the contents of a memory location to the accumulator. register ?a circuit that stores a group of bits. reserved memory location writing to a reserved location has no effect. reading a reserved location always returns zero. reset ?to force a device to a known condition. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 motorola glossary 603 rom read-only memory. a type of memory that can be read but cannot be changed (written). the contents of rom must be specified before manufacturing the mcu. sci ?see ?erial communication interface module (sci). serial ?pertaining to sequential transmission over a single line. serial communications interface module (sci) ?a module that supports asynchronous communication. serial peripheral interface module (spi) ?a module that supports synchronous communication. set ?to change a bit from logic 0 to logic 1; opposite of clear. shift register ?a chain of circuits that can retain the logic levels (logic 1 or logic 0) written to them and that can shift the logic levels to the right or left through adjacent circuits in the chain. signed ?a binary number notation that accommodates both positive and negative numbers. the most significant bit is used to indicate whether the number is positive or negative, normally logic 0 for positive and logic 1 for negative. the other seven bits indicate the magnitude of the number. software ?instructions and data that control the operation of a microcontroller. software interrupt (swi) ?an instruction that causes an interrupt and its associated vector fetch. spi ?see ?erial peripheral interface module (spi). stack a portion of ram reserved for storage of cpu register contents and subroutine return addresses. stack pointer (sp) a 16-bit register in the cpu containing the address of the next available storage location on the stack. start bit ?a bit that signals the beginning of an asynchronous serial transmission. status bit ?a register bit that indicates the condition of a device. stop bit ?a bit that signals the end of an asynchronous serial transmission. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
glossary mc9s12t64revision 1.1.1 604 glossary motorola subroutine a sequence of instructions to be used more than once in the course of a program. the last instruction in a subroutine is a return from subroutine (rts) instruction. at each place in the main program where the subroutine instructions are needed, a jump or branch to subroutine (jsr or bsr) instruction is used to call the subroutine. the cpu leaves the flow of the main program to execute the instructions in the subroutine. when the rts instruction is executed, the cpu returns to the main program where it left off. synchronous ?refers to logic circuits and operations that are synchronized by a common reference signal. timer ?a module used to relate events in a system to a point in time. toggle to change the state of an output from a logic 0 to a logic 1 or from a logic 1 to a logic 0. tracking mode ?a mode of pll operation with narrow loop bandwidth. also see ?cquisition mode. two? complement a means of performing binary subtraction using addition techniques. the most significant bit of a two? complement number indicates the sign of the number (1 indicates negative). the two? complement negative of a number is obtained by inverting each bit in the number and then adding 1 to the result. unbuffered ?utilizes only one register for data; new data overwrites current data. unimplemented memory location ?a memory location that is not used. writing to an unimplemented location has no effect. reading an unimplemented location returns an unpredictable value. variable ?a value that changes during the course of program execution. vco ?see ?oltage-controlled oscillator. vector a memory location that contains the address of the beginning of a subroutine written to service an interrupt or reset. voltage-controlled oscillator (vco) a circuit that produces an oscillating output signal of a frequency that is controlled by a dc voltage applied to a control input. waveform a graphical representation in which the amplitude of a wave is plotted against time. wired-or ?connection of circuit outputs so that if any output is high, the connection point is high. word ?a set of two bytes (16 bits). write ?the transfer of a byte of data from the cpu to a memory location. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola con?ential proprietary mc9s12t64revision 1.1.1 motorola literature updates 605 preliminary draft literature updates this document contains the latest data available at publication time. for updates, contact one of the centers listed below: literature distribution centers order literature by mail or phone. usa/europe motorola literature distribution p.o. box 5405 denver, colorado, 80217 phone 1-303-675-2140 us & canada only http://sps.motorola.com/mfax japan motorola japan ltd. tatsumi-spd-jldc toshikatsu otsuki 6f seibu-butsuryu center 3-14-2 tatsumi koto-ku tokyo 135, japan phone 03-3521-8315 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
literature updates customer focus center mc9s12t64revision 1.1.1 motorola literature updates 606 preliminary draft hong kong motorola semiconductors h.k. ltd. 8b tai ping industrial park 51 ting kok road tai po, n.t., hong kong phone 852-26629298 customer focus center 1-800-521-6274 mfax to access this worldwide faxing service call or contact by electronic mail or the internet: rmfax0@email.sps.mot.com touch-tone 1-602-244-6609 http://sps.motorola.com/mfax motorola sps world marketing world wide web server use the internet to access motorola? world wide web server. use the following url: http://design-net.com microcontroller division? web site directly access the microcontroller division? web site with the following url: http://design-net.com/csic/csic_home.html f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
preliminary draft f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
prelimina r y draft motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and speci?ally disclaims any and all liability, including without limitation consequential or incidental damages. ?ypical parameters which may be provided in motorola data sheets and/or speci?ations can and do vary in different applications and actual performance may vary over time. all operating parameters, including ?ypicals must be validated for each customer application by customer's technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its of?ers, employees, subsidiaries, af?iates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/af?mative action employer. how to reach us: usa/europe: motorola literature distribution; p.o. box 5405, denver, colorado 80217. 1-303-675-2140 mfax: rmfax0@email.sps.mot.com ?touchtone 1- 602-244-6609, http://sps.motorola.com/mfax us & canada only: http://sps.motorola.com/mfax home page: http://motorola.com/sps/ japan: motorola japan ltd.; sps, technical information center, 3-20-1, minami-azabu, minato-ku, tokyo 106-8573 japan. 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd.; silicon harbour centre, 2 dai king street, tai po industrial estate, tai po, n.t., hong kong. 852-266668334 customer focus center: 1-800-521-6274 mfax is a trademark of motorola, inc. motorola, inc., 2003 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .


▲Up To Search▲   

 
Price & Availability of 9S12T64AF16V1

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