![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
32 bit TX System RISC TX19 Family TMP19A71CYFGUG TMP19A71FYFGUG Rev 2.0Feb.2007 TMP19A71 Contents 1. Features.................................................................................................................................. 1-1 2. Pin Assignments and Pin Functions ....................................................................................... 2-1 3. Prosessor Core....................................................................................................................... 3-1 4. Memory Map........................................................................................................................... 4-1 5. Clock / Standby Control .......................................................................................................... 5-1 6. Watchdog Timer ..................................................................................................................... 6-1 7. Exceptions/Interrupts .............................................................................................................. 7-1 8. I/O Ports.................................................................................................................................. 8-1 9. Debug Support Unit (DSU) ..................................................................................................... 9-1 10. DMA Controller (DMAC) ....................................................................................................... 10-1 11. 16-Bit Timer/Event Counters (TMRBs) ..................................................................................11-1 12. Serial I/O (SIO) ..................................................................................................................... 12-1 13. Analog-to-Digital Converters (ADCs) .................................................................................... 13-1 14. Motor Control Circuit (PMD: Programmable Motor Driver) ................................................... 14-1 15. Encoder Input Circuit ............................................................................................................ 15-1 16. ROM Correction.................................................................................................................... 16-1 17. Flash Memory ....................................................................................................................... 17-1 18. I/O Register Summary .......................................................................................................... 18-1 19. Electrical Characteristics ...................................................................................................... 19-1 20. Package Dimensions ............................................................................................................ 20-1 TMP19A71 32-Bit RISC Microprocessor TX19 Family TMP19A71FYFG/FYUG/CYFG/CYUG 1. Features The TX19A core processor contained in the TMP19A71 is a family of high-performance 32-bit microprocessors that offers the speed of a 32-bit RISC solution with the added advantage of a significantly reduced code size of a 16-bit architecture. The instruction set of the TX19A includes the high-performance MIPS32ISA, and is enhanced by the MIPS16e-TXTM Application-Specific Extensions (ASE) based on the highly code-efficient MIPS16eISA of MIPS Technologies, Inc. and with added instructions by Toshiba. The TMP19A71 is built on a TX19A core processor and contains a selection of intelligent peripherals. It is suitable for low-voltage and low-power applications. The TMP19A71 has the following features: (1) TX19A core processor (For details, refer to the TX19A Architecture manual.) 1) Two instruction set architecture (ISA) modes: 16-bit ISA for code density and 32-bit ISA for speed * * * * * * * * * * The 16-bit ISA is object-code compatible with the code-efficient MIPS16eTMASE. The 32-bit ISA is object-code compatible with the high-performance TX39 Family. High performance Single clock cycle execution (except for save, restore, jump/branch instructions) 3-operand computational instructions for high instruction throughput 5-stage pipeline On-chip high-speed memory DSP function: Executes 32-bit multiply-accumulate operations (32-bit x 32-bit + 64-bit = 64-bit) in a single clock cycle. Low power consumption Optimized design using a low-power cell library 060116EBP * The information contained herein is subject to change without notice. 021023_D * TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the "Handling Guide for Semiconductor Devices," or "TOSHIBA Semiconductor Reliability Handbook" etc. 021023_A * The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunctionor failure of which may cause loss of human life or bodily injury ("Unintended Usage"). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's own risk. 021023_B * The products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. 060106_Q * The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of TOSHIBA or others. 021023_C * The products described in this document are subject to the foreign exchange and foreign trade laws. 021023_E * For a discussion of how the reliability of microcontrollers can be predicted, please refer to Section 1.3 of the chapter entitled Quality and Reliability Assurance/Handling Precautions. 030619_S 2) Combines high performance with low power consumption. TMP19A71 1-1 TMP19A71 * * * * Programmable standby modes in which processor clocks are stopped Distinct starting locations for each interrupt service routine Automatically generated vectors for each interrupt source Automatic updates of the interrupt mask level 3) Fast interrupt response suitable for real-time control (2) On-chip program memory and data memory Product TMP19A71FYFG/UG On-Chip ROM 256 Kbytes Flash ROM TMP19A71CYFG/UG 256 Kbytes Mask ROM 10 Kbytes On-Chip RAM 10 Kbytes * * * * * * * * * * * * * * * * * * * * * * * ROM correction logic (8 words x 8 blocks) Interrupt- or software-triggered Transfer destination: On-chip memory, on-chip peripherals 16-Bit Interval Timer mode 16-Bit Event Counter mode 16-Bit PPG output Input capture Either UART mode or Synchronous mode can be selected for 2 channels; the other 2 channels are UART only. 50% duty cycle generation (for UART mode only) Generating 3-phase PWM with a resolution of 35.7 ns (at IMCLK = 28 MHz) Dead time insertion 3-phase PWM generation disabled under abnormal condition Two channels can be started synchronously. Supporting incremental encoder Rotation direction detection circuit Absolute position detection circuit Position comparison circuit On-chip noise filter High-speed conversion (min: 2.36 s) Input voltage range: 0 V to 3.3 V External trigger supported Fixed-Channel or Channel Scan mode Single Conversion or Continuous Conversion mode (3) 8-channel DMA controller (4) 4-channel 16-bit timer (5) 4-channel general-purpose serial interface (6) 2-channel 3-phase PWM generation (PMD) (7) 1-channel ABZ encoder (8) 19-channel 10-bit AD converter (with internal sample and hold) TMP19A71 1-2 TMP19A71 * * * High-Priority Conversion mode AD conversion monitoring PMD mode (9) 1-channel watchdog timer (10) Interrupt sources * * * 2 CPU interrupts: Software interrupt (within the co-processor) 37 internal interrupts: 7 priority levels (excluding the watchdog timer interrupt) 11 external interrupts: 7 priority levels (excluding the NMI interrupt) (11) 75-pin input/output ports (12) Standby modes * * * Three standby modes: DOZE, HALT, STOP On-chip PLL (x 16) Clock gear: Divides the high-speed clock to 1/2, 1/4 or 1/8. (13) Clock generator (14) Endian * Little-endian fixed (15) Power voltage * * * Peripheral I/O: Internal: Internal: Vcc3 = 3.3V 0.3 V (TMP19A71FYFG/UG, TMP19A71CYFG/UG Vcc2 = 2.5V 0.2 V (MP19A71FYFG/UG VccC15 = 1.5V 0.15 V (TMP19A71CYFG/UG (16) Operating frequency * * * * 56 MHz (Vcc2 = 2.5V 0.2 V: TMP19A71FYFG/UG) 56 MHz (Vcc15 = 1.5V 0.15 V: TMP19A71CYFG/UG) P-LQFP100-1414-0.50F (14mm x 14mm, 0.5-mm pitch): TMP19A71FYUG/CYUG P-QFP100-1420-0.65A (14mm x 20mm, 0.65-mm pitch): TMP19A71FYFG/CYFG (17) Package TMP19A71 1-3 TMP19A71 TX19A Proccessor Core TX19A CPU EJTAG 256KB MaskROM 256KB FlashROM 10 KBRAM ROM correction DMAC (8ch) CG NMI (P95) INT0 (P84) INT1 (PA7) INT2 (PB7) INT3 (P64) INT4 (P65) INT5 (P66) INT6 (P67) INT7 (P70) INT8 (P71) INT9 (P72) X1 X2 INTC G-BUS (32bit) RESET TEST0/1 IMBusI/F EJE U0 (PA0) X0 (PA1) V0 (PA2) Y0 (PA3) W0 (PA4) Z0 (PA5) EMG0 (PA6) U1 (PB0) X1 (PB1) V1 (PB2) Y1 (PB3) W1 (PB4) Z1 (PB5) EMG1 (PB6) PMD0 PORT0 P00P07 PORT1 PMD1 P10P17 TCK (P20) TMS (P21) IM-BUS (16-bit) TDI (P22) TDO (P23) ENCA (P90) ENCB (P91) ENCZ (P92) TXD0 (P80) RXD0 (P81) EJTAG PORT DINT (P24) TPC (P30) PCST0 (P31) PCST1 (P32) PCST2 (P33) PCST3 (P86) ENC UART0 TXD1 (P82) RXD1 (P83) UART1 PCST4 (P87) DCLK (P34) TXD2 (P86) RXD2 (P85) SCLK2/CTS2 (P87) TXD3 (P91) RXD3 (P90) SCLK3/CTS3 (P92) TB0IN (P93), TB1IN (P70), TB2IN (P71), TB3IN (P72), TB0OUT (P94) TB1OUT (P87) TB2OUT (PA7) TB3OUT (PB7) UART2/ SIO2 10-bit ADC0 UART3/ SIO3 AIN07 (P5057) AVSS AVCC0/VREFH0 AIN818 (P6072) 10-bit ADC1 16-bit TMR0-3 (4ch) WDT AVSS AVCC1/VREFH1 ( ): Default function after reset Figure 1.1 TMP19A71 Block Diagram TMP19A71 1-4 TMP19A71 2. Pin Assignments and Pin Functions This section contains pin assignments for the TMP19A71 as well as brief descriptions of the TMP19A71 input and output signals. 2.1 TMP19A71CYFG/UG Pin Assignments Figure 2.1 shows the pin assignments of the TMP19A71CYUG. Figure 2.1 TMP19A71CYUG Pin Assignments (100-pin LQFP) Note 1: Note 2: This pin should be set to High during a reset sequence. These signals are Low active. TMP19A71 2-1 TMP19A71 Figure 2.2 shows the pin assignments of the TMP19A71CYFG. Figure 2.2 TMP19A71CYFG Pin Assignments (100-pin QFP) Note 1: Note 2: This pin should be set to High during a reset sequence. These signals are Low active. TMP19A71 2-2 TMP19A71 2.2 TMP19A71FYFG/UG Pin Assignments Figure 2.3 shows the pin assignments of the TMP19A71FYUG. Figure 2.3 TMP19A71FYUG Pin Assignments (100-pin LQFP) Note 1: Note 2: This pin should be set to High during a reset sequence. These signals are Low active. TMP19A71 2-3 TMP19A71 Figure 2.4 shows the pin assignments of the TMP19A71FYFG. Figure 2.4 TMP19A71FYFG Pin Assignments (100-pin QFP) Note 1: Note 2: This signal must be set to High during a reset sequence. These signals are Low active. TMP19A71 2-4 TMP19A71 2.3 Pin Names and Functions Table 2.3.1 lists the input and output pins of the TMP19A71, including alternate pin names and functions for multi-function pins. Table 2.3.1 Pin Names and Functions (1/3) Pin Name P00 to P07 P10 to P17 P20 TCK P21 TMS P22 TDI P23 TDO P24 DINT P30 TPC P31 PCST0 P32 PCST1 P33 PCST2 P34 DCLK P50 to P57 AN0 to AN7 P60 to P63 AN8 to AN11 P64 to P67 AN12 to AN15 INT3 to INT6 P70 AN16 INT7 TB1IN P71 AN17 INT8 TB2IN P72 AN18 INT9 TB3IN Number of Pins 8 8 1 1 1 1 1 1 1 1 1 1 8 4 4 Type Function Input/Output Port 0: Individually programmable as input or output Input/Output Port 1: Individually programmable as input or output Input/Output Port 20: Programmable as input or output EJTAG pin (Schmitt-triggered input) Input Input/Output Port 21: Programmable as input or output Input EJTAG pin (Schmitt-triggered input) Input/Output Port 22: Programmable as input or output Input EJTAG pin (Schmitt-triggered input) Input/Output Port 23: Programmable as input or output EJTAG pin Output Input/Output Port 24: Programmable as input or output Input EJTAG pin (Schmitt-triggered input) Input/Output Port 30: Programmable as input or output EJTAG pin Output Input/Output Port 31: Programmable as input or output Output EJTAG pin Input/Output Port 32: Programmable as input or output Output EJTAG pin Input/Output Port 33: Programmable as input or output Output EJTAG pin Input/Output Port 34: Programmable as input or output Output EJTAG pin Input Input Input Input Port 5: Input-only Analog Input: Input to the AD converter Port 60 to 63: Input-only Analog Input: Input to the AD converter Input/Output Port 64 to 67: Programmable as Schmitt-triggered input or output Input Analog Input: Input to the AD converter Input External interrupt pins: Programmable to be high-level, low-level, rising-edge or falling-edge sensitive Input/Output Input Input Input Input/Output Input Input Input Input/Output Input Input Input Port 70: Programmable as Schmitt-triggered input or output Analog Input: Input to the AD converter External Interrupt 7: Programmable to be high-level, low-level, rising-edge or falling-edge sensitive 16-Bit Timer Input: Input to 16-bit timer 1 Port 71: Programmable as Schmitt-triggered input or output Analog Input: Input to the AD converter External Interrupt 8: Programmable to be high-level, low-level, rising-edge or falling edge sensitive 16-bit Timer 2 Input: Input to 16-bit timer 2 Port 72: Programmable as Schmitt-triggered input or output Analog Input: Input to the AD converter External Interrupt 9: Programmable to be high-level, low-level, rising-edge or falling-edge sensitive 16-Bit Timer 3 Input: Input to 16-bit timer 3 1 1 1 TMP19A71 2-5 TMP19A71 Table 2.3.2 Pin Names and Functions (2/3) Pin Name P80 TX0 P81 RX0 P82 TX1 P83 RX1 P84 INT0 TB1OUT P85 RX2 P86 TX2 PCST3 P87 SCLK2 CTS2 PCST4 P90 ENCA RX3 P91 ENCB TX3 P92 ENCZ SCLK2 CTS2 P93 TB0IN P94 TB0OUT BOOT (Note) P95 NMI PA0 U0 PA1 X0 PA2 V0 PA3 Y0 PA4 W0 PA5 Z0 1 1 1 1 1 1 Number of Pins 1 1 1 1 1 Type Input/Output Output Input/Output Input Function Port 80: Programmable as input or open-drain output Serial Transmit Data 0 Port 81: Programmable as input or output Serial Receive Data 0 Input/Output Port 82: Programmable as input or open-drain output Serial Transmit Data 1 Output Input/Output Port 83: Programmable as input or output Input Serial Receive Data 1 Input/Output Port 84: Programmable as Schmitt-triggered input or output Input External interrupt pin Output 16-Bit Timer 1 Output: Output from 16-bit timer 1 Input/Output Port 85: Programmable as input or output Input Serial Receive Data 2 Input/Output Port 86: Programmable as input or open-drain output Output Serial Transmit Data 2 Output EJTAG pin Input/Output Input/Output Output Output Port 87: Programmable as Schmitt-triggered input or open-drain output Serial Clock Input/Output 2 Serial Clear-to-Send 2 EJTAG pin 1 1 1 1 Input/Output Port 90: Programmable as Schmitt-triggered input or output Input Encoder A-phase input pin Input Serial Receive Data 3 Input/Output Port 91: Programmable as Schmitt-triggered input or output Input Encoder B-phase input pin Output Serial Transmit Data 3 Input/Output Input Input/Output Output Port 92: Programmable as Schmitt-triggered input or output Encoder Z-phase input pin Serial Clock Input/Output 3 Serial Clear-to-Send 3 1 1 1 1 Input/Output Port 93: Programmable as Schmitt-triggered input or output Input 16-Bit Timer 0 Input: Input to 16-bit timer 0 and emergency stop input pin Input/Output Port 94: Programmable as input or output Output 16-Bit Timer 0 Output: Output from 16-bit timer 0 Single boot mode set pin: Should be set to Low to start up in Boot mode. Input/Output Port 95: Programmable as Schmitt-triggered input or output Input Nonmaskable Interrupt Request: Programmable to be rising-edge or falling edge sensitive Input/Output Port A0: Programmable as input or output Output PMD0: U-phase output Input/Output Port A1: Programmable as input or output PMD0: X-phase output Output Input/Output Port A2: Programmable as input or output Output PMD0: V-phase output Input/Output Port A3: Programmable as input or output Output PMD0: Y-phase output Input/Output Port A4: Programmable as input or output Output PMD0: W-phase output Input/Output Port A5: Programmable as input or output Output PMD0: Z-phase output 1 TMP19A71 2-6 TMP19A71 Table 2.3.3 Pin Names and Functions (3/3) Pin Name PA6 EMG0 PA7 INT1 TB2OUT PB0 U1 PB1 X1 PB2 V1 PB3 Y1 PB4 W1 PB5 Z1 PB6 EMG1 PB7 INT2 TB3OUT AVSS AVCC0 /VREFH0 AVCC1 /VREFH1 EJE RESET TEST0 TEST1 X1/X2 Number of Pins 1 1 Type Function Input/Output Port A6: Programmable as Schmitt-triggered input or output PMD0: Emergency stop input pin Input Input/Output Port A7: Programmable as Schmitt-triggered input or output Input Interrupt Request 1: Programmable to be high-level, low-level, rising-edge or falling-edge sensitive Output 16-Bit Timer 2 Output: Output from 16-bit timer 2 Input/Output Output Input/Output Output Port B0: Programmable as input or output PMD1: U-phase output Port B1: Programmable as input or output PMD1: X-phase output 1 1 1 1 1 1 1 1 Input/Output Port B2: Programmable as input or output Output PMD1: V-phase output Input/Output Port B3: Programmable as input or output Output PMD1: Y-phase output Input/Output Port B4: Programmable as input or output Output PMD1: W-phase output Input/Output Port B5: Programmable as input or output Output PMD1: Z-phase output Input/Output Port B6: Programmable as Schmitt-triggered input or output Input PMD1: Emergency stop input pin Input/Output Port B7: Programmable as Schmitt-triggered input or output Interrupt Request 2: Programmable to be high-level, low-level, rising-edge or falling edge sensitive Input 16-Bit Timer 3 Output: Output from 16-bit timer 3 Output Input Input Ground pin (0 V) for the AD converter 3.3-V power supply pin for the AD converter 0 Input pin for high reference voltage for the AD converter (Shared with the above pin) 3.3-V power supply pin for the AD converter 1 Input pin for high reference voltage for the AD converter (Shared with the above pin) EJTAG Enable (Low active) Reset: Initialize LSI (Schmitt-triggered input with internal pull-up register, low active) Test pin: This pin should be tied to logic 0. Test pin: This pin should be tied to logic 0. Power Supply and Ground Pins for the Mask-Version Product 1 1 1 1 1 1 1 2 Input/Output Connection pins for a resonator CVCC15 CVSS DVCC3 DVCC15 DVSS 1 1 2 6 6 1.5-V power supply pin for the oscillator Ground pin (0 V) for the oscillator 3.3-V power supply pin 1.5-V power supply pin Ground pin (0 V) Power Supply and Ground Pins for the Flash-Version Product CVCC2 CVSS FVCC3 FVCC2 FVSS DVCC3 DVCC2 DVSS 1 1 (2) 2 2 2 4 4 2.5-V power supply pin for the oscillator Ground pin (0 V) for the oscillator 3.3-V power supply pin for flash macro (Shared with DVCC3) 2.5-V power supply pin for flash macro Ground pin (0 V) for flash macro 3.3-V power supply pin 2.5-V power supply pin Ground pin (0V) Note: This pin should be fixed to High in a mask-version product. TMP19A71 2-7 TMP19A71 3. Core Processor The TMP19A71 contains a high-performance 32-bit core processor called the TX19A. For a detailed description of the core processor, refer to the TX19A Architecture manual. The functions unique to the TMP19A71 not covered in the architecture manual are described below. Note: All references to register addresses in the following description assume that the TMP19A71 is operating in Little-Endian mode. 3.1 Power-Up Sequence To power up the TMP19A71, we recommend that the core power supply (2.5 V in a flash-version product and 1.5 V in a mask-version product) be turned on first. 3.2 Reset Operation To reset the TMP19A71, RESET must be asserted for at least a specified period of time, as shown in Table 3.2.1, after the power supply voltage has stabilized. This time period is required to initialize internal circuits. If this requirement is not satisfied, the TMP19A71 may not operate properly due to improper initialization of internal circuits. The incorporated program begins executing 30 usec after RESET is released. Table 3.2.1 Reset Input Time Reset Timing Flash-version device: At power-on, and second and subsequent resets (CLKMISC.MSFR = 0) Flash-version device: Second and subsequent resets (CLKMISC.MSFR = 1) Mask-version device Note: When oscillation is started, oscillation stabilization time and PLL lock-up time are additionally required. 32/X1 Equation (sec) Fixed Required External Reset Input Time 1 msec after power supply has stabilized 4.6 us (at 7MHz/) or 6.4 us (at 5 MHz) after oscillation has stabilized The following occur as a result of a reset: * The System Control Coprocessor (CP0) registers within the TX19A core processor are initialized. For details, refer to the TX19A Architecture manual. * The Reset exception is taken. Program control is transferred to the exception handler at a predefined address. This predefined location is called an exception vector, which directly indicates the start of the actual exception handler routine. The Reset exception is always vectored to virtual address 0xBFC0_0000 (which is the same as for the Nonmaskable Interrupt exception). * All on-chip I/O peripheral registers are initialized. * All port pins, including those multiplexed with on-chip peripheral functions, are configured as either general-purpose inputs or general-purpose outputs. Note 1: The TMP19A71 must be powered up with RESET asserted. The reset state should not be terminated until after the power supply voltage stablizes within the valid operating range. Note 2: There is a possibility that on-chip RAM locations accessed and general-purpose registers of the selected bank may be corrupted during a reset. TMP19A71 3-1 TMP19A71 3.3 Start-Up Routine The following explains a standard start-up routine. Write a start-up routine according to the requirements of your program. 1. Enable the shadow register sets Set the SSD bit of the SSCR register (CP0 register) to 0 to enable the shadow register sets. 2. Set the global pointer r28 (GP) and the stack pointer r29 (SP) Set the initial values in r28 and r29 as required. When the shadow register sets are used, it is necessary to set r29 separately for shadow register set 0 and shadow register sets 1 to 7. 3. Set the CP0 Status register In the CP0 Status register, set the CU0 bit (CP0 usability) to 1, the BEV bit (bootstrap exception vector) to 1, and the IM[4:2] field (interrupt mask) to 1, as required. 4. Set the CP0 Cause register Set the IV bit (interrupt vector) in the CP0 Cause register to 1, as required. 5. Set the block decode registers It is necessary to set the block decode registers to change the data read method according to whether the flash-version or mask-version device is used. If this setting is not made, internal ROM data cannot be read correctly. The B0DCR and B0DLR registers should be accessed from block 0, and the B1DCR and B1DLR registers should be accessed from block 1. (Programming examples) By using instructions stored at 0xBFC0_0000 to 0xBFC1_FFFF (0x0000_0000 to 0x0001_FFFF): B0DCR0xFFFF_E530 <-- 0x00 B0DLR0xFFFF_E534<-- 0x3D By using instructions stored at 0xBFC2_0000 to 0xBFC3_FFFF (0x0002_0000 to 0x0003_FFFF): B1DCR0xFFFF_E538 <-- 0x00 B1DLR0xFFFF_E53C <-- 0x3D TMP19A71 3-2 TMP19A71 Block 0 Decode Control Register 7 6 0 5 0 4 0 3 0 2 0 1 0 0 B0DECEN R/W 1 1: Flash version 0: Mask version B0DCR (0xFFFF_E530) Bit Symbol Read/Write Reset Value Function 0 Note 1: Note 2: Note 3: In the mask-version device, the B0DECEN bit is not initialized by a WDT reset; it is initialized by an external reset. In the flash-version device, the B0DECEN bit is not initialized by a normal reset; it is initialized by a power-on reset. The B0DCR should be accessed by an instruction stored in block 0 (0xBFC0_0000 to 0xBFC1_FFFF or 0x0000_0000 to 0x0001_FFFF). Block 0 Decode Lock Register 7 B0DLR (0xFFFF_E534) Bit Symbol Read/Write Reset Value Function 6 5 4 W The value written in the B0DLR.B0DECEN bit takes effect by writing 0x3D in this register. 3 2 1 0 Note: The B0DLR should be accessed by an instruction stored in block 0 (0xBFC0_0000 to 0xBFC1_FFFF or 0x0000_0000 to 0x0001_FFFF). Block 1 Decode Control Register 7 B1DCR (0xFFFF_E538) Bit Symbol Read/Write Reset Value Function 6 5 4 3 2 1 0 B1DECE N R/W 1 1: Flash version 0: Mask version 0 0 0 0 0 0 0 Note 1: Note 2: Note 3: In the mask-version device, the B1DECEN bit is not initialized by a WDT reset; it is initialized by an external reset. In the flash-version product, the B1DECEN bit is not initialized by a normal reset; it is initialized by a power-on reset. The B1DCR should be accessed by an instruction stored in block 1 (0xBFC2_0000 to 0xBFC3_FFFF or 0x0002_0000 to 0x0003_FFFF). Block 1 Decode Lock Register 7 B1DLR (0xFFFF_E53C) Bit Symbol Read/Write Reset Value Function 6 5 4 W The value written in the B1DLR.B1DECEN bit takes effect by writing 0x3D in this register. 3 2 1 0 Note: The B1DLR should be accessed by an instruction stored in block 1 (0xBFC2_0000 to 0xBFC3_FFFF or 0x0002_0000 to 0x0003_FFFF). TMP19A71 3-3 TMP19A71 3.4 Bus Cycles In a processor using pipelining like the TX19A core processor, performance is greatly influenced by pipeline hazards. To improve performance, therefore, due consideration must be given to pipeline hazards related to bus cycles. The TX19A core processor controls bus cycles asynchronous to the pipeline (non-blocking loads, etc.) to prevent degradation in performance due to pipeline hazards. In addition, taking account of DMA transfers triggered by external sources, it is extremely difficult to control bus cycles by software. The TX19A core processor is provided with the SYNC instruction for synchronization of bus cycles. The SYNC instruction stalls execution of the next instruction until all instructions generating bus cycles (including the write buffer) have been completed. The following gives considerations related to bus cycles through explaining how to use the SYNC instruction. Please note that the following considerations may not apply and other considerations may be required depending on the system. For a detailed description of the write buffer and bus cycles, refer to the TX19A Architecture manual. 3.4.1 Bus Cycle Execution Time Table 3.4.1 shows the number of clock cycles required for completing the bus cycle of a load or store instruction. Since the start timing of each bus cycle varies depending on the write buffer and bus states, the values shown in this table may not always apply. Table 3.4.1 Number of Clock Cycles for Completing Bus Cycles 1bit/8 bits (byte) On-chip ROM 2 clk (fsys): operand 16 bits (half word) 2 clk (fsys): operand (1 clk (fsys): instruction) On-chip RAM G-bus (CG/IRC/DMAC) 1 clk (fsys) CPU: 3 to 4 clk (fsys) DMAC: 4 clk (fsys) IM-bus (I/O registers other than G-bus) (IMCLK: 28 MHz) CPU: 4 to 5 clk (IMCLK) DMAC: 4 to 5 clk (IMCLK) 1 clk (fsys) CPU: 3 to 4 clk (fsys) DMAC: 4 clk (fsys) CPU: 4 to 5 clk (IMCLK) DMAC: 4 to 5 clk (IMCLK) 32 bits (word) 2 clk (fsys): operand (1 clk (fsys): instruction) 1 clk (fsys) CPU: 3 to 4 clk (fsys) DMAC: 4 clk (fsys) CPU: 4 to 5 clk (IMCLK) DMAC: 4 to 5 clk (IMCLK) TMP19A71 3-4 TMP19A71 3.4.2 When Using Instructions Executed Asynchronous to Bus Cycles Table 3.4.2 lists the co-processor and special-purpose instructions that are executed independent of bus cycles to enable and disable interrupts and to enter standby mode. Table 3.4.2 State Transition Instructions Not Requiring Bus Cycles Operation EI DI Interrupts are enabled 2 clock cycles after the EI instruction is executed (E stage). Interrupts are disabled immediately after the DI instruction is executed (E stage). (The status change is reflected in the CP0 register after 2 clock cycles). MTC0 Writes to the CP0 registers take effect 2 clock cycles after the MTC0 instruction is executed (E stage). (Only the interrupt disable setting takes effect immediately.) WAIT Standby mode is entered 2 clock cycles after the WAIT instruction is executed. To execute these instructions, caution must be exercised on preceding bus cycles. The following examples show possible problems. Example 1: Enabling interrupts after clearing an interrupt source (Problem example) lui sh mtc0 nop nop ; Interrupts are actually enabled. r27, hi(ICLR) r26, lo(ICLR)(r27) r29, IER ; Clear interrupt source. ; Enable interrupts. In the above example, the MTC0 instruction may be executed before the preceding bus cycle is completed so that interrupts are enabled before the interrupt source is cleared as intended. This problem can be avoided by inserting the SYNC instruction before the MTC0 instruction, as shown below. (Workaround example) lui sh sync mtc0 nop nop ; Interrupts are actually enabled. r29, IER r27, hi(ICLR) r26, lo(ICLR)(r27) ; Clear interrupt source. ; Stall the next instruction until the interrupt source is cleared. ; Enable interrupts. TMP19A71 3-5 TMP19A71 Example 2: Exiting standby mode (Problem example) ori lui sb wait nop r26, r0 , 0x0d r27, hi(TB0RUN) r26, lo(TB0RUN)(r27) ; Bit 0(TRUN) = 1(timer start) ; Enter standby mode. This is an example of exiting standby mode when the timer reaches the specified time. If the WAIT instruction is executed before the preceding bus cycle is completed, standby mode may be entered before the timer is set, making it impossible to exit standby mode. This problem can be avoided by inserting the SYNC instruction before the WAIT instruction so that the WAIT instruction is stalled until the timer starts counting, as shown below. (Workaround example) ori lui sb sync wait nop r26, r0 , 0x0d r27, hi(TB0RUN) r26, lo(TB0RUN)(r27) ; Bit 0(TRUN)=1 (timer start) ; Stall until the timer starts counting. ; Enter standby mode. Generally speaking, it is not possible to predict when a bus cycle completes. Therefore, we do not recommend using the NOP instruction instead of the SYNC instruction in the above examples for waiting for completion of the preceding bus cycle. TMP19A71 3-6 TMP19A71 3.4.3 When an Memory Area Is Modified Is it also necessary to exercise caution on bus cycles when a memory area is modified through the ROM correction function or an external bus interface. The following shows an example of execution entering an area that is modified by ROM correction immediately after the ROM correction setting has been made. Note: The TMP19A71 does not contain an external bus interface. Example 3: Executing the ROM correction target area after the ROM correction setting has been made (Problem example) lui addiu lui sw NG_AREA: nop nop r26, hi(NG_AREA) r26, r26, lo(NG_AREA) r27, hi(ADDREG0) r26, lo(ADDREG0)(r27) ; Replace NG_AREA with 0xFFFFBF00-. ; Replaced area ; Set the address of NG_AREA to be replaced. In the above example, execution enters the memory area to be replaced immediately after the ROM correction setting is made. Although instructions are executed sequentially here, this situation may also occur with a jump or branch instruction. It is not normally possible to know in advance the area to be replaced with the ROM correction function. Therefore, the SYNC instruction should be inserted after an instruction for setting ROM correction. In this way, the area to be replaced with the ROM correction function will not be executed until the relevant processing is completed. (Workaround example) lui addiu lui sw sync NG_AREA: nop nop r26, hi(NG_AREA) r26, r26, lo(NG_AREA) r27, hi(ADDREG0) r26, lo(ADDREG0)(r27) ; Replace NG_AREA with 0xFFFFBF00-. ; Stall until ROM correction setting is completed. ; Replaced area ; Set the address of NG_AREA to be replaced. TMP19A71 3-7 TMP19A71 3.4.4 When the SYNC Instruction Is Invalidated by an Interrupt Even if the SYNC instruction is inserted to prevent possible problems as described in the above examples, the SYNC instruction may be invalidated by an interrupt. The following shows such a case occurring in the above example 2 (exiting standby mode). Example 4: An interrupt invalidating the SYNC instruction (Problem example) ori lui sb sync ; Omitted lui lb sb r27, hi(TB0RUN) r26, lo(TB0RUN)(r27) r0 , lo(TB0RUN)(r27) ; Save TB0RUN on the stack. ; Bit 0 (TRUN) = 0 (timer stop) r26, r0, 0x0d r27, hi(TB0RUN) r26, lo(TB0RUN)(r27) ; Bit0 (TRUN) = 1 (timer start) ; Stall until the timer starts counting. ; <---An interrupt occurs here. ---- (Required processing) sb ERET ; Omitted wait nop ; <---End of interrupt service routine---; Enter standby mode r26, lo(TB0RUN)(r27) ; Restore TB0RUN (timer restart). This problem can be avoided by inserting the SYNC instruction at the end of the interrupt service routine (immediately before the ERET instruction). TMP19A71 3-8 TMP19A71 (Workaround example) ori lui sb sync ; Omitted lui r27, hi(TB0RUN) lb sb r26, lo(TB0RUN)(r27) r0 , lo(TB0RUN)(r27) ; Save TB0RUN on the stack. ; Bit 0 (TRUN) = 0 (timer stop) r26, r0, 0x0d r27, hi(TB0RUN) r26, lo(TB0RUN)(r27) ; Bit0 (TRUN) = 1 (timer start) ; Stall until the timer starts counting. ; <---An interrupt occurs here. ---- (Required processing) sb sync ; Omitted wait r26, lo(TB0RUN)(r27) ; Restore TB0RUN (timer restart). ; Stall until the bus cycle of interrupt service routine completes. ; <---End of interrupt service routine---; Enter standby mode. nop TMP19A71 3-9 TMP19A71 3.4.5 3.4.5.1 Write Buffer TMP19A71 Write Buffer The TMP19A71 contains a four-entry FIFO write buffer. Each pipeline stage is basically executed in a single clock cycle. However, a write bus cycle accessing an area other than on-chip memory may require more than one clock cycle. The write buffer is provided to accommodate such speed variations so that program execution can achieve higher performance. With the TMP19A71 write buffer, a read bus cycle (load instruction) is always stalled until the write buffer becomes empty regardless of the addresses to be accessed by store and load instructions (see Figure 3.4.1). Therefore, bus cycles are always generated in accordance with the program execution sequence. Write Cycle Bus Cycles Write Buffer Store (1) SW Store (2) Load (3) Store Instruction (1) Write Cycle Store Instruction (2) Store instruction is handled first. Read Cycle Load Instruction (3) r10,0x0000(r16) r11,0x0004(r16) r20,0x0008(r16) F D F E D F M E D W M Es W Es Es Es Es E M W SW lw Stalled Cycles Figure 3.4.1 TMP19A71 Write Buffer Operation TMP19A71 3-10 TMP19A71 3.4.5.2 TMP19A70 Write Buffer (For Reference) With the TMP19A70 write buffer, a load instruction may be executed before the immediately preceding store instruction. In an example shown in Figure 3.4.2, the target address of the third load instruction is different from the target address of the second store instruction that is queued up in the write buffer. In this case, the read bus cycle of the load instruction is processed before the write bus cycle of the store instruction in the write buffer. (If the second and third instructions have the same target address, the load instruction is stalled until the store instruction is completed.) Write Cycle Bus Cycles Write Buffer Store Instruction (1) Read Cycle Load Instruction (3) Write Cycle Store Instruction (2) Store (1) sw Store (2) sw Load (3) lw r10,0x0000(r16) r11,0x0004(r16) r20,0x0008(r16) F D F E D F M E D W M E W E Load instruction is handled first. M R R W Figure 3.4.2 TMP19A70 Write Buffer Operation (with Different Target Addresses) The following example shows a possible problem case with the TMP19A70 write buffer for reference. Example: Reading Port 0 (TMP19A70) (Problem example) sb lb r0 , P0IER r10, P0D ; Enable Port 0 input. ; Read Port 0. In this example, the write buffer may cause the instruction for reading Port 0 to be executed before Port 0 is enabled. If this happens, the port output value will be read from Port 0. This problem can be avoided by inserting the SYNC instruction before the load instruction, as shown below, to stall the load instruction until Port 0 input is enabled. (Workaround example) sb sync lb r10, P0D r0 , P0IER ; Enable Port 0 input. ; Stall until Port 0 input is enabled. ; Read Port 0. TMP19A71 3-11 TMP19A71 3.4.6 Limitations on Accessing Special-Function Registers (SFRs) Read-modify or read-modify-write instructions must be used with caution on SFRs that include write-only bits or bits that are cleared by a read. 3.4.6.1 SFRs Requiring Extra Caution (1) Registers including write-only bits If a read-modify-write instruction is executed on a register including write-only bits with undefined read values, the write operation may not be performed as expected because the value read from each write-only bit cannot be guaranteed. (2) Registers including bits cleared by a read If a read-modify or read-modify-write instruction is executed on a register including bits that are cleared by a read, the read operation may unintentionally clear these bits. SFRs requiring extra caution are listed in the table below. Table 3.4.3 SFRs Requiring Extra Caution Functional Unit CG IRC DMAC TMRB SIO Register CLKACT CLKSPD ILEV ICLR DCR CCRn TBnMOD SCnMOD2 SCnCR SCnBUF SCnFRC SCnFTC ADC ADNRESn ADCHPRn ADPRES0 PMD ABZ encoder WDT Flash EMGRELn EMGCRn ENTNCR WDCR SEQMOD Write-Only Bits Included Included Included Included Included Included Included Included Not included Included Included Included Not included Not included Not included Included Included Included Included Included Bits Cleared by Read Not included Not included Not included Not included Not included Not included Not included Not included Included Not included Not included Not included Included Included Included Not included Not included Not included Not included Not included TMP19A71 3-12 TMP19A71 3.4.6.2 Bit Manipulation Instructions Requiring Extra Caution The bit manipulation instructions listed in the table below are read-modify or read-modify-write instructions that must not be used on the SFRs listed in Table 3.4.3. If these instructions are used to access the said SFRs, unexpected operation may result. Table 3.4.4 Read-Modify/Read-Modify-Write Instructions Instruction Name Bit Test (BTST) Bit Extract (BEXT) Bit Clear (BCLR) Bit Set (BSET) Bit Insert (BINS) Add Immediate to Memory Word (ADDMIU) Access Length 8 bits 8 bits 8 bits 8 bits 8 bits 32 bits Operation Type Read Modify Read Modify Read Modify Write Read Modify Write Read Modify Write Read Modify Write 3.4.6.3 Considerations for Access Length Discrepancy The TX19A core handles bit manipulation instructions by using the access length shown in Table 3.4.4 and internally realizing 1-bit accesses in a pseudo manner. Therefore, if bit manipulation instructions are used on the SFRs shown in Table 3.4.3, the correct results may not be obtained. This problem can be avoided by using the _rbi modifier that is provided in Toshiba's C compiler for inhibiting bit manipulation instructions. For details, refer to the instruction manual of the C compiler. 3.4.6.4 Considerations for Using the C Compiler If bit fields are used in the SFRs shown in Table 3.4.3, the C compiler may generate bit manipulation instructions or read-modify or read-modify-write instructions of 8-bit or larger quantity. Toshiba's C compiler provides the _rbi modifier that can be used for inhibiting bit manipulation instructions on specified SFRs. For details, refer to the instruction manual of the C compiler. TMP19A71 3-13 TMP19A71 4. Memory Map Figure 4.1.1 shows memory assignment for the TMP19A71. Vertual Address 0xFFFF_FFFF 16 Mbytes Reserved 16 Mbytes Reserved Physical Address On-Chip Peripherals On-Chip RAM (10 KB) 0xFF00_0000 Kseg2 Kseg2 (1 Gbyte) 16 Mbytes Reserved 0xFFFF_BFFF 0xFFFF_9800 0xBFC3_FFFF 0xBFC0_0000 0xA000_0000 0x8000_0000 16 Mbytes Reserved Kseg1 Kseg0 (Reserved) Reserved for debugging (2MB) Kuseg (2 Gbytes) (Reserved) 0xFF00_0000 0x1FC3_FFFF User Program Area Maskable Interrupt Area Exception Vector Area 0x1FC0_0500 0xFF3F_FFFF 0xFF20_0000 On-Chip ROM Shadow Kuseg Inaccessible 0x4003_FFFF 0x4000_0000 0x1FC3_FFFF On-Chip ROM 0x1FC0_0000 0x0003_FFFF 0x0000_0000 512 Mbytes 0x1FC0_0000 Figure 4.1.1 Memory Map Note 1: The on-chip 256-Kbyte ROM is mapped to virtual addresses from 0x0000_0000 through 0x0003_FFFF or 0xBFC0_0000 through 0xBFC3_FFFF. The on-chip 10-Kbyte RAM is mapped to virtual addresses from 0xFFFF_9800 through 0xFFFF_BFFF. Since the physical address space from 0xFFFF_4000 through 0XFFFF_BFFF is reserved as the RAM area, do not access the region except that within which RAM is located. Note 2: Note 3: The on-chip ROM is located in a linear address space beginning at physical address 0x0000_0000 or 0xBFC0_0000. All types of exceptions are vectored to the on-chip ROM when the BEV bit of the System Control Coprocessor's Status register is set to the default value of 1. (When BEV = 0, not all exception vectors reside in contiguous locations.) When external memory is used, the BEV bit can be cleared to 0. Using the 0x0000_0000 32KB virtual address space helps to improve code efficiency. The virtual address space beginning at 0x0000_0000 is a shadow of the on-chip memory beginning at 0xBFC0_0000, and references to this space are rerouted to the on-chip ROM. Examples: 32-bit ISA * Accessing the 0x0000_0000 32KB space LW r2, Io (_t) (r0) ; (r2)Data of 0x0000_xxxx Accessed with a single instruction Accessing other locations LUI r3, hi (_f) LW r2, Io (_f) (r3) ; Upper 16 bits of address are loaded into r3. ; Lower 16 bits of address must be added to upper 16 bits. * Note 4: No instruction should be placed in the last four words of the physical address space because the instruction prefetch circuit will access a location beyond the on-chip ROM area. * 0xBFC3_FFF0 through 0xBFC3_FFFF of 256-Kbyte on-chip ROM The TMP19A71 is always operated in the Kernal mode. The User mode should not be used. Note 5: TMP19A71 4-1 TMP19A71 5. 5.1 Clock/Standby Control Standby Control The TMP19A71 provides support for several levels of power reduction. While in NORMAL mode, setting the RP bit in the System Control Coprocessor (CP0)'s Status register and then executing the WAIT instruction cause the TMP19A71 to enter one of the standby modes--IDLE (Halt, Doze) or STOP--as specified by the SS field of the CLKSPD register. The characteristics of IDLE and STOP modes are as follows: IDLE: In IDLE mode, the TX19A core processor stops. IDLE mode can be exited by a hardware interrupt, a nonmaskable interrupt (NMI) or a reset. The latter two include those triggered by the watchdog timer. If the level of a wakeup interrupt set in the ILxx field of the IMRxx register is lower than the mask level set in the CMASK field of the ILEV register, the TMP19A71 does not wake up from IDLE mode. If the interrupt level is higher than the mask level, the TMP19A71 returns to NORMAL mode and then services the interrupt. Note 1: Note 2: In Halt mode, the TMP19A71 freezes the TX19A core processor, preserving the pipeline state. In Halt mode, the TMP19A71 ignores any external bus requests; so it continues to assume bus mastership. In Doze mode, the TMP19A71 freezes the TX19A core processor, preserving the pipeline state. In Doze mode, the TMP19A71 recognizes external bus requests. STOP: In STOP mode, the whole TMP19A71 stops. STOP mode can be exited by INT0 to INT3, NMI or a reset. The latter two do not include those triggered by the watchdog timer. When INT0 to INT3 are used for waking up from STOP mode, set CLKW0.W0WE = 1 for INT0 and CLKINTx.IxKI = 1 for INT1 to INT3. If one of these interrupts occurs and the interrupt level set in the IMRxx.ILxx field is higher than the mask level set in the ILEV.CMASK field, the TMP19A71 returns to NORMAL mode and then services the interrupt. The interrupt level of INT0 to INT3, when used for exiting STOP mode, should be set to a value higher than the mask level. TMP19A71 5-1 TMP19A71 (1) TMP19A71 operation in NORMAL and standby modes Table 5.1.1 TMP19A71 Operation in NORMAL and Standby Modes Operating Mode NORMAL IDLE (Halt) IDLE (Doze) STOP CG block. The processor and DMAC operations stop; other on-chip peripherals are active. The processor stops; on-chip peripherals including DMAC are active. All processor and peripheral operations stop completely. Operating Status The TX19A core processor and on-chip peripherals operate at frequencies specified in the (2) Clock generation operation in NORMAL and standby modes Table 5.1.2 Block Generation Operation in NORMAL and Standby Modes Clock Source Mode NORMAL IDLE (Halt) External Crystal IDLE (Doze) STOP On: Operating, or clock supplied Off: Stopped, or clock not supplied On Off On Off Off Off Oscillator On On Clock Supply to Peripherals On On Clock Supply to CPU On Off (3) Processor and peripheral block operation in standby modes Table 5.1.3 Processor and Peripheral Blocks in Standby Modes Circuit Block TX19A Processor Core DMAC INTC CG WDT I/O Ports Note 1: Note 2: Note 3: IMCLK fsys Clock Source IDLE (Doze) Off On On On On On IDLE (Halt) Off Off On On On On STOP Off Off Off (Note 1) Off (Note 1) Off (Note 2) On (Note 3) In STOP mode, clock supply is stopped but INT0 to INT3 can be used to wake up from STOP mode. After STOP mode is exited, the INTC accepts the interrupt request. The WDT stops operating in STOP mode. The WDT counter value is not cleared after STOP mode is exited. I/O ports are not automatically disabled upon entering IDLE or STOP mode. To reduce power consumption, I/O ports should be disabled before entering IDLE or STOP mode. TMP19A71 5-2 TMP19A71 5.2 Clock Source Block Diagram Block Diagram 5.2.1 CLKWUT X1 X2 High-Speed Oscillator x16 PLL fc fosc IMCLK (IM Bus Clock) CLKPRSC Figure 5.2.1 Clock Source Block Diagram 5.3 Clock Generator (CG) Registers Register Map 5.3.1 Table 5.3.1 shows the register map of the clock generator. All registers other than the CLKACT are 8 bits wide, but registers at consecutive addresses can be accessed as a 16- or 32-bit quantity. When accessing more than one register at a time, be careful not to include any reserved area. For information about reserved areas, see "18. I/O Register Summary". Table 5.3.1 Clock Generator Registers Address 0xFFFF_D300 0xFFFF_D304 0xFFFF_D305 0xFFFF_D306 0xFFFF_D307 0xFFFF_D30D 0xFFFF_D310 0xFFFF_D312 0xFFFF_D31A 0xFFFF_D31B 0xFFFF_D31C 0xFFFF_D31D Number of Bits 16 8 8 8 8 8 8 8 8 8 8 8 Mnemonic CLKACT CLKOSC CLKWUT CLKSPD CLKPRSC CLKMISC CLKNMI CLKW0 CLKINT0 CLKINT1 CLKINT2 CLKINT3 Register Name Clock generator activate register Oscillator setting register Warm-up setting register Mode switch register Clock gear control register Clock generator setting register NMI setting register INT0 setting register 0 INT0 setting register 1 INT1 setting register INT2 setting register INT3 setting register Note: The settings made in these CG registers take effect by writing 0x5A5A and then 0xF0F0 consecutively in the CLKACT register within 64 system clock cycles after the settings are made. It this time limit is not observed, the settings will not take effect. TMP19A71 5-3 TMP19A71 5.3.2 Register Description 7 Bit Symbol Clock Generator Activate Register 6 5 4 3 ACT W 2 1 0 CLKACT (0xFFFF_D300) Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 14 13 12 0 0 0 0 0 11 ACT W 0 10 0 9 0 8 0 0 0 0 0 0 0 The settings made in the CG registers take effect by writing 0x5A5A and then 0xF0F0 consecutively in this register within 64 system clock cycles after the settings are made. 0 Note 1: Note 2: This register must be accessed as a 16-bit quantity; bit manipulation instructions cannot be used. The settings made in the CG registers take effect by writing 0x5A5A and then 0xF0F0 consecutively in this register within 64 system clock cycles after the settings are made. If this time limit is not observed, the settings will not take effect. Valid example Address Data 0xFFFF_D31D 0x03 0xFFFF_D31A 0x02 0xFFFF_D300 0x5A5A 0xFFFF_D300 0xF0F0 Invalid example 1 Address Data Invalid example 2 0xFFFF_D31D 0x03 0xFFFF_D31A 0x02 0xFFFF_D300 0x5A5B Keyword input error 0xFFFF_D300 0xF0F0 Address Data 0xFFFF_D31A 0x02 64 clock cycles exceeded 0xFFFF_D300 0x5A5A 0xFFFF_D300 0xF0F0 Figure 5.3.1 Example of How to Use the Clock Generator Activate Register TMP19A71 5-4 TMP19A71 Oscillator Setting Register 7 CLKOSC (0xFFFF_D304) Bit Symbol Read/Write Reset Value Function 1 Oscillator 0: Disable 1: Enable 0 Must be set to 0. 1 0 Oscillator Must be after exiting set to 0. STOP mode 0: Disable 1: Enable XEN 6 5 RXEN 4 R/W 0 Oscillator AMP capability 0:Normal 1: Low 0 Must be set to 0. 0 0 3 DRVH 2 1 0 Warm-Up Setting Register 7 CLKWUT (0xFFFF_D305) Bit Symbol Read/Write Reset Value Function WTHD R 1 Warm-up end flag 6 WTHW R/W 1 Warm-up operation enable 5 WTHT R/W 11 Oscillator warm-up time 00:2^8 clock cycles 01:2^12 clock cycles 10:2^14 clock cycles 11:2^16 clock cycles 4 3 R 0 1 2 1 R/W 1 1 0 0: Warming 0: No up 1: Complete warm-up 1: Enable warm-up operation Note 1: Note 2: The warm-up time set in the WTHT field is counted using the fosc clock. When the WTHW bit is set to 1, the warm-up time set in the WTHT field is automatically inserted before clock oscillation is started. At power-on, if a reset state is released without waiting for 2^16 clock cycles, the internal circuits may not be initialized properly. Note 3: During the warm-up period, no clock is supplied to the internal circuits. TMP19A71 5-5 TMP19A71 Mode Switch Register 7 CLKSPD (0xFFFF_D306) Bit Symbol Read/Write Reset Value Function R/W 6 SS W 1 Must be set to 1. 5 4 R/W 0 Must be set to 0. 0 3 2 1 R 0 0 0 1 00 Must be set Standby mode (Note 1) to 1. 00: NORMAL mode 01: STOP mode 10: Reserved 11: IDLE (Halt) mode Note 1: The CLKSPD.SS field selects the standby mode in combination with the RP bit of CP0's Status register, as shown in the table below. The X mark indicates that the WAIT instruction cannot be used in that mode. CLKSPD.SS NORMAL STOP Reserved IDLE 00 01 10 11 Halt RP=0 X STOP X Halt Doze RP=1 X X X Doze Note 2: Note 3: Each time the TMP19A71 is placed in a standby mode, set the CLKSPD.SS field before executing the WAIT instruction. The WAIT instruction should not be executed successively. To set the CLKSPD.SS field to a value other than 00, be sure to set 0x5A5A and 0xF0F0 to the CLKACT register exclusively to enable the CLKSPD.SS setting. If other clock generator registers are set at the same time, the settings may not be reflected correctly. Note 4: This register does not support bit manipulation instructions. TMP19A71 5-6 TMP19A71 Clock Gear Control Register 7 CLKPRSC (0xFFFF_D307) Bit Symbol Read/Write Reset Value Function 00 System clock (fsys) 00: 1/2 frequency 01: 1/4 frequency 10: 1/8 frequency 11:Reserved PRS1 R/W 000 IMCLK clock 000: 1/2 frequency 010: 1/3 frequency 100: 1/4 frequency 110: 1/5 frequency Others: Reserved 0 6 5 4 PRS2 3 2 1 R 0 0 0 Note: Before changing the system clock setting, make sure that all peripheral functions are stopped. 5.3.3 Interrupt Registers NMI Setting Register 7 6 NMISEN R/W 00 NMI sensitivity 00: Prohibited 11: Both edges 01: Rising edge 10: Falling edge 5 0 4 0 3 0 2 0 1 0 0 NMIBE R 0 CLKNMI setting enable 0: Enable 1: Disable CLKNMI (0xFFFF_D310) Bit Symbol Read/Write Reset Value Function Note 1: Setting this register causes the NMIBE bit to be set to 1, disabling any subsequent writes to this register until a reset is applied. Note 2: To use NMI, appropriate settings must be made in the relevant port registers. For details, see "8. I/O Ports". INT0 Setting Register 0 7 CLKW0 (0xFFFF_D312) Bit Symbol Read/Write Reset Value Function 6 5 R/W 0 0 0 0 0 Must be set Must be set Must be set Must be set INT0 to 0. to 0. to 0. to 0. interrupt type 0: Typical interrupt 1: Wake-up signaling 0 4 3 W0WE 2 1 R 0 0 0 Note: The W0WE bit must be set to 1 to use INT0 as the wake-up signaling to take the TMP19A71 out of STOP mode. TMP19A71 5-7 TMP19A71 INT0 Setting Register 1 7 CLKINT0 (0xFFFF_D31A) Bit Symbol Read/Write Reset Value Function INT0 sensitivity 001: Rising edge 010: Falling edge 011: Both edges 101: High level 110: Low level Others: Disable 6 I0SEN R/W 000 0 0 5 4 3 2 R 0 0 0 1 0 INT1 Setting Register 7 CLKINT1 (0xFFFF_D31B) Bit Symbol Read/Write Reset Value Function INT1 sensitivity 001: Rising edge 010: Falling edge 011: Both edges 101: High level 110: Low level Others: Disable 6 I1SEN R/W 000 5 4 R 0 3 I1KI R/W 0 INT1 interrupt type 0: Typical interrupt 1: Wake-up signaling 0 2 1 R 0 0 0 Note: The I1KI bit must be set to 1 to use INT1 as the wake-up signaling to take the TMP19A71 out of STOP mode. INT2 Setting Register 7 CLKINT2 (0xFFFF_D31C) Bit Symbol Read/Write Reset Value Function INT2 sensitivity 001: Rising edge 010: Falling edge 011: Both edges 101: High level 110: Low level Others: Disable 6 I2SEN R/W 000 5 4 R 0 3 I2KI R/W 0 INT2 interrupt type 0: Typical interrupt 1: Wake-up signaling 0 2 1 R 0 0 0 Note: The I2KI bit must be set to 1 to use INT2 as the wake-up signaling to take the TMP19A71 out of STOP mode. TMP19A71 5-8 TMP19A71 INT3 Setting Register 7 CLKINT3 (0xFFFF_D31D) Bit Symbol Read/Write Reset Value Function INT3 sensitivity 001: Rising edge 010: Falling edge 011: Both edges 101: High level 110: Low level Others: Disable 6 I3SEN R/W 000 5 4 R 0 3 I3KI R/W 0 INT3 interrupt type 0: Typical interrupt 1: Wake-up signaling 0 2 1 R 0 0 0 Note: The I3KI bit must be set to 1 to use INT3 as the wake-up signaling to take the TMP19A71 out of STOP mode. TMP19A71 5-9 TMP19A71 5.3.4 Reset Registers Clock Generator Setting Register (Mask-Version Product) 7 6 0 5 MSWDR R/W 0 0 WDT reset flag 0: No WDT reset 1: WDT reset occurred Note 1: Note 2: Note 3: reset. The MSWDR bit is not initialized by a WDT reset; it is initialized by an external reset. To clear this bit after a WDT reset occurred, it must be programmed to 0. The MSBC bit indicates whether or not new settings can be made to the CG registers. When MSBC = 1, the settings in the CG registers are in the middle of being changed after the CLKACT register is set. The MSBC bit must be cleared to 0 before new values can be written to the CG registers. 4 3 2 MSNMI R 0 0 00 Must be set Must be set NMI source flag to 0. to 0. 00: External pin 01: WDT 10: Bus error (store) 0 CG access flag 0: Access enabled 1: Access disabled 1 0 MSBC CLKMISC (0xFFFF_D30D) Bit Symbol Read/Write Reset Value Function Bits 7 to 5 of the CLKMISC register are not initialized by a WDT reset; they are initialized by an external Clock Generator Setting Register (Flash-Version Product) 7 CLKMISC (0xFFFF_D30D) Bit Symbol Read/Write Reset Value Function 0 Reset type 0: Poweron reset 1: Normal reset 0 Flash reset by WDT or external reset 0: Enable 1: Disable MSCW 6 MSFR 5 MSWDR R/W 0 WDT reset flag 0: No WDT reset 1: WDT reset occurred 0 0 00 4 3 2 MSNMI R 0 CG access flag 0: Access enabled 1: Access disabled Must be set Must be set NMI source flag to 0. to 0. 00: External pin 01: WDT 10: Bus error (store) 1 0 MSBC Note 1: Note 2: Note 3: Bits 7 to 5 of the CLKMISC register are not initialized by a normal reset; they are initialized by a power-on reset. The MSWDR bit is not initialized by a normal reset; it is initialized only by a power-on reset. To clear this bit after a WDT reset occurred, it must be programmed to 0. The MSCW bit is not initialized by a normal reset; it is initialized only by a power-on reset. This bit can be used as a flag to indicate whether a power-on or normal reset occurred by programming this bit to 1 after a power-on reset. This bit is not automatically set to 1 by a normal reset. Note 4: The MSBC bit indicates whether or not new settings can be made to the CG registers. When MSBC = 1, the settings in the CG registers are in the middle of being changed after the CLKACT register is set. The MSBC bit must be cleared to 0 before new values can be written to the CG registers. Note 5: When the MSFR bit is set to 1, the Flash ROM is not initialized by an external or WDT reset. To program or erase the Flash ROM, this bit should be set to 0. TMP19A71 5-10 TMP19A71 6. Watchdog Timer (WDT) The TMP19A71 contains a watchdog timer (WDT). The WDT is used to regain control of the system in the event of software system lockups due to spurious noises, etc. When a watchdog timer time-out occurs, the WDT generates a nonmaskable interrupt (NMI) or a reset exception to the TX19A core processor. 6.1 Operational Overview The WDT can be programmed to generate a reset or NMI upon time-out. When NMI is selected, a reset occurs upon counter overflow. 6.1.1 Generating an NMI (WDMOD.RESCR = 0) If the WDT counter is not cleared within the time-out period set in the WDMOD.FTP field, the WDT generates an NMI upon time-out. Then, the WDT continues counting. If the 23-bit binary counter is not cleared before it overflows (about 300 ms with IMCLK = 28 MHz), the WDT generates a reset exception. This causes the WDT to be initialized and start counting again with the default setting. Note: After an NMI occurs, save necessary data on the stack and wait for an overflow reset. WDT starts counting WDMOD.FTP NMI generated Reset by WDT overflow Figure 6.1.1 WDT Operation when WDMOD.RESCR=0 6.1.2 Generating a Reset (WDMOD.RESCR = 1) If the WDT counter is not cleared within the time-out period set in the WDMOD.FTP field, the WDT generates a reset exception upon time-out. A reset exception causes the WDT to be initialized and start counting again with the default setting. WDT starts counting WDMOD.FTP Reset, causing WDT to be cleared and start counting again Figure 6.1.2 WDT Operation when WDMOD.RESCR=1 TMP19A71 6-1 TMP19A71 6.2 Register Description The WDT is controlled by two control registers (WDMOD, WDCR) and a counter (WDCNT), as shown in Table 6.2.1. Table 6.2.1 WDT Register Map Address 0xFFFF_C830 0xFFFF_C831 0xFFFF_C834 0xFFFF_C838 Note: Number of Bits 168 8 8 16 WDMOD (L) (WDMODH) WDCR WDCNT Watchdog Timer Mode Register (Low) (Watchdog Timer Mode Register High) Watchdog Timer Control Register Watchdog Timer Count Register Mnemonic Register Name Although the WDMOD register is a 16-bit register, the lower 8 bits (WDMODL) and upper 8 bits (WDMODH) can be accessed separately. 6.2.1 Watchdog Timer Mode Register (WDMOD) Watchdog Timer Mode Register 7 6 5 FTP R/W 010 to 0. 0 Must be set WDT enable 0: Disable 1: Enable 1 to 0. 0 4 3 2 WDEN 1 0 RESCR R/W 0 0: NMI upon time-out 1: Reset exception upon time-out Must be set Reset type WDMOD(L) (0xFFFF_C830) Bit Symbol Read/Write Reset Value Function R 0 Can be Time-out period read as 0. 000: 2^12 (about 0.15 ms at IMCLK=28 MHz) 001: 2^13 (about. 0.29 ms at IMCLK=28 MHZ) 010: 2^14 (about 0.59 ms at IMCLK=28 MHz) 011: 2^15 (about 1.2 ms at IMCLK=28 MHz) 100: 2^16 (about 2.3 ms at IMCLK=28 MHz) 101: 2^19 (about 18.7 ms at IMCLK=28 MHz) 110: 2^21 (about 74.9 ms at IMCLK=28 MHz) 111: 2^22 (about 150 ms at IMCLK=28 MHz) 15 (WDMODH) (0xFFFF_C831) Bit Symbol Read/Write Reset Value Function 0 Must be set to 0. 14 R/W 0 Must be set to 0. 0 Must be set to 0. 0 Can be read as 0. 13 12 R 0 Can be read as 0. 11 10 9 R/W 000 8 Note: Do not change bits other than the WDEN bit while the WDT is operating. TMP19A71 6-2 TMP19A71 (1) First time-out period (WDMOD.FTP) This 3-bit field determines the duration of the WDT time-out interval. Upon reset, the FTP field is initialized to 010. Possible time-out intervals are shown in the register table. (2) WDT enable (WDMOD.WDEN) Upon reset, the WDEN bit is set to 1, enabling the WDT. To disable the WDT, the clearing of the WDEN bit must be followed by a write of a special disable code (B1H) to the WDCR register. This prevents a "lost" program from disabling the WDT operation. The WDT can be re-enabled simply by setting the WDEN bit. (3) WDT reset (WDMOD.RESCR) When RESCR=1, a reset exception is generated and the WDT is initialized upon WDT time-out. When RESCR=0, an NMI is generated upon WDT time-out and then a reset exception is generated upon counter overflow. TMP19A71 6-3 TMP19A71 6.2.2 Watchdog Timer Control Register (WDCR) This register is used to disable the WDT and to clear the WDT binary counter. Watchdog Timer Control Register 6 5 4 3 W B1H : WDT disable code 4E H: WDT clear-count code 7 Bit Symbol WDCR 0xFFFF_C834 Read/Write Reset Value Function 2 1 0 WDT disable and clear -count 0xB1 0x4E Others Note: This register does not support bit manipulation instructions. Disable code Clear-count code Invalid * Disabling the WDT The WDT can be disabled by clearing the WDMOD.WDEN to 0 and then writing the disable code (B1H) to the WDCR register. At this time, the counter value is maintained. Before enabling the WDT again, clear the counter by writing the clear-count code (4EH). WDMODL WDCR -----0-- 10110001 Clear the WDEN bit to 0. Write the disable code (B1H) to the WDCR. * Enabling the WDT The WDT can be enabled simply by setting the WDEN bit in the WDMOD to 1. * Clearing the WDT counter Writing the clear-count code (4EH) to the WDCR resets the binary counter to 0. The counting process begins again. WDCR 01001110 Write the clear-count code (4EH) to the WDCR. Watchdog Counter Register 7 Bit Symbol WDCNT Read/Write 0xFFFF_C838 Reset Value Function 6 5 4 R 0 3 2 1 0 15 Bit Symbol Read/Write Reset Value Function 14 13 12 R 0 11 10 9 8 Bits 22 to 7 of the WDT counter value can be read. TMP19A71 6-4 TMP19A71 7. 7.1 Exceptions/Interrupts Overview TMP19A71 has exceptions of 15 types including nonmaskable interrupt (NMI) and 49 maskable interrupt sources as listed below. Gereral Exceptions Reset exception Nonmaskable Interrupt (NMI) exception Address Error exception (Instruction Fetch) Address Error exception (Load/Store) Bus Error exception (Instruction Fetch) Bus Error exception (Data Access) Coprocessor Unusable exception Reserved Instruction exception Integer Overflow exception Trap exception System Call exception Breakpoint exception Debug Exceptions Single Step exception Debug Breakpoint exception Interrupts Maskable software interrupts (2 sources) Maskable hardware interrupts (37 internal sources and 10 external sources) TMP19A71 can process not only interrupt requests from on-chip peripheral hardware and external sources but also exceptions forcibly as measures of notification of error conditions arising in execution of general instructions. By using the register bank called "shadow register set" newly implemented in the TX19A processor core, it is now unnecessary to save the general-purpose register (GPR) contents elsewhere upon interrupt response thus leading to very fast interrupt response. Interrupt requests can be nested according to programmable priority of seven levels. It is also possible to mask interrupt requests of priority levels lower than the specified mask level. TMP19A71 7-1 TMP19A71 7.2 Exception Vectors An exception vector address is the entry address of a routine that handles an exeption. Reset and Nonmaksable Interrupt exceptions are vectored to address 0xBFC0_0000. A debug exception is vectored to 0xBFC0_0480 when the EJTAG ProbEn signal is 0 and 0xFF20_0200 when the EJTAG ProbEn signal is 1 according to the internal signal value of ProbEn.Values of other exceptions may be various depending on the BEV bit of the Status register and the IV bit of the Cause register belonging to the system control coprocessor (CP0). Table 7.2.1 Exception Vector Table (Virtual Addresses) Exception Type Reset, NMI Debug exception (En=0) Debug exception (En=1) Interrupt (IV=0) Interrupt (IV=1) Other general exceptions Note 1 BEV=0 0xBFC0_0000 0xBFC0_0480 0xFF20_0200 0x8000_0180 0x8000_0200 0x8000_0180 BEV=1 0xBFC0_0000 0xBFC0_0480 0xFF20_0200 0xBFC0_0380 0xBFC0_0400 0xBFC0_0380 : When exception vector addresses reside in the on-chip ROM, the BEV bit of the CP0 Status register must be set to 1. TMP19A71 has no external bus interface, so Status.BEV=0 is not allowed. Note 2 : To assign different exception vector addresses for interrupts and other general exceptions, set the IV bit of the CP0 Cause register to 1. 7.3 Reset Exception A Reset exception occurs when an external reset pin is driven low or the WDT counts to its reset value. As a Reset exception occurs, on-chip peripheral registers (Note 1) and CP0 registers are initialied, and a control jumps to the exception vector address 0xBFC0_0000. Upon a Reset exception, the PC value is stored in the CP0 ErrorEPC register. When a Reset exception occurs, the ERL bit of the CP0 Status register is set to 1, disabling interrupts. To use interrupts, the ERL bit must be cleared to 0 in the startup routine (reset exception handler) or by other means. For a detailed description of Reset exception handling, refer to the chapter Exception Handling Reset Exception in the 32-Bit TX19 System RISC TX19 Family Architecture manual. Note 1 : In the flash-version product, some on-chip peripheral registers are not initialized by a Reset exception; these registers are initialized only by the internal power-on reset signal that is generated at power-on. Note 2 : In the mask-version product, some on-chip registers are not initialized by a Reset exception caused by the WDT; these registers are initialized only by a Reset exception via an external reset pin. TMP19A71 7-2 TMP19A71 7.4 Nonmaskable Interrupt (NMI) A Nonmaskable Interrupt (NMI) occurs when an external NMI pin is asserted as specified by the NMISEN field of the CLKNMI register; the WDT counts to the NMI value; or the bus error area is accessed by a store access including DMA transfer when MODECR 7.5 General Exceptions (other than Reset Exception/NMI) A general exception occurs when a specific instruction such as the SYSCALL instruction is executed or an error condition such as an illegal instruction fetch is detected. When a general exception occurs with the Status.BEV bit set to 1, control jumps to the exception vector address 0xBFC0_380. The cause of a general exception can be determined by the ExCode field of the CP0 Cause register. The PC value at the time of a general exception is stored in the CP0 EPC register. However, a Bus Error exception (data access) is generated asynchronously to the instruction execution timing so that the PC is stored not at the instruction that caused the exception but at the instruction that is being executed when the exception is generated. Upon a general exception, when the shadow register set is enabled, SSCR Note 1 : No Address Error exception (load, store) occurs during DMA transfer. In this case, error conditions can be detected by the configuration error flag (the Conf bit of the CSRx register) in the DMAC. Note 2 : A Bus Error exception (data access) occurs during a load instruction or a load access by DMA transfer. TMP19A71 7-3 TMP19A71 Automatically jump to the exception vector address Handled by TX19A core Read the Cause.ExCode field to determine the cause of the exception Get the address of the exception handler routine Jump to the exception handler routine Save relevant registers on the stack Handled by user software Exception handler routine (Note 1) Restore the saved regisers from the stack ERET instruction Return to the address where the exception occurred Figure 7.5.1 General Exception Operation (Exceptions other than Reset or NMI) Note 1 : General exceptions (i.e. exceptions other than Reset exception or NMI) excluding Trap, System Call, and Breakpoint exceptions indicate error conditions; they are normally handled by a reset routine. Note 2 : For general exceptions (i.e. exceptions other than Reset exception or NMI) excluding Bus Error exception (instruction fetch, data access), the PC value is stored in the EPC register as the instruction that caused the exception. Therefore, if the ERET instruction is executed to resume execution from the saved PC address, the same exception may occur again. 7.6 Debug Exceptions Debug exceptions include Single-step and Debug Breakpoint exceptions. These exceptions are not normally used in user programs. Also enabling the shadow register set will not be effective in debug exceptions. For a detailed description of debug exception handling, refer to the chapter"Exception Handling Debug Exception"of the separate volume, TX19 Core Architecture. TMP19A71 7-4 TMP19A71 7.7 Maskable Software Interrupts The TMP19A71 provides two sources of maskable software interrupts (hereafter referred to as software interrupts). Each software interrupt can be generated by setting the corresponding bit in the IP[1:0] field of the CP0 Cause register. A software interrupt is accepted, at the fastest, 3 clock cycles after the IP[1:0] field of the CP0 Cause register is set. Software interrupt requests are accepted when all the following conditions are met: * The IM[1:0] field of the CP0 Status register is set to 1. * The IE bit of the CP0 Status register is set to 1. * The ERL and EXL bits of the CP0 Status register are cleared to 0. Each software interrupt can be masked by clearing the corresponding bit in the IM[1:0] field of the CP0 Status register. If a software interrupt and a hardware interrupt occur simultaneously, the hardware interrupt is given higher priority. Upon software interrupts, when Shadow Register Set is enabled, SSCR Note: Software interrupts are different from Software Set interrupts which are generated as maskable hardware interrupts to be described hereinafter. A hardware interrupt generation caused by setting the EIM00 field of the IMR00 register to 01 is called Software Set. TMP19A71 7-5 TMP19A71 Set Cause.IP[1:0] to 1 to generate an interrupt Handled by user software Automatically jump to the exception vector address Handled by TX19A core Read Cause.IP[1:0] to determine the cause of the interrupt Clear Cause.IP[1:0] to 0 to clear the interrupt Jump to the interrupt handler Save relevant registers on the stack Handled by user software Interrupt handler routine Restore the saved registers from the stack ERET instruction Return to the address where the interrupt occurred Figure 7.7.1 Example of Softwre Interrupt Operation Note: A software interrupt is accepted, at the fastest, 3 clock cycles after the interrupt is enabled, and the PC at this moment is stored in the EPC register. TMP19A71 7-6 TMP19A71 7.8 Maskable Hardware Interrupts Features 7.8.1 A maskable hardware interrupt (hereinafter referred to as hardware interrupt) is interrupt request of 47 sources that can set the seven interrupt levels of priority order individually with an interrupt controller (INTC). Hardware interrupt requests are accepted when all the following conditions are met: * The IM[4:2] field of the CP0 Status register is set to 1. * The IE bit of the CP0 Status register is set to 1. * The ERL and EXL bits of the CP0 Status register are cleared to 0. If two or more interrupt occur simultaneously, interrupt requests are accepted according to their priority levels. If interrupt requests of the same interrupt level occur simultaneously, the interrupt is accepted in ascending order starting with that of the smallest number (see Table 7.8.1). When a hardware interrupt request is accepted, the EXL bit of the CP0 Status register is set to 1 to disable interrupts, and the CMASK field of the ILEV register is automatically updated to the interrupt level of the accepted interrupt request. The IE bit of the CP0 Status register remains as has been set when an interrupt request is accepted. In hardware interrupts processing, each interrupt level is associated with a register bank called Shadow Register Set. When an interrupt request is accepted, the register bank is switched to the one whose number is the same number of corresponding interrupt level. Through this mechanism, there is no need for user program to save the general-purposed register (GPR) contents elsewhere upon interrupt response, thus a faster interrupt response is ensured. To use the Shadow Register Set, the SSD bit of the CP0 SSCR register must be cleared to 0. Once an interrupt request is accepted, further interrupt requests can be nested by clearing the EXL bit of the CP0 Status register to 0 to enable interrupts. At this time, the CMASK bit of the ILEV register of INTC is updated to the priority level whose interrupt request has been set, thus allows only interrupt requests with higher priority levels than the one it has been accepting. For details about interrupt nesting, refer to 7.8.9 Setting Example of Nesting Interrupt. Using the CMASK bit of the ILEV register enables masking an interrupt request of lower priority level than the masking level to a programmable. All interrupt requests can be used for triggering DMA transfer. Detailed operation of hardware interrupts is provided below. Also, refer to the chapter Exception Handling Maskable Interrupts (Interrupts) of the separate volume, TX19 Core Architecture. TMP19A71 7-7 TMP19A71 7.8.2 Hardware Interrupt Sources Table 7.8.1 Hardware Interrupt Sources (1/2) Interrupt Number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 IVR[8 : 0] 0x000 0x004 0x008 0x00C 0x010 0x014 0x018 0x01C 0x020 0x024 0x028 0x02C 0x030 0x034 0x038 0x03C 0x040 0x044 0x048 0x04C 0x050 0x054 0x058 0x05C 0x060 0x064 0x068 0x06C 0x070 0x074 0x078 0x07C 0x080 0x084 0x088 0x08C 0x090 0x094 0x098 0x09C 0x0A0 0x0A4 0x0A8 0x0AC 0x0B0 0x0B4 0x0B8 0x0BC 0x0C0 0x0C4 0x0C8 0x0CC 0x0D0 0x0D4 0x0D8 0x0DC Interrupt Name Software set INT0 Reserved Reserved Reserved Reserved INT1 INT2 INT3 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved INTPMD0 INTPMD1 INTEMG0 INTEMG1 INTENC INTTBCOM00 INTTBCOM01 INTTBCOM10 INTTBCOM11 INTTBCOM20 INTTBCOM21 INTTBCOM30 INTTBCOM31 INTTBE0 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved INTTX0 INTRX0 INTTX1 INTRX1 INTTX2 INTRX2 INTTX3 INTRX3 Interrupt Source Set IMR00.EIM00 to 01 INT0 pin --------INT1 pin INT2 pin INT3 pin ----------------------PMD0 count register (MDCNT0) match PMD1 count register (MDCNT1) match PMD0 EMG input (PA6) PMD1 EMG input (PB6) Encoder match TB0REG0 match/TB0CNT overflow TB0REG1 match TB1REG0 match/TB1CNT overflow TB1REG1 match TB2REG0 match/TB2CNT overflow TB2REG1 match TB3REG0 match/TB3CNT overflow TB3REG1 match TMRB0 EMG input (P93) ----------------------------UART0 transmit complete UART0 receive complete UART1 transmit complete UART1 receive complete SIO2/UART2 transmit complete SIO2/UART2 receive complete SIO3/UART3 transmit complete SIO3/UART3 receive complete IMR IMR00 (IMR01) (IMR02) (IMR03) IMR04 (IMR05) (IMR06) (IMR07) IMR08 (IMR09) (IMR10) (IMR11) IMR12 (IMR13) (IMR14) (IMR15) IMR16 (IMR17) (IMR18) (IMR19) IMR20 (IMR21) (IMR22) (IMR23) IMR24 (IMR25) (IMR26) (IMR27) IMR28 (IMR29) (IMR30) (IMR31) IMR32 (IMR33) (IMR34) (IMR35) IMR36 (IMR37) (IMR38) (IMR39) IMR40 (IMR41) (IMR42) (IMR43) IMR44 (IMR45) (IMR46) (IMR47) IMR48 (IMR49) (IMR50) (IMR51) IMR52 (IMR53) (IMR54) (IMR55) TMP19A71 7-8 TMP19A71 Table 7.8.2 Hardware Interrupt Sources (2/2) Interrupt Number 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 IVR[8 : 0] 0x0E0 0x0E4 0x0E8 0x0EC 0x0F0 0x0F4 0x0F8 0x0FC 0x100 0x104 0x108 0x10C 0x110 0x114 0x118 0x11C 0x120 0x124 0x128 0x12C 0x130 0x134 0x138 0x13C 0x140 0x144 0x148 0x14C 0x150 0x154 0x158 0x15C 0x160 0x164 0x168 0x16C 0x170 0x174 0x178 0x17C Interrupt Name INTDMA0 INTDMA1 INTDMA2 INTDMA3 INTDMA4 INTDMA5 INTDMA6 INTDMA7 Reserved Reserved Reserved Reserved INTAD0 INTADHP0 INTADM0 INTAD1 INTADHP1 INTADM1 INT4 INT5 INT6 INT7 INT8 INT9 Reserved Reserved Reserved Reserved INTTBCAP00 INTTBCAP01 INTTBCAP10 INTTBCAP11 INTTBCAP20 INTTBCAP21 INTTBCAP30 INTTBCAP31 Reserved Reserved Reserved Reserved Interrupt Source DMA0 transfer complete DMA1tranfer complete DMA2 transfer complete DMA3 transfer complete DMA4 transfer complete DMA5 transfer complete DMA6 transfer complete DMA7 transfer complete --------ADC0 conversion complete ADC0 highest-priority conversion complete ADC0 conversion value compare ADC1 conversion complete ADC1 highest-priority conversion complete ADC1 converson value compare INT4 pin INT5 pin INT6 pin INT7 pin INT8 pin INT9 pin --------TB0CAP1 capture TB0CAP0 capture TB1CAP1 capture TB1CAP0 capture TB2CAP1 capture TB2CAP0 capture TB3CAP1 capture TB3CAP0 capture --------IMR IMR56 (IMR57) (IMR58) (IMR59) IMR60 (IMR61) (IMR62) (IMR63) IMR64 (IMR65) (IMR66) (IMR67) IMR68 (IMR69) (IMR70) (IMR71) IMR72 (IMR73) (IMR74) (IMR75) IMR76 (IMR77) (IMR78) (IMR79) IMR80 (IMR81) (IMR82) (IMR83) IMR84 (IMR85) (IMR86) (IMR87) IMR88 (IMR89) (IMR90) (IMR91) IMR92 (IMR93) (IMR94) (IMR95) Note1: Although IMRxx is a 32-bit register, it is accessible by 8-bit or 16-bit one. i.e. making IMR00 be IMR00/IMR01/IMR02/IMR03 enables 8-bit access. Note2: Reserved is a reserved area for expansion. It is recommended to set the same value as initial, "0x00" to IMR register of a reserved area. TMP19A71 7-9 TMP19A71 7.8.3 Detection of Interrupt Requests An interrupt request detection varies by a source as shown in Table 7.8.3. All interrupt requests, after being detected, are sent to the INTC for priority arbitration and then sent to the TX19A core processor, as illustrated in Figure 7.8.1. For a detection level that can be used by each interrupt source, refer to Table 7.8.5. Table 7.8.3 Detecting Part of Interrupt Request Interrupt Type (1) External pin interrupt INT0 to INT3 (2) External pin interrupt INT4 to INT9 (3) Emergency stop interrupt INTEMGx (4) Emergency stop interrupt INTTBE0 (5) Other interrupts Detecting Part CG INTC Port Port INTC Interrupt Notification Route PortT CG (detection) INTC (arbitration) TX19A core Port INTC (detection/arbitration) TX19A core Pprt (detection) PMD INTC (arbitration) TX19A core Port (detection) INTC (arbitration) TX19A core Peripheral hardware INTC (detection/arbitration) TX19A core CG INTEMGx External Pin Interrupt INT0 to INT3 PMD TX19A Core IRC EMG Detection Circuit (Port) INTTBE0 Emergency stop interrupt INTEMGx/INTTBE0 Other interrupt Figure 7.8.1 Notification Route of Interrupt TMP19A71 7-10 TMP19A71 7.8.4 Interrupt Arbitration 1. Seven levels of interrupt priority The INTC can set seven levels of interrupt priority individually for each interrupt source. The ILxx field of the IMRxx register is used to set priority of each interrupt source. The larger the number of interrupt level is set, the higher the priority becomes. When the value is "000" (interrupt level = 0), the source does not eneble the interrupt. And, the source of an interrupt level 0 is not stored. 2. Interrupt level notification When an interrupt request occurs, the INTC compares the priority level of the request interrupt with the mask level set in the CMASK field of the ILEV register. When an interrupt request has a higher priority level than that of the mask level, the INTC sends the interrupt request to the TX19A core processor. If two or more interrupt requests occur simultaneously, the INTC sends the interrupt request in accordance with the established priorities. If two or more interrupt requests having the same priority level occur simultaneously, the INTC sneds the interrupt request in ascending order starting from the smallest number (see Table 7.8.1). If another interrupt request is made from the same interrupt source before the previous interrupt request is cleared, the INTC ignores the second interrupt request. 3. INTC Register Update When TX19A core accepts an interrupt request, its priority level is stored in the CMASK field of the ILEV register and the corresponding vector value is set to the IVR register. CMASK/IVR once set is not updated until IVR is read or sent to the core even though an interrupt request of higher level occurs. Note: Before changing the ILEV value, be sure to read the IVR value. If the ILEV value is changed without reading the IVR value, an unexpected interrupt may occur. 7.8.5 Hardware Interrupt Operation When a hardware interrupt is generated, TX19A core performs the following operations and a control jumps to the exception vector address according to the BEV bit of the CP0 Status register and the IV bit of the CP0 Cause register (see Table 7.2.1). 1. The EXL bit of the CP0 Status register is set to 1. 2. The PC value upon an interrupt generation is stored in the CP0 EPC register. 3. When Shadow Register Set is enabled (CP0 register SSCR TMP19A71 7-11 TMP19A71 When an interrupt occurs, automatically jump to the corresponding exception vector address Handled by TX19A core Read IVR to generate an interrupt vector address Clear the interrupt source in ICLR Read the interrupt handler address from the interrupt vector Jump to the interrupt handler Save relevant registers on the stack (Note) Handled by user software Interrupt handler routine Set ILEV.MLEV=0 to restore the mask level Restore the saved registers from the stack (Note) ERET instruction Return to the address where the interrupt occurred Figure 7.8.4 Basic Operation Sample of Hardware Interrupt Note: TX19A core can automatically save the most part of a general-purposed register by using Shadow Register Set (CP0 register SSCR TMP19A71 7-12 TMP19A71 7.8.6 Interrupt Initial Settings In Section 7.8.6.1, the initial settings common to all interrupts regardless of sources and in Section 7.8.6.2, the initial settings specific to each interrupt source are described, both as necessary settings before using interrupts. 7.8.6.1 Initial Settings Common to All Interrupts The following settings must be made in order to use interrupts. 1. Set the IM[4:2] field of the CP0 Status register to 111. 2. Set the base address of the interrupt vector table in bits 9 to 31 of the INTC IVR register. 3. Set an interrupt handler address for a respective interrupt source to the address, the sum of a base address of interrupt vector table and IVR[8:0] by interrupt source. Programming example for the above 1.: Using exeption vector address 0xBFC00400 lui addiu mtc0 r2,0x1040 r2,r2,0x1C00 r2,r12 ; CU0=1 ,BEV =1 (r2 =0x1040_xxxx) ; IM4,IM3,IM2 =1 (r2 =0x1040_1C00) Programming example for the above 2.: Using VectorTable as a label of the interrupt vector table lui addiu lui sw r3,hi(VectorTable) r3,r3,lo(VectorTable) r2,hi(IVR) r3,lo(IVR)(r2) ; r3 = VectorTable address ; r2 =0xFFFF_xxxx (upper 16 bits of address in IVR) ; Set VectorTable address in IVR[31:9] Programing example for the above 3.: Using address 0xBFC20000 as a base address of the interrupt vector table _VectorTable section code isa32 abs=0xBFC20000 VectorTable: dw dw dw dw dw dw dw dw dw dw _SWINT _INT0 _RESEARVED _RESEARVED _RESEARVED _RESEARVED _INT1 _INT2 _INT3 _RESEARVED ; 0 --- software interrupt ; 1 --- INT0 ; 2 --- Reserved ; 3 --- Reserved ; 4 --- Reserved ; 5 --- Reserved ; 6 --- INT1 ; 7 --- INT2 ; 8 --- INT3 ; 9 --- Reserved Note: These examples assume the use of a Toshiba assembler. When using a third-party assembler, modify them as necessary to avoid syntax errors. TMP19A71 7-13 TMP19A71 7.8.6.2 Initial Settings Specific to Each Interrupt Source The registers that must be set for using an interrupt varies by sources shown below: Table 7.8.5 Interrupt Detection and Setting Register Interrupt Type (1) External pin interrupts INT0 to INT3 Setting Regiser PxIER (Port) PxFR (Port) CLKINTx (CG) IMRxx (INTC) PxIER (Port) PxFR (Port) IMRxx (INTC) PxIER (Port) PxFR (Port) PxECR (Port) EMGCRx (PMD) IMRxx (INTC) P9IER (Port) P9FR2 (Port) P9ECR (Port) IMR33 (INTC) IMRxx (INTC) Supported Interrupt Sensitivity Settings Programmable as low level, high level, falling edge, or rising edge sensitive through the IxSEN field of the CLKINTx register in the CG. In the INTC, the EIMxx field of the IMRxx register must be set to falling edge or low level according to the setting made in the CG. Programmable as low level, high level, falling edge, or rising edge sensitive through the EIMxx field of the IMRxx register in the INTC. Programmable as low level, high level, falling edge, or rising edge sensitive through the ERMx field of the PxECR register in the port unit. In the INTC, the EIMxx field of the IMRxx register must be set to falling edge. (2) External pin interrupts INT4 to INT9 (3) Emergency stop interrupts INTEMGx (4) Emergency stop interrupt INTTBE0 (5) Other interrupts Programmable as low level, high level, falling edge, or rising edge sensitive through the ERM9 field of the P9ECR register in the port unit. In the INTC, the EIM33 field of the IMR33 register must be set to falling edge or low level. Must always be set as falling edge sensitive. Note: In level detection, a value is checked at internal clock timing each time. An edge is detected by comparing a previous value with a current value at internal clock timing. 1. External Pin Interrupts, INT0 to INT3 In the port unit, set the PxIER register to enable input (see 7. Port Function). In the port unit, set INT0 to INT3 as the pin function to the PxFR register (see 7. Port Function). In the CG, set Interrupt Sensitivity in the IxSEN field of the CLKINTx register (see 5.3.3 Interrupt Registers). In the CG, set Enable/Disable of Standby Cancel in the IxKI bit of the CLKINTx register (see 5.3.3 Interrupt Registers). In the INTC, set the EIMxx field of the IMRxx register to specify the sensitivity of the interrupt signal sent from the CG. When rising/falling edge is selected in the CLKINTx.IxSEN, set 10 to the IMRxx.EIMxx to select falling edge. When high/low level is selected in the CLKINTx.IxSEN, set 00 to the IMRxx.EIMxx to select low level (see 7.8.10 Register ). Note 1: To write to the CLKINTx register, it is necessary to write 0x5A5A and then 0xF0F0 in the CGACT register. Note 2: To initialize an interrupt, follow the interrupt detection route indicated in Table 7.8.3 and make the interrupt enable with the CP0 register. If any different setting order is used, an unexpected interrupt may be generated. So, be sure to clear interrupt sources before setting interrupt enable. Similarly, to disable an interrupt, make the interrupt disable with the CP0 register and then set the registers accordingly in the reverse order of interrupt detection route. TMP19A71 7-14 TMP19A71 Setting example: Using the external pin interrupt INT3 for waking up from STOP mode (rising edge) Status Setting example: Using the external pin interrupt INT3 for making it disable Status 2. External Pin Interrupts, INT4 to INT9 In the port unit, set the PxIER register to enable input (see 7. Port Function). In the port unit, set INT4 to INT9 as the pin function to the PxFR register (see 7. Port Function). In the INTC, set the EIMxx field of the IMRxx register to specify the sensitivity of the interrupt signal (see 7.8.10 Register ). Note 1: To initialize an interrupt, follow the interrupt detection route indicated in Table 7.8.3 and make the interrupt enable with the CP0 register. If any different setting order is used, an unexpected interrupt may be generated. So, be sure to clear interrupt sources before setting interrupt enable. Similarly, to disable an interrupt, make the interrupt disable with the CP0 register and then set the registers accordingly in the reverse order of interrupt detection route. Setting example: Using the external pin interrupt INT4 as H level Status TMP19A71 7-15 TMP19A71 3. Interrupt Halted, INTEMG0/INTEMG1 For detailed setting example, refer to the section 7.12 Usage Note of EMG Input Pin (PA6/PB6). In the port unit, set the ERMx field of PxECR register to be sensitive (see 7. Port Function). In the port unit, set Input Enable to the PxIER register (see 7. Port Function). In the port unit, set EMGx to the pin function of PxFR register (see 7. Port Function). In the PMD, set 1 to the EMGEN field of the EMGCRx register (see 12.3.4 Protection Circuit). Set 10 to IMRxx Note 1: To set PxECR of a port, set 0x55 to PxECLR of the port first and then 0xAA. Note 2: To initialize an interrupt, enable the interrupt in CP0 register after setting it by following the interrupt detection routine as shown in Table 7.8.3. If the setting order varies, an unexpected interrupt may be generated or unexpected transfer of EMG state may be made. When setting an interrupt to Enable, the interrupt sources and EMG state must be cleared to 0. Also be sure to set an interrupt in reverse order of the detection routine after disabling an interrupt in CP0 register when disabling an interrupt. 4. Interrupt Halted, INTTBE0 For detailed setting example, refer to the section 7.9.1 Usage Note of EMG Input Pin (P.93). In the port unit, set the ERM9 field of the P9ECR register to be sensitive (see 7. Port Function). In the port unit, set Input Enable to the port of P9IER register (see 7. Port Function). In the port unit, set EMG Input to the pin function of P9FR register (see 7. Port Function). Set 10 to IMR33 Note 1: To set PxECR of a port, set 0x55 to PxECLR of the port first and then 0xAA. Note 2: To initialize an interrupt, enable the interrupt in CP0 register after setting it by following the interrupt detection routine as shown in Table 7.8.3. If the setting order varies, an unexpected interrupt may be generated or unexpected transfer of EMG state may be made. When setting an interrupt to Enable, the interrupt sources and EMG state must be cleared to 0. Also be sure to set an interrupt in reverse order of the detection routine after disabling an interrupt in CP0 register when disabling an interrupt. 5. Other Hardware Interrupt Set the peripheral hardware to use. Set 10 to IMRxx Note 1: To initialize an interrupt, enable the interrupt in CP0 register after setting INTC. To disable an interrupt, set INTC after disabling it in the CP0 register. TMP19A71 7-16 TMP19A71 7.8.7 Enabling/Disabling Interrupts Here, it is described the procedure of enabling and disabling of interrupt being programmed. 7.8.7.1 Enabling Interrupts To enable interrupts, all the following three conditions must be satisfied in addition to the settings described in 7.8.6 Interrupt Initial Settings: The ERL bit of the CP0 Status register is cleared to 0. The EXL bit of the CP0 Status register is cleared to 0. The IE bit of the CP0 Status register is set to 1. When an instruction which makes these settings is executed, interrupts are enabled and the register setting takes effect after two clock cycles. The IE bit of the CP0 Status register can be set to 1 in the following four ways: Set the IE bit of the CP0 Status register to 1 using the MTC0 instruction of 32-bit ISA. Set the CP0 IER register to a value other than 0 using the MTC0 instruction of 32-bit ISA (see Note 1.) Set the IE bit of the CP0 Status register to 1 using the MTC0 instruction of 16-bit ISA. Execute the EI instruction of 16-bit ISA (see Note 2.) Note 1: It is recommended to use this measure when enabling an interrupt for 32-bit ISA because of the code efficiency. In Toshiba's C compiler, too, this instruction is executed for __EI() intrinsic function of 32-bit ISA. Note 2: It is recommended to use this measure when enabling an interrupt for 16-bit ISA because of the code efficiency. In Toshiba's C compiler, too, this instruction is executed for __EI() intrinsic function of 16-bit ISA. Note 3: Of the above four methods, we recommend using the second or fourth because of smaller code size and faster execution. TMP19A71 7-17 TMP19A71 7.8.7.2 Disabling Interrupts Interrupts are disabled if any of the following three conditions is satisfied. When interrupts are disabled in this way, interrupt requests from interrupt sources that have been enabled in the initial setting (see 7.8.6 Interrupt Initial Settings) remain pending. Note that the TMP19A71 does not latch interrupt requests from interrupt sources whose level is set to 0. The ERL bit of the CP0 Status register is set to 1. The EXL bit of the CP0 Status register is set to 1. The IE bit of the CP0 Status register is cleared to 0. Execution of an instruction which makes these settings immediately disables interrupts and the register setting takes effect after two clock cycles. The ERL and EXL bits of the CP0 Status registrer are automatically set when an interrupt or exception occurs, and are automatically cleared when the ERET instruction is executed. Therefore, for disabling interrupts, we recommend using the third method, i.e., clearing the IE bit of the CP0 Status register to 0. For how to disable interrupts when interrupt nesting is used, see 7.8.9 Setting Example of Nesting Interrupt. The IE bit of the CP0 Status register can be cleared to 0 in the following four ways: Clear the IE bit of the CP0 Status register to 0 using the MTC0 instruction of 32-bit ISA. Clear the CP0 IER register to 0 using the MTC0 istruction of 32-bit ISA (see Note 1). Clear the IE bit of the CP0 Status register to 0 using the MTC0 instruction of 16-bit ISA. Execute the DI instruction of 16-bit ISA (see Note 2). Note 1: It is recommended to use this measure when disabling an interrupt for 32-bit ISA because of the code efficiency. In Toshiba's C compiler, too, this instruction is executed for __DI() intrinsic function of 32-bit ISA. Note 2: It is recommended to use this measure when disabling an interrupt for 16-bit ISA because of the code efficiency. In Toshiba's C compiler, too, this instruction is executed for __DI() intrinsic function of 16-bit ISA. Note 3: Of the above four methods, we recommend using the second or fourth because of smaller code size and faster execution. To disable individual source of interrupt that has been enabled once after its level is set with IMRxx Programming example for disabling interrupt sources individually mtc0 sb sync mtc0 r29, IER r0, IER r0, IMRxx ; Disable interrupts (Clear Status Note1: This programming example is of the time when using Toshiba's assembler. When the third-party assembler is used, programming error may occur. The program should be changed according to an assembler to use. TMP19A71 7-18 TMP19A71 7.8.8 Interrupt Handling Here, the detailed operation is described based on the basic flow of Figure 7.8.4. 7.8.8.1 Interrupt Response and Restore After an interrupt request arbitration, INTC sets the interrupt vector and interrupt level of the interrupt request accepted to IVR and ILEV 1. Interrupt Accepted by Hardware TMP19A71 7-19 TMP19A71 Interrupt Detection Compared to ILEV Low NO NO 0 NO Interrupt suspended Set 1 to Cause Set 0 to Cause Set 0x00 to Cause If Cause Jump to Exception Vector Address Figure 7.8.2 Sequence of Interrupt Accepted by Hardware TMP19A71 7-20 TMP19A71 2. Process Necessary for Exception Handler After an interrupt request is accepted, it automatically jumps to the exception handler in which the interrupt vector address is read from INTC IVR, and the user program generates the address of the interrupt handler. As in the example statements presented in Section 7.8.6 Interrupt Initial Setting, an interrupt vector base address is set in the range of IVR[31:8], thus the IVR value becomes the interrupt vector address. After reading the INTC IVR value, an interrupt source is cleared. If the interrupt source is cleared before IVR is read, no correct value can be read because the IVR value is also cleared. Programming example of exception handlers: when exception vector address (interrupt) is 0xBFC0_0400 VECTOR_INT section code isa32 abs=0xBFC00400 __InterruptVector: lui lw lui sh lw jr nop Note 1: This programming example is of the case Toshiba's assembler is used. When the third-party assembler is used, syntax error may occur. Program should be changed according to an assembler to use. r26,hi(IVR) r26,lo(IVR)(r26) r27,hi(ICLR) r26,lo(ICLR)(r27) r26,0(r26) r26 ; Clear interrupt request ; Read interrupt handler address from interrupt vector ; Jump to interrupt handler ; Read interrupt vector address from IVR 3. Process Necessary for Interrupt Handler Typical tasks of the interrupt handler are to save appropriate registers and to process interrupts. If the shadow register set is enabled (CP0 register SSCR Note 1: Since general exceptions are accepted even when interrupts are disabled, it is recommended to save general-purposed registers and CP0 register that may be rewritten by general exceptions even when nesting interrupts is not to be used. TMP19A71 7-21 TMP19A71 Setting example necessary for interrupt handler SSCR Save on the stack EPC Save on the stack Status Save on the stack NOP instruction NOP instruction Status Note 1: After rewriting SSCR of CP0 register, wait for two instructions to allow for register bank switching and then access to the register. 4. Restore From Interrupt Handler To restore from an interrupt handler to the main process, restore the register saved at the head of the interrupt handler and set 0 to INTC ILEV Setting example of restoring from interrupt handler Status Note 1: After rewriting SSCR of CP0 register, wait for two instructions to allow for register bank switching and then access to the register. Note 2: Do not access CP0 register two instructions prior to the execution of ERET instruction. Note 3: After ERET instruction execution, NOP instruction must be set (only for TMP19A70). TMP19A71 7-22 TMP19A71 7.8.9 Setting Example of Nesting Interrupt Nesting interrupt is the processing of the interrupt request of higher priority during the processing of some other interrupts. TMP19A71 can perform nesting interrupt because INTC arbitrates the priority of interrupts. When an interrupt request is accepted, ILEV Note1: Some of the registers are automatically saved and restored by using interrupt functions of Toshiba's C compilier. For details, refer to the additional document of TX19 Toshiba C compiler, TX19A C Compiler Reference. 2. Additional restoration required for nesting interrupts Before restoring registers in the restoration from interrupts, it is necessary to disable interrupts in the way described in 7.8.7.2 Interrupt Disabled. This is to prevent a restored register value from being corrupted by nesting interrupts. The ERET instruction automatically clears Status TMP19A71 7-23 TMP19A71 7.8.9.1 Interrupt Control for Nesting Interrupt Save Process Nesting Interrupt Enabled Restore Process Status Interrupt Enabled Interrupt Enabled Interrupt Enabled Status Interrupt Generation Status Status ERET Instruction Status Figure 7.8.3 1. Status Interrupt Enabled/Disabled of Nesting Interrupt Control Enabling interrupts becomes possible by setting 1 to Status TMP19A71 7-24 TMP19A71 7.8.10 7.8.10.1 Register Register Map Table 7.8.6 INTC Register Map Address 0xFFFF_D000 0xFFFF_D004 0xFFFF_D008 0xFFFF_D00C 0xFFFF_D010 0xFFFF_D014 0xFFFF_D018 0xFFFF_D01C 0xFFFF_D020 0xFFFF_D024 0xFFFF_D028 0xFFFF_D02C 0xFFFF_D030 0xFFFF_D034 0xFFFF_D038 0xFFFF_D03C 0xFFFF_D040 0xFFFF_D044 0xFFFF_D048 0xFFFF_D04C 0xFFFF_D050 0xFFFF_D054 0xFFFF_D058 0xFFFF_D05C 0xFFFF_D080 0xFFFF_D084 0xFFFF_D088 Mnemonic IMR00 IMR04 IMR08 IMR12 IMR16 IMR20 IMR24 IMR28 IMR32 IMR36 IMR40 IMR44 IMR48 IMR52 IMR56 IMR60 IMR64 IMR68 IMR72 IMR76 IMR80 IMR84 IMR88 IMR92 IVR ICLR ILEV Register Name Interrupt Mode Control Register 00 Interrupt Mode Control Register 04 Interrupt Mode Control Register 08 Interrupt Mode Control Register 12 Interrupt Mode Control Register 16 Interrupt Mode Control Register 20 Interrupt Mode Control Register 24 Interrupt Mode Control Register 28 Interrupt Mode Control Register 32 Interrupt Mode Control Register 36 Interrupt Mode Control Register 40 Interrupt Mode Control Register 44 Interrupt Mode Control Register 48 Interrupt Mode Control Register 52 Interrupt Mode Control Register 56 Interrupt Mode Control Register 60 Interrupt Mode Control Register 64 Interrupt Mode Control Register 68 Interrupt Mode Control Register 72 Interrupt Mode Control Register 76 Interrupt Mode Control Register 80 Interrupt Mode Control Register 84 Interrupt Mode Control Register 88 Interrupt Mode Control Register 92 Interrupt Vector Register Interrupt Request Clear Register Interrupt Mask Level Register Corresponding Interrupt Number 0 -3 4-7 8 - 11 12 - 15 16 - 19 20 - 23 24 - 27 28 - 31 32 - 35 36 - 39 40 - 43 44 - 47 48 - 51 52 - 55 56 - 59 60 - 63 64 - 67 68 - 71 72 - 75 76 - 79 80 - 83 84 - 87 88 - 91 92 - 95 All (0 - 95) All (0 - 95) All (0 - 95) Note 1: While an interrupt mode control register (IMRxx) is 32-bit register, it is accesible by 16-bit and 8-bit ones. Note 2: The interrupt number to which Reserved is set in Table 7.8.1 Hardware Interrupt Sources is a reserved area for expansion. 0, the same value as initial value shall be set to interrupt mode control registers (IMRxx) of relevant interrupt number. TMP19A71 7-25 TMP19A71 7.8.10.2 Interrupt Vector Register (IVR) IVR is the register indicating an interrupt vector address of interrupt source generated. When an interrupt request is accepted, the corresponding values to Table 7.8.1 is set to IVR[8:2]. IVR[31:9] are the bits readable and writable. By setting a base address of interrupt vecter, an interrupt vector address can be generated easily only by reading IVR. Interrupt Vector Register 7 IVR (0xFFFF_D080) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 0 0 0 0 0 14 0 13 0 12 R/W 0 0 0 0 IVR7 6 IVR6 5 IVR5 4 IVR4 R 0 11 0 10 0 9 0 8 IVR8 R 0 A vector of interrupt source being generate d is set. 23 Bit Symbol Read/Write Reset Value Function 31 Bit Symbol Read/Write Reset Value Function 0 0 0 0 30 29 28 R/W 0 0 0 0 27 26 25 24 0 0 0 0 22 21 20 R/W 0 0 0 0 19 18 17 16 A vector of interrupt source being generated is set. 3 IVR3 2 IVR2 1 0 TMP19A71 7-26 TMP19A71 7.8.10.3 Interrupt Level Register (ILEV) ILEV is the register that controls a level notifying interrupt requests fromINTC to TX19A processor core. Those under the interrupt level ILEV Interrupt Level Register 7 ILEV (0xFFFF_D088) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 23 Bit Symbol Read/Write Reset Value Function 31 Bit Symbol Read/Write Reset Value Function MLEV W 0 0:Mask level restored 1:CMASK changed 000 Interrupt mask level (previous) 6 0 30 000 Interrupt mask level (previous) 4 29 PMASK6 28 27 R 0 000 Interrupt mask level (previous) 5 0 22 000 Interrupt mask level (previous) 2 21 PMASK4 R 0 26 000 Interrupt mask level (previous) 3 25 PMASK5 24 20 19 0 14 6 5 PMASK0 R 000 Interrupt mask level (previous) 0 13 PMASK2 R 0 18 000 Interrupt mask level (previous )1 17 PMASK3 16 12 11 0 10 4 3 2 1 CMASK R/W 000 Interrupt mask level (current) 9 PMASK1 8 0 Note 1: Note 2: This register must be accessed as a 32-bit quantity. Before changing the ILEV value, be sure to read the IVR value. If the ILEV value is changed without reading the IVR value, an unexpected interrupt may be generated. Note 3: Interrupt generation This register does not support bit manipulation instructions. PMAS PMAS PMAS PMAS PMAS PMAS PMAS CMAS New interrupt level PMAS "000" PMAS PMAS PMAS PMAS PMAS PMAS PMAS CMAS PMAS PMAS PMAS PMAS PMAS PMAS CMAS TMP19A71 7-27 TMP19A71 7.8.10.4 Interrupt Mode Control Registers (IMRxx) IMRxx consists of: Interrupt Mode Control Registers 7 IMR00 (0xFFFF_D000) Bit Symbol Read/Write Reset Value Function R 0 00 Interrupt request Setting this field to 01 generates an interrupt. 6 EIM00 R/W 0 DMAC trigger 0: Disable 1:Enable interrupt number 0 as DMAC trigger 12 DM01 R/W 00 Sensitivity of interrupt requests is set. When Sensitivity in CG is Edge, 10 shall be set, and when is Level, 00 shall be set. 0 DMAC trigger 0: Disable 1: Enable interrupt number 1 as DMAC trigger 20 R/W 00 Must be set as 00. 31 (IMR03) (0xFFFF_D003) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 000. 30 R/W 0 Must be set as 0. 29 0 Must be set as 0. 28 27 R 0 19 R 0 11 R 0 5 4 DM00 3 R 0 2 1 IL00 R/W 000 When DM00 = 0 Interrupt number 0 (software set) priority level 000: Interrupt disabled 001-111: 1-7 When DM00 = 1 DMAC channel select 000-111: 0-7 10 9 IL01 R/W 000 When DM01 = 0 Interrupt number 1 (INT0) priority level 000: Interrupt disabled 001-111: 1-7 When DM01 = 1 DMAC channel select 000-111: 0-7 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 15 (IMR01) (0xFFFF_D001) Bit Symbol Read/Write Reset Value Function R 0 14 EIM01 13 23 (IMR02) (0xFFFF_D002) Bit Symbol Read/Write Reset Value Function R 0 22 21 TMP19A71 7-28 TMP19A71 Interrupt Mode Control Registers 7 IMR04 (0xFFFF_D004) Bit Symbol Read/Write Reset Value Function 15 (IMR05) (0xFFFF_D005) Bit Symbol Read/Write Reset Value Function 23 (IMR06) (0xFFFF_D006) Bit Symbol Read/Write Reset Value Function R 0 00 Sensitivity of interrupt requests is set. When Sensitivity in CG is Edge, 10 shall be set, and when is Level, 00 shall be set. R 0 00 Must be set as 00. 22 EIM06 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 6 as DMAC trigger 28 DM07 R/W 00 Sensitivity of interrupt requests is set. When Sensitivity in CG is Edge, 10 shall be set, and when is Level, 00 shall be set. 0 DMAC trigger 0:Disable 1: Enable interrupt number 7 as DMAC trigger 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 DM06 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 IL06 R/W 000 When DM06 = 0 Interrupt number 6 (INT1) priority level 000: Interrupt disabled 001-111: 1-7 When DM06 = 1 DMAC channel select 000-111: 0-7 26 25 IL07 R/W 000 When DM07 = 0 Interrupt number 7 (INT2) priority level 000: Interrupt disabled 001-111: 1-7 When DM07 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 31 (IMR07) (0xFFFF_D007) Bit Symbol Read/Write Reset Value Function R 0 30 EIM07 29 TMP19A71 7-29 TMP19A71 Interrupt Mode Control Registers 7 IMR08 (0xFFFF_D008) bit Symbol Read/Write Reset Value Function R 0 00 Sensitivity of interrupt requests is set. When Sensitivity in CG is Edge, 10 shall be set, and when is Level, 00 shall be set. 6 EIM08 R/W 0 DMAC trigger 0: Disable 1:Enable interrupt number 8 as DMAC trigger 12 R/W 00 Must be set as 00. 23 (IMR10) (0xFFFF_D00A) Bit Symbol Read/Write Reset Value Function 31 (IMR11) (0xFFFF_D00B) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 22 R/W 0 Must be set as 0. 28 27 R 0 21 0 Must be set as 0. 20 19 R 0 11 R 0 5 4 DM08 3 R 0 2 1 IL08 R/W 000 When DM08 = 0 Interrupt number 8 (INT3) priority level 000: Interrupt disabled 001-111: 1-7 DM08 = 1 DMAC channel select 000-111: 0-7 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 15 (IMR09) (0xFFFF_D009) Bit Symbol Read/Write Reset Value Function R 0 14 13 TMP19A71 7-30 TMP19A71 Interrupt Mode Control Registers 7 IMR12 (0xFFFF_D00C) Bit Symbol Read/Write Reset Value Function 15 (IMR13) (0xFFFF_D00D) Bit Symbol Read/Write Reset Value Function 23 (IMR14) (0xFFFF_D00E) Bit Symbol Read/Write Reset Value Function 31 (IMR15) (0xFFFF_D00F) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-31 TMP19A71 Interrupt Mode Control Registers 7 IMR16 (0xFFFF_D010) Bit Symbol Read/Write Reset Value Function 15 (IMR17) (0xFFFF_D011) Bit Symbol Read/Write Reset Value Function 23 (IMR18) (0xFFFF_D012) Bit Symbol Read/Write Reset Value Function 31 (IMR19) (0xFFFF_D013) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-32 TMP19A71 Interrupt Mode Control Registers 7 IMR20 (0xFFFF_D014) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM20 R/W 0 DMAC trigger 0:Disable 1: Enable interrupt number 20 as DMAC trigger 12 DM21 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 21 as DMAC trigger 20 DM22 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0:Disable 1: Enable interrupt number 22 as DMAC trigger 28 DM23 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 23 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM20 3 R 0 2 1 IL20 R/W 000 When DM20 = 0 Interrupt number 20 (INTPMD0) priority level 000: Interrupt disabled 001-111: 1-7 When DM20 = 1 DMAC channel select 000-111: 0-7 10 9 IL21 R/W 000 When DM21 = 0 Interrupt number 21 (INTPMD1) priority level 000: Interrupt disabled 001-111: 1-7 When DM21 = 1 DMAC channel select 000-111: 0-7 18 17 IL22 R/W 000 When DM22 = 0 Interrupt number 22 (INTEMG0) priority level 000: Interrupt disabled 001-111: 1-7 When DM22 = 1 DMAC channel select 000-111: 0-7 26 25 IL23 R/W 000 When DM23 = 0 Interrupt number 23 (INTEMG0) priority level 000: Interrupt disabled 001-111: 1-7 When DM23 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR21) (0xFFFF_D015) Git Symbol Read/Write Reset Value Function R 0 14 EIM21 13 23 (IMR22) (0xFFFF_D016) Bit Symbol Read/Write Reset Value Function R 0 22 EIM22 21 31 (IMR23) (0xFFFF_D017) Bit Symbol Read/Write Reset Value Function R 0 30 EIM23 29 TMP19A71 7-33 TMP19A71 Interrupt Mode Control Registers 7 IMR24 (0xFFFF_D018) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM24 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 24 as DMAC trigger 12 DM25 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 25 as DMAC trigger 20 DM26 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 26 as DMAC trigger 28 DM27 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable intrrupt number 27 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM24 3 R 0 2 1 IL24 R/W 000 When DM24 = 0 Interrupt number 24 (INTENC) priority level 000: Interrupt disabled 001-111: 1-7 When DM24 = 1 DMAC channel select 000-111: 0-7 10 9 IL25 R/W 000 When DM25 = 0 Interrupt number 25 (INTTBCOM00) priority level 000: Interrupt disabled 001-111: 1-7 When DM25 = 1 DMAC channel select 000-111: 0-7 18 17 IL26 R/W 000 When DM26 = 0 Interrupt number 26 (INTTBCOM01) priority level 000: Interrupt disabled 001-111: 1-7 When DM26 = 1 DMAC channel select 000-111: 0-7 26 25 IL27 R/W 000 When DM27 = 0 Interrupt number 27 (INTTBCOM10) priority level 000: Interrupt disabled 001-111: 1-7 When DM27 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR25) (0xFFFF_D019) Bit Symbol Read/Write Reset Value Function R 0 14 EIM25 13 23 (IMR26) (0xFFFF_D01A) Bit Symbol Read/Write Reset Value Function R 0 22 EIM26 21 31 (IMR27) (0xFFFF_D01B) Bit Symbol Read/Write Reset Value Function R 0 30 EIM27 29 TMP19A71 7-34 TMP19A71 Interrupt Mode Control Registers 7 IMR28 (0xFFFF_D01C) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM28 R/W 0 DMAC trigger 0: Disable 1: Enable intrrupt number 28 as DMAC trigger 12 DM29 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 29 as DMAC trigger 20 DM30 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 30 as DMAC trigger 28 DM31 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 31 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM28 3 R 0 2 1 IL28 R/W 000 When DM28 = 0 Interrupt number 28 (INTTBCOM11) priority level 000: Interrupt disabled 001-111: 1-7 When DM28 = 1 DMAC channel select 000-111: 0-7 10 9 IL29 R/W 000 When DM29 = 0 Interrupt number 29 (INTTBCOM20) priority level 000: Interrupt disabled 001-111: 1-7 When DM29 = 1 DMAC channel select 000-111: 0-7 18 17 IL30 R/W 000 When DM30 = 0 Interrupt number 30 (INTTBCOM21) priority level 000: Interrupt disabled 001-111: 1-7 When DM30 = 1 DMAC channel select 000-111: 0-7 26 25 IL31 R/W 000 When DM31 = 0 Interrupt number 31 (INTTBCOM30) priority level 000: Interrupt disabled 001-111: 1-7 When DM31 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR29) (0xFFFF_D01D) Bit Symbol Read/Write Reset Value Function R 0 14 EIM29 13 23 (IMR30) (0xFFFF_D01E) Bit Symbol Read/Write Reset Value Function R 0 22 EIM30 21 31 (IMR31) (0xFFFF_D01F) Bit Symbol Read/Write Reset Value Function R 0 30 EIM31 29 TMP19A71 7-35 TMP19A71 Interrupt Mode Control Registers 7 IMR32 (0xFFFF_D020) Bit Symbol Read/Write Reset Value Funcion R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM32 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 32 as DMAC trigger 12 DM33 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 33 as DMAC trigger 20 R/W 00 Must be set as 00. 31 (IMR35) (0xFFFF_D023) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 0 Must be set as 0. 28 27 R 0 19 R 0 11 R 0 5 4 DM32 3 R 0 2 1 IL32 R/W 000 When DM32 = 0 Interrupt number 32 (INTTBCOM31) priority level 000: Interrupt disabled 001-111: 1-7 When DM32 = 1 DMAC channel select 000-111: 0-7 10 9 IL33 R/W 000 When DM33 = 0 Interrupt number (INTTBE0) priority level 000: Interrupt disabled 001-111: 1-7 When DM33 = 1 DMAC channel select 000-111: 0-7 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000 24 16 8 0 15 (IMR33) (0xFFFF_D021) Bit Symbol Read/Write Reset Value Function R 0 14 EIM33 13 23 (IMR34) (0xFFFF_D022) Bit Symbol Read/Write Reset Value Function R 0 22 21 TMP19A71 7-36 TMP19A71 Interrupt Mode Control Registers 7 IMR36 (0xFFFF_D024) Bit Symbol Read/Write Reset Value Function 15 (IMR37) (0xFFFF_D025) Bit Symbol Read/Write Reset Value Function 23 (IMR38) (0xFFFF_D026) Bit Symbol Read/Write Reset Value Function 31 (IMR39) (0xFFFF_D027) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-37 TMP19A71 Interrupt Mode Control Registers 7 IMR40 (0xFFFF_D028) Bit Symbol Read/Write Reset Value Function 15 (IMR41) (0xFFFF_D029) Bit Symbol Read/Write Reset Value Function 23 (IMR42) (0xFFFF_D02A) Bit Symbol Read/Write Reset Value Function 31 (IMR43) (0xFFFF_D02B) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-38 TMP19A71 Interrupt Mode Control Registers 7 IMR44 (0xFFFF_D02C) Bit Symbol Read/Write Reset Value Function 15 (IMR45) (0xFFFF_D02D) Bit Symbol Read/Write Reset Value Function 23 (IMR46) (0xFFFF_D02E) Bit Symbol Read/Write Reset Value Function 31 (IMR47) (0xFFFF_D02F) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-39 TMP19A71 Interrupt Mode Control Registers 7 IMR48 (0xFFFF_D030) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM48 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 48 as DMAC trigger 12 DM49 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 49 as DMAC trigger 20 DM50 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 50 as DMAC trigger 28 DM51 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 51 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM48 3 R 0 2 1 IL48 R/W 000 When DM48 = 0 Intrrupt number 48 (INTTX0) priority level 000: Interrupt disabled 001-111: 1-7 When DM48 = 1 DMAC channel select 000-111: 0-7 10 9 IL49 R/W 000 When DM49 = 0 Interrupt number 49(INTRX0) priority level 000: Interrupt disabled 001-111: 1-7 When DM49 = 1 DMAC channel select 000-111: 0-7 18 17 IL50 R/W 000 When DM50 = 0 Interrupt number 50 (INTTX1) priority level 000: Interrupt disabled 001-111: 1-7 When DM50 = 1 DMAC channel select 000-111: 0-7 26 25 IL51 R/W 000 When DM51 = 0 Interrupt number 51(INTRX1) priority level 000: Interrupt disabled 001-111: 1-7 When DM51 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR49) (0xFFFF_D031) Bit Symbol Read/Write Reset Value Function R 0 14 EIM49 13 23 (IMR50) (0xFFFF_D032) Bit Symbol Read/Write Reset Value Function R 0 22 EIM50 21 31 (IMR51) (0xFFFF_D033) Bit Symbol Read/Write Reset Value Function R 0 30 EIM51 29 TMP19A71 7-40 TMP19A71 Interrupt Mode Control Registers 7 IMR52 (0xFFFF_D034) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM52 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 52 as DMAC trigger 12 DM53 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 53 as DMAC trigger 20 DM54 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 54 as DMAC trigger 28 DM55 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 55 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM52 3 R 0 2 1 IL52 R/W 000 When DM52 = 0 Intrrupt number 52 (INTTX2) priority level 000: Interrupt disabled 001-111: 1-7 When DM52 = 1 DMAC channel select 000-111: 0-7 10 9 IL53 R/W 000 When DM53 = 0 Interrupt number 53 (INTRX2) priority level 000: Interrupt disabled 001-111: 1-7 When DM53 = DMAC channel select 000-111: 0-7 18 17 IL54 R/W 000 When DM54 = 0 Interrupt number 54 (INTTX3) priority level 000: Interrupt disabled 001-111: 1-7 When DM54 = 1 DMAC channel select 000-111: 0-7 26 25 IL55 R/W 000 When DM55 = 0 Interrupt number 55 (INTRX3) priority level 000: Interrupt disabled 001-111: 1-7 When DM55 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR53) (0xFFFF_D035) Bit Symbol Read/Write Reset Value Function R 0 14 EIM53 13 23 (IMR54) (0xFFFF_D036) Bit Symbol Read/Write Reset Value Function R 0 22 EIM54 21 31 (IMR55) (0xFFFF_D037) Bit Symbol Read/Write Reset Value Function R 0 30 EIM55 29 TMP19A71 7-41 TMP19A71 Interrupt Mode Control Registers 7 IMR56 (0xFFFF_D038) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM56 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 56 as DMAC trigger 12 DM57 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 57 as DMAC trigger 20 DM58 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 58 as DMAC trigger 28 DM59 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 59 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM56 3 R 0 2 1 IL56 R/W 000 When DM56 = 0 Interrupt number 56 (INTDMA0) peiority level 000: Interrupt disabled 001-111: 1-7 When DM56 = 1 DMAC channel select 000-111: 0-7 10 9 IL57 R/W 000 When DM57 = 0 Interrupt number 57 (INTDMA1) priority level 000: Interrupt disabled 001-111: 1-7 When DM57 = 1 DMAC channel select 000-111: 0-7 18 17 IL58 R/W 000 When DM58 = 0 Interrupt number 58 INTDMA2 priority level 000: Interrupt disabled 001-111: 1-7 When DM58 = 1 DMAC channel select 000-111: 0-7 26 25 IL59 R/W 000 When DM59 = 0 Interrupt number 59 (INTDMA3) priority level 000: Interrupt disabled 001-111: 1-7 When DM59 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR57) (0xFFFF_D039) Bit Symbol Read/Write Reset Value Function R 0 14 EIM57 13 23 (IMR58) (0xFFFF_D03A) Bit Symbol Read/Write Reset Value Function R 0 22 EIM58 21 31 (IMR59) (0xFFFF_D03B) Bit Symbol Read/Write Reset Value Function R 0 30 EIM59 29 TMP19A71 7-42 TMP19A71 Interrupt Mode Control Registers 7 IMR60 (0xFFFF_D03C) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM60 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 60 as DMAC trigger 12 DM61 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 61 as DMAC trigger 20 DM62 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 62 as DMAC trigger 28 DM63 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 63 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM60 3 R 0 2 1 IL60 R/W 000 When DM60 = 0 Interrupt number 60 (INTDMA4) priority level 000: Interrupt disabled 001-111: 1-7 When DM60 = 1 DMAC channel select 000-111: 0-7 10 9 IL61 R/W 000 When DM61 = 0 Interrupt number 61(INTDMA5) priority level 000: Interrupt disabled 001-111: 1-7 When DM61 = 1 DMAC channel select 000-111: 0-7 18 17 IL62 R/W 000 When DM62 = 0 Interrupt number 62 (INTDMA6) priority level 000: Interrupt disabled 001-111: 1-7 When DM62 = 1 DMAC channel select 000-111: 0-7 26 25 IL63 R/W 000 When DM63 = 0 Interrupt number 63 (INTDMA7) priority level 000: Interrupt disabled 001-111: 1-7 When DM63 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR61) (0xFFFF_D03D) Bit Symbol Read/Write Reset Value Function R 0 14 EIM61 13 23 (IMR62) (0xFFFF_D03E) Bit Symbol Read/Write Reset Value Funcion R 0 22 EIM62 21 31 (IMR63) (0xFFFF_D03F) Bit Symbol Read/Write Reset Value Function R 0 30 EIM63 29 TMP19A71 7-43 TMP19A71 Interrupt Mode Control Registers 7 IMR64 (0xFFFF_D040) Bit Symbol Read/Write Reset Value Function 15 (IMR65) (0xFFFF_D041) Bit Symbol Read/Write Reset Value Function 23 (IMR66) (0xFFFF_D042) Bit Symbol Read/Write Reset Value Function 31 (IMR67) (0xFFFF_D043) Bit Symbol Read/Write Reset Vaue Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-44 TMP19A71 Interrupt Mode Control Registers 7 IMR68 (0xFFFF_D044) bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM68 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 68 as DMAC trigger 12 DM69 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 69 as DMAC trigger 20 DM70 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 70 as DMAC trigger 28 DM71 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 71 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM68 3 R 0 2 1 IL68 R/W 000 When DM68 = 0 Interrupt number 68 (INTAD0) interrupt level 000: Interrupt disabled 001-111: 1-7 When DM68 = 1 DMAC channel select 000-111: 0-7 10 9 IL69 R/W 000 When DM69 = 0 Interrupt number 69 (INTADHP0) priority level 000: Interrupt disable 001-111: 1-7 When DM69 = 1 DMAC channel select 000-111: 0-7 18 17 IL70 R/W 000 When DM70 = 0 Interrupt number 70 (INTADM0) peiority level 000: Interrupt disabled 001-111: 1-7 When DM70 = 1 DMAC channel select 000-111: 0-7 26 25 IL71 R/W 000 When DM71 = 0 Interrupt number 71 (INTAD1) priority level 000: Interrupt disabled 001-111: 1-7 When DM71 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR69) (0xFFFF_D045) Bit Symbol Read/Write Reset Value Function R 0 14 EIM69 13 23 (IMR70) (0xFFFF_D046) Bit Symbol Read/Write Reset Value Function R 0 22 EI70 21 31 (IMR71) (0xFFFF_D047) Bit Symbol Read/Write Reset Value Function R 0 30 EIM71 29 TMP19A71 7-45 TMP19A71 Interrupt Mode Control Registers 7 IMR72 (0xFFFF_D048) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM72 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 72 as DMAC trigger 12 DM73 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1:Enable interrupt number 73 as DMAC trigger 20 DM74 R/W 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 0 DMAC trigger 0: Disable 1: Enable interrupt number 74 as DMAC trigger 28 DM75 R/W 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 0 DMAC trigger 0: Disable 1: Enable interrupt number 75 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM72 3 R 0 2 1 IL72 R/W 000 When DM72 = 0 Interrupt number 72 (INTADHP1) priority level 000: Interrupt disabled 001-111: 1-7 When DM72 = 1 DMAC channel select 000-111: 0-7 10 9 IL73 R/W 000 When DM73 = 0 Interrupt number 73 (INTADM1) priority level 000: Interrupt disabled 001-111: 1-7 When DM73 = 1 DMAC channel select 000-111: 0-7 18 17 IL74 R/W 000 When DM74 = 0 Interrupt number 74 (INT4) priority level 000: Interrupt disabled 001-111: 1 1-7 When DM74 = 1 DMAC channel select 000-111: 0-7 26 25 IL75 R/W 000 When DM75 = 0 Interrupt number 75 (INT5) priority level 000: Interrupt disabled 001-111: 1-7 When DM75 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR73) (0xFFFF_D049) Bit Symbol Read/Write Reset Value Function R 0 14 EIM73 13 23 (IMR74) (0xFFFF_D04A) Bit Symbol Read/Write Reset Value Function R 0 22 EI74 21 31 (IMR75) (0xFFFF_D04B) Bit Symbol Read/Write Reset Value Function R 0 30 EIM75 29 TMP19A71 7-46 TMP19A71 Interrupt Mode Control Registers 7 IMR76 (0xFFFF_D04C) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 6 EI76 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 76 as DMAC trigger 12 DM77 R/W 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 0 DMAC trigger 0:Disable 1: Enable interrupt number 77 as DMAC trigger 20 DM78 R/W 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 0 DMAC trigger 0: Disable 1: Enable interrupt number 78 as DMAC trigger 28 DM79 R/W 00 Set Sensitivity of interrupt request. 00: Level "L" 01: Level "H" 10: Rising edge 11: Falling edge 0 DMAC trigger 0: Disable 1: Enable interrupt number 79 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM76 3 R 0 2 1 IL76 R/W 000 When DM76 = 0 Interrupt number 76 (INT6) priority level 000: Interrupt disabled 001-111: 1-7 When DM76 = 1 DMAC channel select 000-111: 0-7 10 9 IL77 R/W 000 When DM77 = 0 Interrupt number 77 (INT7) priorityl evel 000: Interrupt disabled 001-111: 1-7 When DM77 = 1 DMAC channel select 000-111: 0-7 18 17 IL78 R/W 000 When DM78 = 0 Interrupt number 78 (INT8) priority level 000: Interrupt disabled 001-111: 1-7 When DM78 = 1 DMAC channel select 000-111: 0-7 26 25 IL79 R/W 000 When DM79 = 0 Interrupt number 79 (INT9) priority level 000: Interrupt disabled 001-111: 1-7 When DM79 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR77) (0xFFFF_D04D) Bit Symbol Read/Write Reset Value Function R 0 14 EI77 13 23 (IMR78) (0xFFFF_D04E) Bit Symbol Read/Write Reset Value Function R 0 22 EI78 21 31 (IMR79) (0xFFFF_D04F) Bit Symbol Read/Write Reset Value Function R 0 30 EI79 29 TMP19A71 7-47 TMP19A71 Interrupt Mode Control Registers 7 IMR80 (0xFFFF_D050) Bit Symbol Read/Write Reset Value Function 15 (IMR81) (0xFFFF_D051) Bit Symbol Read/Write Reset Value Function 23 (IMR82) (0xFFFF_D052) Bit Symbol Read/Write Reset Value Function 31 (IMR83) (0xFFFF_D053) Bit Symbol Read/Write Reset Vaue Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-48 TMP19A71 Interrupt Mode Control Registers 7 IMR84 (0xFFFF_D054) Bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM84 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 84 as DMAC trigger 12 DM85 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 85 as DMAC trigger 20 DM86 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 86 as DMAC trigger 28 DM87 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 87 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM84 3 R 0 2 1 IL84 R/W 000 When DM84 = 0 Interrupt number 84 (INTTBCAP00) priority level 000: Interrupt disabled 001-111: 1-7 When DM84 = 1 DMAC channel select 000-111: 0-7 10 9 IL85 R/W 000 When DM85 = 0 Interrupt number 85 (INTTBCAP01) priority level 000: Interrupt disabled 001-111: 1-7 When DM85 = 1 DMAC channel select 000-111: 0-7 18 17 IL86 R/W 000 When DM86 = 0 Interrupt number 86 (INTTBCAP10) priority level 000: Interrupt disabled 001-111: 1-7 When DM86 = 1 DMAC channel select 000-111: 0-7 26 25 IL87 R/W 000 When DM87 = 0 Interrupt number 87 (INTTBCAP11) priority level 000: Interrupt disabled 001-111: 1-7 When DM87 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR85) (0xFFFF_D055) Bit Symbol Read/Write Reset Value Function R 0 14 EIM85 13 23 (IMR86) (0xFFFF_D056) Bit Symbol Read/Write Reset Value Function R 0 22 EIM86 21 31 (IMR87) (0xFFFF_D057) Bit Symbol Read/Write Reset Value Function R 0 30 EIM87 29 TMP19A71 7-49 TMP19A71 Interrupt Mode Control Registers 7 IMR88 (0xFFFF_D058) bit Symbol Read/Write Reset Value Function R 0 00 Set Sensitivity of interrupt request. 10 must be set to it. 6 EIM88 R/W 0 DMAC trigger 0: Disable 1: Enable interrupt number 88 as DMAC trigger 12 DM89 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 89 as DMAC trigger 20 DM90 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 90 as DMAC trigger 28 DM91 R/W 00 Set Sensitivity of interrupt request. 10 must be set to it. 0 DMAC trigger 0: Disable 1: Enable interrupt number 91 as DMAC trigger 27 R 0 19 R 0 11 R 0 5 4 DM88 3 R 0 2 1 IL88 R/W 000 When DM88 = 0 Interrupt number 88 (INTTBCAP20) priority level 000: Interrupt disabled 001-111: 1-7 When DM88 = 1 DMAC channel select 000-111: 0-7 10 9 IL89 R/W 000 When DM89 = 0 Interrupt number 89 (INTTBCAP21) priority level 000: Interrupt disabled 001-111: 1-7 When DM89 = 1 DMAC channel select 000-111: 0-7 18 17 IL90 R/W 000 When DM90 = 0 Interrupt number 90 (INTTBCAP30) priority level 000: Interrupt disabled 001-111: 1-7 When DM90 = 1 DMAC channel select 000-111: 0-7 26 25 IL91 R/W 000 When DM91 = 0 Interrupt number 91 (INTTBCAP31) priority level 000: Interrupt disabled 001-111: 1-7 When DM91 = 1 DMAC channel select 000-111: 0-7 24 16 8 0 15 (IMR89) (0xFFFF_D059) Bit Symbol Read/Write Reset Value Function R 0 14 EIM89 13 23 (IMR90) (0xFFFF_D05A) Bit Symbol Read/Write Reset Value Function R 0 22 EIM90 21 31 (IMR91) (0xFFFF_D05B) Bit Symbol Read/Write Reset Value Function R 0 30 EIM91 29 TMP19A71 7-50 TMP19A71 Interrupt Mode Control Registers 7 IMR92 (0xFFFF_D05C) Bit Symbol Read/Write Reset Value Function 15 (IMR93) (0xFFFF_D05D) Bit Symbol Read/Write Reset Value Function 23 (IMR94) (0xFFFF_D05E) Bit Symbol Read/Write Reset Value Function 31 (IMR95) (0xFFFF_D05F) Bit Symbol Read/Write Reset Value Function R 0 00 Must be set as 00. R 0 00 Must be set as 00. 30 R/W 0 Must be set as 0. 29 R 0 00 Must be set as 00. 22 R/W 0 Must be set as 0. 28 27 R 0 21 R 0 00 Must be set as 00. 14 R/W 0 Must be set as 0. 20 19 R 0 13 6 R/W 0 Must be set as 0. 12 11 R 0 5 4 3 R 0 2 1 R/W 000 Must be set as 000. 10 9 R/W 000 Must be set as 000. 18 17 R/W 000 Must be set as 000. 26 25 R/W 000 Must be set as 000. 24 16 8 0 TMP19A71 7-51 TMP19A71 7.8.10.5 Interrupt Request Clear Register (ICLR) By setting IVR[8:0] of interrupt source whose request is desired to clear to ICLR, an interrupt request suspended can be cleared. As an interrupt request is cleared, IVR values also are cleared, thus no determination of interrupt sources can be made. Interrupt requests must never be cleared before reading IVR values. Interrupt Request Clear Register 7 ICLR (0xFFFF_D084) Bit Symbol Read/Write Reset Value Function Bit Symbol Read/Write Reset Value Function Note 1: This register must be accessed in 16 bits. Note 2: Regardless of Sensitivity setting of IMRxx TMP19A71 7-52 TMP19A71 7.8.10.6 Mode Control RegisterMODECR Bus Error exceptions are not generated by store instructions or write accesses by the DMAC. By setting a 0 in the BERCTL bit of the MODECR, a NMI can be generated when the bus error area is accessed by a store instruction or a write access by the DMAC. Mode Control Register 7 6 0 14 0 22 0 5 0 13 0 21 R 0 0 0 0 1 Must be set as 1. 4 R 0 15 Bit Symbol Read/Write Reset Value Function 23 Bit Symbol Read/Write Reset Value Function 20 19 18 17 R/W 1 Must be set as 1. 1 Bus error by store access 0: NMI generated 1: NMI not generated 24 0 16 BERCTL 0 0 0 12 R 0 0 0 0 0 11 0 10 0 9 0 8 3 2 1 0 MODECR (0xFFFF_D400) Bit Symbol Read/Write Reset Value Function 31 Bit Symbol Read/Write Reset Value Function 0 30 0 29 0 28 R 0 27 0 26 0 25 0 Note: This register must be accessed as a 32-bit quantity. TMP19A71 7-53 TMP19A71 7.9 Usage Note of Interrupt Cautions and warnings upon using interrupts are described here. A user program must be programmed, meeting the requirements below. 7.9.1 TX19A Processor Core Since TMP19A71 has no external bus interface, no interrupt can be used by setting 0 to Status TMP19A71 7-54 TMP19A71 7.9.2 INTC When there are two or more interrupt requests of the same level, the acceptance is made on a priority basis from the sources of the smallest interrupt number. Interrupt sources of level 0 is not suspended. To disable an interrupt source (interrupt level 0) individually, disable it in Interrupt Disabled state. Initial values of IMRxx TMP19A71 7-55 TMP19A71 8. 8.1 I/O Ports Port 0 (P00 to P07) Port 0 pins can be individually programmed to function as discrete general-purpose I/O pins. Reset P0CR P0IER Internal Data Bus Vcc3 P00 to P07 P0D High/ Low P0D Read Selector S A B P0DSSR P0PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.1.1 Port 0 (P00 to P07) TMP19A71 8-1 TMP19A71 Port 0 Register 7 P0D (0xFFFF_C000) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P0D7 6 P0D6 5 P0D5 4 P0D4 R/W 3 P0D3 0 2 P0D2 0 1 P0D1 0 0 P0D0 0 Port 0 output data (Output latch) Note: When P0IER=0, the port state can be read from this register. Port 0 Control Register 7 P0CR (0xFFFF_C004) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P0CR7 6 P0CR6 5 P0CR5 4 P0CR4 R/W 3 P0CR3 0 2 P0CR2 0 1 P0CR1 0 0 P0CR0 0 0: Output disabled 1: Output enabled Port 0 Input Enable Register 7 P0IER (0xFFFF_C008) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled P0IER7 6 P0IER6 5 P0IER5 4 P0IER4 R/W 3 P0IER3 1 1: Input disabled 2 P0IER2 1 1 P0IER1 1 0 P0IER0 1 Port 0 Drive Strength Register 7 P0DSSR Bit Symbol Reset Value Function P0DSSR7 0 (0xFFFF_C00C) Read/Write 0 0 0 6 P0DSSR6 5 P0DSSR5 4 P0DSSR4 R/W 3 P0DSSR3 0 2 P0DSSR2 0 1 0 P0DSSR1 P0DSSR0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum rating. Port 0 Pull-Up Control Register 7 P0PUCR (0xFFFF_C014) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P0PUCR7 P0PUCR6 P0PUCR5 P0PUCR4 P0PUCR3 P0PUCR2 P0PUCR1 P0PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-2 TMP19A71 8.2 Port 1 (P10 to P17) Eight Port 1 pins can be individually programmed to function as discrete general-purpose I/O pins. Reset P1CR P1IER Internal Data Bus Vcc3 P10 to P17 P1D Low/ High P1D Read Selector S A B P1DSSR P1PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.2.1 Port 1 (P10 to P17) TMP19A71 8-3 TMP19A71 Port 1 Register 7 P1D (0xFFFF_C040) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P1D7 6 P1D6 5 P1D5 4 P1D4 R/W 3 P1D3 0 2 P1D2 0 1 P1D1 0 0 P1D0 0 Port 1 output data (Output latch) Note: When P1IER=0, the port state can be read from this register. Port 1 Control Register 7 P1CR (0xFFFF_C044) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P1CR7 6 P1CR6 5 P1CR5 4 P1CR4 R/W 3 P1CR3 0 2 P1CR2 0 1 P1CR1 0 0 P1CR0 0 0: Output disabled 1: Output enabled Port 1 Input Enable Register 7 P1IER (0xFFFF_C048) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled P1IER7 6 P1IER6 5 P1IER5 4 P1IER4 R/W 3 P1IER3 1 1: Input disabled 2 P1IER2 1 1 P1IER1 1 0 P1IER0 1 Port 1 Drive Strength Register 7 P1DSSR Bit Symbol Reset Value Function P1DSSR7 0 (0xFFFF_C04C) Read/Write 0 0 0 6 P1DSSR6 5 P1DSSR5 4 P1DSSR4 R/W 3 P1DSSR3 0 2 P1DSSR2 0 1 0 P1DSSR1 P1DSSR0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 1 Pull-Up Control Register 7 P1PUCR (0xFFFF_C054) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P1PUCR7 P1PUCR6 P1PUCR5 P1PUCR4 P1PUCR3 P1PUCR2 P1PUCR1 P1PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-4 TMP19A71 8.3 Port 2 (P20 to P24) Five Port 2 pins can be individually programmed to function as discrete general-purpose I/O pins. Reset P2CR P2IER Internal Data Bus Vcc3 P20 P24 P2D Low/ High S A P2D Read Selector B P2DSSR P2PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.3.1 Port 2 (P20 to P24 TMP19A71 8-5 TMP19A71 Port 2 Register 7 P2D (0xFFFF_C080) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 P2D4 R/W 3 P2D3 0 2 P2D2 0 1 P2D1 0 0 P2D0 0 Port 2 output data (Output latch) Note: When P2IER=0, the port state can be read from this register. Port 2 Control Register 7 P2CR (0xFFFF_C084) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 P2CR4 R/W 3 P2CR3 0 0: Output disabled 2 P2CR2 0 1 P2CR1 0 1: Output enabled 0 P2CR0 0 Port 2 Input Enable Register 7 P2IER (0xFFFF_C088) Bit Symbol Read/Write Reset Value Function 0 0 0 1 6 5 4 P2IER4 R/W 3 P2IER3 1 0: Input enabled 2 P2IER2 1 1 P2IER1 1 1: Input disabled 0 P2IER0 1 Port 2 Drive Strength Register 7 P2DSSR Bit Symbol Reset Value Function 0 (0xFFFF_C08C) Read/Write 0 0 0 6 5 4 P2DSSR4 R/W 3 P2DSSR3 0 0: Low drive capability 2 P2DSSR2 0 1 0 P2DSSR1 P2DSSR0 0 0 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 2 Pull-Up Control Register 7 P2PUCR (0xFFFF_C094) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P2PUCR4 P2PUCR3 P2PUCR2 P2PUCR1 P2PUCR0 0 0: Pull-up disabled 0 0 1: Pull-up enabled 0 Note: In DSU (EJTAG) mode, Port 2 pins function as DSU control pins and the P2D, P2CR, P2IER, P2DDSR and P2PUCR are invalid. TMP19A71 8-6 TMP19A71 8.4 Port 3 (P30 to P34) Five Port 3 pins can be individually programmed to function as discrete general-purpose I/O pins. Figure 8.4.1 shows the configuration of Port 3 when not used in DSU (EJTAG) mode. Reset P3CR P3IER Internal Data Bus Vcc3 P30 P34 P3D Low/ High S A P3D Read Selector B P3DSSR P3PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.4.1 Port 3 (P30 to P34 TMP19A71 8-7 TMP19A71 Port 3 Register 7 P3D Bit Symbol Reset Value Function 0 (0xFFFF_C0C0) Read/Write 0 0 0 6 5 4 P3D4 R/W 3 P3D3 0 2 P3D2 0 1 P3D1 0 0 P3D0 0 Port 3 output data (Output latch) Note: When P3IER=0, the port state can be read from this register. Port 3 Control Register 7 P3CR Bit Symbol Reset Value Function 0 (0xFFFF_C0C4) Read/Write 0 0 0 6 5 4 P3CR4 R/W 3 P3CR3 0 0: Output disabled 2 P3CR2 0 1 P3CR1 0 1: Output enabled 0 P3CR0 0 Port 3 Input Enable Register 7 P3IER Bit Symbol Reset Value Function 0 (0xFFFF_C0C8) Read/Write 0 0 1 6 5 4 P3IER4 R/W 3 P3IER3 1 0: Input enabled 2 P3IER2 1 1 P3IER1 1 1: Input disabled 0 P3IER0 1 Port 3 Drive Strength Register 7 P3DSSR (0xFFFF_C0CC) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 P3DSSR4 R/W 3 P3DSSR3 0 0: Low drive capability 2 P3DSSR2 0 1 0 P3DSSR1 P3DSSR0 0 0 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 3 Pull-Up Control Register 7 P3PUCR Bit Symbol Reset Value Function 0 (0xFFFF_C0D4) Read/Write 0 0 0 6 5 4 R/W 3 2 1 0 P3PUCR4 P3PUCR3 P3PUCR2 P3PUCR1 P3PUCR0 0 0: Pull-up disabled 0 0 1: Pull-up enabled 0 Note: In Level-1 DSU (EJTAG) mode, Port 3 pins function as DSU control pins and the P3D, P3CR, P3IER, P3DSSR and P3PUCR are invalid. TMP19A71 8-8 TMP19A71 8.5 Port 5 (P50 to P57) Eight Port 5 pins are input-only pins that can also function as the analog input pins of the AD converter (ADC). Note 1: Note 2: As Port 5 uses AVCC0 as its I/O power source, it must be connected with the 3.3 V source even if ADC0 is not used. When Port 5 is not used as analog input pins, the AD conversion accuracy of ADC0 may deteriorate by a few LSBs. Be sure to check that this poses no problem on your system. Reset P5IER Internal Data Bus Vcc3 P50 P56 P5D Read Conversion Result Resister Channel Selector AD Converter P5PUCR Figure 8.5.1 Port 5 (P50 to P56 TMP19A71 8-9 TMP19A71 Reset P5IER Vcc3 Internal Data Bus P5FR P57 P5D Read Conversion Result Resister Channel Selector AD Converter P5PUCR Func. IN Figure 8.5.2 Port 5 (P57) TMP19A71 8-10 TMP19A71 Port 5 Register 7 P5D (0xFFFF_C140) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P5D7 6 P5D6 5 P5D5 4 P5D4 R 3 P5D3 0 2 P5D2 0 1 P5D1 0 0 P5D0 0 Port 5 input data Note: When P5IER=0, the port state can be read from this register. Port 5 Input Enable Register 7 P5IER (0xFFFF_C148) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled P5IER7 6 P5IER6 5 P5IER5 4 P5IER4 R/W 3 P5IER3 1 1: Input disabled 2 P5IER2 1 1 P5IER1 1 0 P5IER0 1 Port 5 Pull-Up Control Register 7 P5PUCR (0xFFFF_C154) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P5PUCR7 P5PUCR6 P5PUCR5 P5PUCR4 P5PUCR3 P5PUCR2 P5PUCR1 P5PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled Port 5 Function Register 7 P5FR (0xFFFF_C158) Bit Symbol Read/Write Reset Value Function 0 0: Port/AD input 1:ADTRG0 0 0 0 P5FR7 6 5 4 R/W 3 0 2 0 1 0 0 0 TMP19A71 8-11 TMP19A71 8.6 Port 6 (P60 to P67) The lower 4 bits are input-only pins, and the upper 4 bits can be individually programmed to function as discrete general-purpose I/O pins shared with the analog input pins of the AD converter (ADC). Note 1: Note 2: As Port 6 uses AVCC1 as its I/O power source, it must be connected to the 3.3 V source even if ADC1 is not used. When Port 6 is not used as analog input pins, the AD conversion accuracy of ADC1 may deteriorate by a few LSBs. When Port 6 is used as an output port, this may result in a noticeable deterioration in AD conversion accuracy which may exceed the worst conditions presented in the AD conversion characteristics later in this manual. Be sure to check that this poses no problem on your system. Reset P6IER Internal Data Bus Vcc3 P60 P63 P6D Read Conversion Result Resister Channel Selector AD Converter P6PUCR Figure 8.6.1 Port 6 (P60 to P63) TMP19A71 8-12 TMP19A71 Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.6.2 Port 6 (P64 to P67) TMP19A71 8-13 TMP19A71 Port 6 Register 7 P6D (0xFFFF_C180) Bit Symbol Read/Write Reset Value Function 0 0 P6D7 6 P6D6 R/W 5 P6D5 0 4 P6D4 0 3 P6D3 0 2 P6D2 R 0 1 P6D1 0 0 P6D0 0 Port 6 output data (Output latch) Port 6 input data Note: When P6IER=0, the port state can be read from this register. Port 6 Control Register 7 P6CR (0xFFFF_C184) Bit Symbol Read/Write Reset Value Function 0 0 0 0 0: Output disabled 1: Output enabled P6CR7 6 P6CR6 5 P6CR5 4 P6CR4 R/W 3 0 2 0 1 0 0 0 Port 6 Input Enable Register 7 P6IER (0xFFFF_C188) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled P6IER7 6 P6IER6 5 P6IER5 4 P6IER4 R/W 3 P6IER3 1 1: Input disabled 2 P6IER2 1 1 P6IER1 1 0 P6IER0 1 Port 6 Drive Strength Register 7 P6DSSR Bit Symbol Reset Value Function P6DSSR7 0 (0xFFFF_C18C) Read/Write 0 0 0 0: Low drive capability 6 P6DSSR6 5 P6DSSR5 4 P6DSSR4 R/W 3 0 2 0 1 0 0 0 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 6 Pull-Up Control Register 7 P6PUCR (0xFFFF_C194) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P6PUCR7 P6PUCR6 P6PUCR5 P6PUCR4 P6PUCR3 P6PUCR2 P6PUCR1 P6PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-14 TMP19A71 Port 6 Function Register 7 P6FR (0xFFFF_C198) Bit Symbol Read/Write Reset Value Function 0 0 0 0:Port/AD input 1:INT4 0 0:Port/AD input 1:INT3 0:Port/AD 0:Port/AD input input 1:ADTRG1 1:INT5 /INT6 P6FR7 6 P6FR6 5 P6FR5 4 P6FR4 R/W 3 0 2 0 1 0 0 0 Note: When the P6FR is set to 1 (port or AD input) with P6CR=1 (output enabled), the output values of this register become undefined. TMP19A71 8-15 TMP19A71 8.7 Port 7 (P70 to P72) Three Port 7 pins can be individually programmed to function as discrete general-purpose I/O pins shared with the analog input pins of the AD converter (ADC). Note 1: Note 2: As Port 7 uses AVCC1 as its I/O power source, it must be connected to the 3.3 V source even if ADC1 is not used. When Port 7 is not used as analog input pins, the AD conversion accuracy of ADC1 may deteriorate by a few LSBs. When Port 7 is used as an output port, this may result in a noticeable deterioration in AD conversion accuracy which may exceed the worst conditions presented in the AD conversion characteristics later in this manual. Be sure to check that this poses no problem on your system. Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.7.1 Port 7 (P70 to P72) TMP19A71 8-16 TMP19A71 Port 7 Register 7 P7D Bit Symbol Reset Value Function Note: When P7IER=0, the port state can be read from this register. 0 (0xFFFF_C1C0) Read/Write 0 0 0 6 5 4 R/W 3 0 2 P7D2 0 1 P7D1 0 0 P7D0 0 Port 7 output data (Output latch) Port 7 Control Register 7 P7CR Bit Symbol Reset Value Function 0 (0xFFFF_C1C4) Read/Write 0 0 0 6 5 4 R/W 3 0 2 P7CR2 0 1 P7CR1 0 0 P7CR0 0 0: Output disabled 1: Output enabled Port 7 Input Enable Register 7 P7IER Bit Symbol Reset Value Function 0 (0xFFFF_C1C8) Read/Write 0 0 0 6 5 4 R/W 3 0 2 P7IER2 1 0: Input enabled 1 P7IER1 1 0 P7IER0 1 1: Input disabled Port 7 Drive Strength Register 7 P7DSSR (0xFFFF_C1CC) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 0 2 P7DSSR2 0 1 0 P7DSSR1 P7DSSR0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 7 Pull-Up Control Register 7 P7PUCR Bit Symbol Reset Value Function 0 (0xFFFF_C1D4) Read/Write 0 0 0 6 5 4 R/W 3 0 2 1 0 P7PUCR0 0 P7PUCR2 P7PUCR1 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-17 TMP19A71 Port 7 Function Register 7 P7FR1 Bit Symbol Reset Value Function 0 (0xFFFF_C1D8) Read/Write 0 0 0 6 5 4 R/W 3 0 2 P7FR12 0 0:Port/AD input 1:INT9 1 P7FR11 0 0:Port/AD input 1:INT8 0 P7FR10 0 0:Port/AD input 1:INT7 Note: When the P7FR is set to 1 (port or AD input) with P7CR=1 (output enabled), the output values of this register become undefined. Port 7 Function Register 7 P7FR2 (0xFFFF_C1DC) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 0 2 P7FR22 0 0:Port/AD input 1:TB3IN 1 P7FR21 0 0:Port/AD input 1:TB2IN 0 P7FR20 0 0:Port/AD input 1:TB1IN TMP19A71 8-18 TMP19A71 8.8 Port 8 (P80 to P87) Eight Port 8 pins can be individually programmed to function as discrete general-purpose I/O pins. Reset P8CR P8IER Internal Data Bus P8FR Vcc3 P8D S A Selector Configurable as an open-drain output (bit0,2,6,7) Low/ High P80 P87 Func. OUT B S A Selector P8D Read Func. IN B P8DSSR P8PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.8.1 Port 8 (P80 to P87) TMP19A71 8-19 TMP19A71 Port 8 Register 7 P8D (0xFFFF_C200) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P8D7 6 P8D6 5 P8D5 4 P8D4 R/W 3 P8D3 0 2 P8D2 0 1 P8D1 0 0 P8D0 0 Port 8 output data (Output latch) Note: When P8IER=0, the port state can be read from this register. Port 8 Control Register 7 P8CR (0xFFFF_C204) Bit Symbol Read/Write Reset Value Function 0 0 0 0 P8CR7 6 P8CR6 5 P8CR5 4 P8CR4 R/W 3 P8CR3 0 2 P8CR2 0 1 P8CR1 0 0 P8CR0 0 0: Output disabled 1: Output enabled Port 8 Input Enable Register 7 P8IER (0xFFFF_C208) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled P8IER7 6 P8IER6 5 P8IER5 4 P8IER4 R/W 3 P8IER3 1 1: Input disabled 2 P8IER2 1 1 P8IER1 1 0 P8IER0 1 Port 8 Drive Strength Register 7 P8DSSR Bit Symbol Reset Value Function P8DSSR7 0 (0xFFFF_C20C) Read/Write 0 0 0 6 P8DSSR6 5 P8DSSR5 4 P8DSSR4 R/W 3 P8DSSR3 0 2 P8DSSR2 0 1 0 P8DSSR1 P8DSSR0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 8 Open-Drain Control Register 7 P8ODCR (0xFFFF_C210) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 0 2 P8ODCR2 0 1 0 0 P8ODCR0 0 P8ODCR7 P8ODCR6 0: Open-drain disabled 1: Open-drain enabled Port 8 Pull-Up Control Register 7 P8PUCR (0xFFFF_C214) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P8PUCR7 P8PUCR6 P8PUCR5 P8PUCR4 P8PUCR3 P8PUCR2 P8PUCR1 P8PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled Note: In Level-1 DSU (EJTAG) mode, P86 and P87 function as DSU control pins and the P8D, P8CR, P8IER, P8DSSR, P8ODCR and P8PUCR are invalid. TMP19A71 8-20 TMP19A71 Port 8 Function Register 1 7 P8FR (0xFFFF_C218) Bit Symbol Read/Write Reset Value Function 0 0:Port 1:SCLK2 /CTS2 0 0:Port 1:TX2 0 0:Port 1:RX2 0 P8FR17 6 P8FR16 5 P8FR15 4 P8FR14 R/W 3 P8FR13 0 2 P8FR12 0 0:Port 1:TX1 1 P8FR11 0 0:Port 1:RX0 0 P8FR10 0 0:Port 1:TX0 0:Port 0:Port 1:TB1OUT 1:RX1 /INT0 Note: When the P8FR is set to 1 (port input) with P8CR=1 (output enabled), the output values of P81, P83, P84, P85 and P87 become undefined. TMP19A71 8-21 TMP19A71 8.9 Port 9 (P90 to P95) Six Port 9 pins can be individually programmed to function as discrete general-purpose I/O pins. P93 is shared with the emergency stop signal input pin (EMG pin) of TMRB0, and set as a general-purpose port after reset. P93 can be used as the EMG pin by setting the P9FR2.P9FR23 bit which is protected with the lock function. Likewise, P95 is shared with the NMI pin, and set as a general-purpose port after reset. P95 can be used as the NMI pin by setting the P9FR1.P9FR15 bit which is protected with the lock function. Reset P9CR P9IER Internal Data Bus P9FR Vcc3 P9D S A Selector Low/ High P90P92, P94,P95 Func. OUT S B Selector B P9D Read Func. IN A P9DSSR P9PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.9.1 Port 9 (P90 to P92, P94, P95) TMP19A71 8-22 TMP19A71 Reset PACR P9IER Vcc3 Internal Data Bus P9FR (with lock function) P93 P9D S A Low/ High P9D Read Func. IN EMG IN EMG detecton circuit P9DSSR Selector B P9PUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.9.2 Port 9 (P93) TMP19A71 8-23 TMP19A71 Port 9 Register 7 P9D (0xFFFF_C240) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 P9D5 4 P9D4 R/W 3 P9D3 0 2 P9D2 0 1 P9D1 0 0 P9D0 0 Port 9 output data (Output latch) Note: When P9IER=0, the port state can be read from this register. Port 9 Control Register 7 P9CR (0xFFFF_C244) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 P9CR5 4 P9CR4 R/W 3 P9CR3 0 2 P9CR2 0 1 P9CR1 0 0 P9CR0 0 0: Output disabled 1: Output enabled Port 9 Input Enable Register 7 P9IER (0xFFFF_C248) Bit Symbol Read/Write Reset Value Function 0 0 1 1 6 5 P9IER5 4 P9IER4 R/W 3 P9IER3 1 0: Input enabled 2 P9IER2 1 1: Input disabled 1 P9IER1 1 0 P9IER0 1 Port 9 Drive Strength Register 7 P9DSSR Bit Symbol Reset Value Function 0 (0xFFFF_C24C) Read/Write 0 0 0 6 5 P9DSSR5 4 P9DSSR4 R/W 3 P9DSSR3 0 2 P9DSSR2 0 1 0 P9DSSR1 P9DSSR0 0 0 0:Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port 9 Pull-Up Control Register 7 P9PUCR (0xFFFF_C254) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 P9PUCR5 P9PUCR4 P9PUCR3 P9PUCR2 P9PUCR1 P9PUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled Note: P94 is designated as the BOOT pin. To start up the device in BOOT mode (see the chapter on Flash memory), P94 should be set to 0 during a reset sequence. To start up the device in NORMAL mode, P94 should be set to 1 during a reset sequence. TMP19A71 8-24 TMP19A71 Port 9 Function Register 1 7 P9FR1 (0xFFFF_C258) Bit Symbol Read/Write Reset Value Function 0 0 0 0:Port 1:NMI (with lock function) 0 6 5 P9FR15 4 P9FR14 R/W 3 P9FR13 0 2 P9FR12 0 0:Port 1:ENCZ 1 P9FR11 0 0:Pprt 1:ENCB 0 P9FR10 0 0:Port 1:ENCA 0:Port 0:Port 1:TB0OUT 1:TB0IN P9FR15 is a register bit with the lock function. Writing a value to this bit requires writing 0x55 and then 0xAA to the P9ECLR register. Once these values are written, the P9ECLR remains in effect until a write to a Port 9 register with the lock function is completed. Port 9 Function Register 2 7 P9FR2 Bit Symbol Reset Value Function 0 (0xFFFF_C25C) Read/Write 0 0 0 6 5 4 R/W 3 P9FR23 0 0:Port 1:EMG input (with lock function) 2 P9FR22 0 0:Port 1:SCLK3 /CTS3 1 P9FR21 0 0:Port 1:TX3 0 P9FR20 0 0:Port 1:RX3 P9FR23 is a register bit with the lock function. Writing a value to this register requires writing 0x55 and then 0xAA to the P9ECLR register. Once these values are written, the P9ECLR remains in effect until a write to a Port 9 register with the lock function is completed. Setting the P9FR23 bit to 1 prohibits writes to other registers related to P93. Port 9 EMG Control Register 7 P9ECR (0xFFFF_C260) Bit Symbol Read/Write Reset Value Function 0 0 6 R/W 5 ERM 0 4 3 EMGF R 2 EMGE R/W 0 EMG condition clear 1: Clear EMG condition This bit is read as 0. (with lock function) 1 0 0 0 0 0 EMG condition flag 0: Normal condition 1: EMG condition EMG sensitivity 00: Low level 01: High level 10: Falling edge 11: Rising edge (with lock function) TMP19A71 8-25 TMP19A71 Port 9 EMG Clear Register 7 P9ECLR (0xFFFF_C264) Bit Symbol Read/Write Reset Value Function Note 1: Note 2: 6 5 4 W 3 2 1 0 Writing 0x55 and then 0xAA to this register allows a single write to a register with the lock function. Setting both P9FR13 and P9FR23 to 1 results in undefined behavior. When the P9FR is set to 1 (port input) with P9CR=1 (output enabled), the output values of P90, P91, P92, P93 and P95 become undefined. 8.9.1 8.9.1.1 Notes on Using the Emergency Stop Signal Input Pin (P93) Port Operation in the EMG Condition When P93 set as the EMG pin is asserted, output is disabled on P94 and an INTTBE0 interrupt is generated in Port 9, as shown in Table 8.9.1. As the EMG detection circuit operates independently of the 16-bit timer, the 16-bit timer continues to operate normally even in case of emergency. Table 8.9.1 Port Operation in the EMG Condition P93 Normal EMG Hi-z P94 PWM/PORT output Not generated Generated INTTBE0 TMP19A71 8-26 TMP19A71 8.9.1.2 Register Settings for P93 When P93 is set as the EMG pin (P9FR2.P9FR23=1), other registers related to P93 (i.e., P9CR3, P9IER3, P9DSSR3, P9PUCR3, P9FR13) cannot be changed. Clearing the P9FR23 bit to 0 enables writes to these registers again. Table 8.9.2 shows the register settings for P93 according to the selected function. Table 8.9.2 Register Settings for P93 General-purpose I/O port P9CR.P9CR3 P9IER.P9IER3 P9DSSR.P9DSSR3 P9PUCR.P9PUCR3 P9FR1.P9FR13 P9FR2.P9FR23 Note: Must be set before the P9FR2.P9FR23 bit is set. X X X X 0 0 TB0IN 0 0 X X 1 0 EMG pin 0 0 X 0 (Note) (Note) (Note) (Note) 0 1 General procedure for setting P93 as the EMG pin (falling edge sensitive) P9ECLR=0x550xAA P9ECR General procedure for clearing the EMG condition (edge sensitive) (* When the EMG pin is set as edge sensitive, make sure that P93 is inactive before clearing the EMG condition.) P9ECLR=0x550xAA P9ECR Procedure for returning P93 to a general-purpose port IMR33 8.9.1.3 Sensitivity-Related Considerations (1) Level sensitive When the EMG pin is set as level sensitive, the EMG condition is held (P9ECR.EMGF=1) only while the EMG pin is active. Therefore, there is no need to clear the EMG condition by setting the P9ECR.EMGE bit to 1. (2) Edge sensitive When the EMG pin is set as edge sensitive, be sure to check that the EMG pin is inactive before making an EMG condition setting. TMP19A71 8-27 TMP19A71 8.10 Port A (PA0 to PA7) Eight Port A pins can be individually programmed to function as discrete general-purpose I/O pins. PA6 is shared with the emergency stop signal input pin (EMG0 pin) of PMD0, and set as a general-purpose port after reset. PA6 can be used as the EMG0 pin by setting the PAFR.PAFR6 bit which is protected with the lock function. Reset PACR PAIER Internal Data Bus PAFR Vcc3 PAD Selector S A PA0 to PA5, PA7 Low/ High Func. OUT S B Selector B PAD Read A Func. IN PADSSR PAPUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.10.1 Port A (PA0 to PA5, PA7) TMP19A71 8-28 TMP19A71 Reset PACR PAIER Vcc3 Internal Data Bus PAFR (with lock function) PA6 PAD S A Low/ High PAD Read EMG IN EMG detection circuit Selector B PADSSR PAPUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.10.2 Port A (PA6) TMP19A71 8-29 TMP19A71 Port A Register 7 PAD (0xFFFF_C280) Bit Symbol Read/Write Reset Value Function 0 0 0 0 PAD7 6 PAD6 5 PAD5 4 PAD4 R/W 3 PAD3 0 2 PAD2 0 1 PAD1 0 0 PAD0 0 Port A output data (Output latch) Note: When PAIER=0, the port state can be read from this register. Port A Control Register 7 PACR (0xFFFF_C284) Bit Symbol Read/Write Reset Value Function 0 0 0 0 PACR7 6 PACR6 5 PACR5 4 PACR4 R/W 3 PACR3 0 2 PACR2 0 1 PACR1 0 0 PACR0 0 0: Output disabled 1: Output enabled Port A Input Enable Register 7 PAIER (0xFFFF_C288) Bit Symbol Read/Write Reset Value Function 1 1 1 1 0: Input enabled PAIER7 6 PAIER6 5 PAIER5 4 PAIER4 R/W 3 PAIER3 1 1: Input disabled 2 PAIER2 1 1 PAIER1 1 0 PAIER0 1 Port A Drive Strength Register 7 PADSSR Bit Symbol Reset Value Function (0xFFFF_C28C) Read/Write 0 0 0 0 6 5 4 R/W 3 2 1 0 PADSSR7 PADSSR6 PADSSR5 PADSSR4 PADSSR3 PADSSR2 PADSSR1 PADSSR0 0 0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port A Pull-Up Control Register 7 PAPUCR (0xFFFF_C294) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 PAPUCR7 PAPUCR6 PAPUCR5 PAPUCR4 PAPUCR3 PAPUCR2 PAPUCR1 PAPUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-30 TMP19A71 Port A Function Register 7 PAFR Bit Symbol Reset Value Function PAFR7 0 (0xFFFF_C298) Read/Write 0 0 0:Port 1:Z0 0 0:Port 1:W0 0:Port 0:Port 1:TB2OUT/ 1:EMG0 INT1 (with lock function) 6 PAFR6 5 PAFR5 4 PAFR4 R/W 3 PAFR3 0 0:Port 1:Y0 2 PAFR2 0 0:Port 1:V0 1 PAFR1 0 0:Port 1:X0 0 PAFR0 0 0:Port 1:U0 When the PAFR6 bit is set to 1, PA6 is used as the EMG0 pin. The PAFR6 bit has the lock function, and writing a value to this bit requires writing 0x55 and then 0xAA to the PAECLR register. Once these values are written, the PAECLR register remains in effect until a write to a Port A register with the lock function is completed. Setting the PAFR6 bit to 1 prohibits writes to other registers related to PA6. Port A EMG Control Register 7 PAECR Bit Symbol Reset Value Function 0 (0xFFFF_C29C) Read/Write 0 6 R/W 5 ERMA 0 4 3 EMGFA R 2 EMGEA R/W 0 EMG condition clear 1: Clear EMG condition This bit is read as 0. (with lock function) 1 0 0 0 0 0 EMG condition flag 0: Normal condition 1: EMG condition EMG sensitivity 00: Low level 01: High level 10: Falling edge 11: Rising edge (with lock function) Port A EMG Clear Register 7 PAECLR (0xFFFF_C2A0) Bit Symbol Read/Write Reset Value Function 6 5 4 W 3 2 1 0 Writing 0x55 and then 0xAA to this register allows a single write to a Port A register with the lock function. Note: When the PAFR is set to 1 (port input) with PACR=1 (output enabled), the output values of PA6 and PA7 become undefined. For details, see 8.12 Notes on Using the Emergency Stop Signal Input Pins (PA6, PB6). TMP19A71 8-31 TMP19A71 8.11 Port B (PB0 to PB7) Eight Port B pins can be individually programmed to function as discrete general-purpose I/O pins. PB6 is shared with the emergency stop signal input pin (EMG1 pin) of PMD1, and set as a general-purpose port after reset. PB6 can be used as the EMG1 pin by setting the PBFR.PBFR6 bit which is protected with the lock function. Reset PBCR PBIER Internal Data Bus PBFR Vcc3 PBD Selector S A PB0 to PB5, PB7 Low/ High Func. OUT S B Selector B PBD Read A Func. IN PBDSSR PBPUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.11.1 Port B (PB0 to PB5, PB7) TMP19A71 8-32 TMP19A71 Reset PBCR PBIER Vcc3 Internal Data Bus PBFR (with lock function) PB6 PBD S A Low/ High PBD Read EMG IN EMG detection circuit Selector B PBDSSR PBPUCR Note: The selectors in the figure output input A when S=1 and input B when S=0. Figure 8.11.2 Port B (P86) TMP19A71 8-33 TMP19A71 Port B Register 7 PBD Bit Symbol Reset Value Function PBD7 0 (0xFFFF_C2C0) Read/Write 0 0 0 6 PBD6 5 PBD5 4 PBD4 R/W 3 PBD3 0 2 PBD2 0 1 PBD1 0 0 PBD0 0 Port B output data (Output latch) Note: When PBIER=0, the port state can be read from this register. Port B Control Register 7 PBCR Bit Symbol Reset Value Function PBCR7 0 (0xFFFF_C2C4) Read/Write 0 0 0 6 PBCR6 5 PBCR5 4 PBCR4 R/W 3 PBCR3 0 2 PBCR2 0 1 PBCR1 0 0 PBCR0 0 0: Output disabled 1: Output enabled Port B Input Enable Register 7 PBIER Bit Symbol Reset Value Function PBIER7 1 (0xFFFF_C2C8) Read/Write 1 1 1 0: Input enabled 6 PBIER6 5 PBIER5 4 PBIER4 R/W 3 PBIER3 1 1: Input disabled 2 PBIER2 1 1 PBIER1 1 0 PBIER0 1 Port B Drive Strength Register 7 PBDSSR (0xFFFF_C2CC) Bit Symbol Read/Write Reset Value Function 0 0 0 0 6 5 4 R/W 3 2 1 0 PBDSSR7 PBDSSR6 PBDSSR5 PBDSSR4 PBDSSR3 PBDSSR2 PBDSSR1 PBDSSR0 0 0 0 0 0: Low drive capability 1: High drive capability Note: The current flowing through ports should not exceed the maximum ratings for each port pin and for all the port pins. Port B Pull-Up Control Register 7 PBPUCR Bit Symbol Reset Value Function (0xFFFF_C2D4) Read/Write 0 0 0 0 6 5 4 R/W 3 2 1 0 PBPUCR7 PBPUCR6 PBPUCR5 PBPUCR4 PBPUCR3 PBPUCR2 PBPUCR1 PBPUCR0 0 0 0 0 0: Pull-up disabled 1: Pull-up enabled TMP19A71 8-34 TMP19A71 Port B Function Register 7 PBFR Bit Symbol Reset Value Function PBFR7 0 (0xFFFF_C2D8) Read/Write 0 0 0:Port 1:Z1 0 0:Port 1:W1 0:Port 0:Port 1:TB3OUT/ 1:EMG1 INT2 (with lock function) 6 PBFR6 5 PBFR5 4 PBFR4 R/W 3 PBFR3 0 0:Port 1:Y1 2 PBFR2 0 0:Port 1:V1 1 PBFR1 0 0:Port 1:X1 0 PBFR0 0 0:Port 1:U1 When the PBFR6 bit is set to 1, PB6 is used as the EMG1 pin. The PBFR6 bit has the lock function, and writing to this bit requires writing 0x55 and then 0xAA to the PBECLR register. Once these values are written, the PBECLR register remains in effect until a write to a Port B register with the lock function is completed. Setting the PBFR6 bit to 1 prohibits writes to other registers related to PB6. Port B EMG Control Register 7 PBECR (0xFFFF_C2DC) Bit Symbol Read/Write Reset Value Function 0 0 6 R/W 5 ERMB 0 4 3 EMGFB R 2 EMGEB R/W 0 EMG condition clear 1: Clear EMG condition This bit is read as 0. (with lock function) 1 0 0 0 0 0 EMG condition flag 0: Normal condition 1: EMG condition EMG sensitivity 00: Low level 01: High level 10: Falling edge 11: Rising edge (with lock function) Port B EMG Clear Register 7 PBECLR (0xFFFF_C2E0) Bit Symbol Read/Write Reset Value Function 6 5 4 W 3 2 1 0 Writing 0x55 and then 0xAA to this register allows a single write to a Port B register with the lock function. Note: When the PBFR is set to 1 (port input) with PBCR=1 (output enabled), the output values of PB6 and PB7 become undefined. For details, see 8.12 Notes on Using the Emergency Stop Signal Input Pins (PA6, PB6). TMP19A71 8-35 TMP19A71 8.12 8.12.1 Notes on Using the Emergency Stop Signal Input Pins (PA6, PB6) Block Diagram of the EMG Detection Circuit Note: The following descriptions for PA[6:0] (PMD0) also apply to PB[6:0] (PMD1), unless otherwise noted. When PA6 is set as the emergency stop signal input pin (EMG0 pin), an EMG input activates the EMG detection circuit of PMD0 and forcefully disables output on PA[5:0] even if these pins are not set for PMD0 output. The EMG detection circuit of PMD0 is enabled by setting the EMGCR0.EMGEN bit to 1 in addition to setting PA6 as the EMG0 pin. Figure 8.12.1 shows a block diagram of the EMG detection circuit. Port A PAECR PAFR6 Port output disabled PACR[5:0] PA[5:0] PWM generation circuit TRG generation circuit PMDTRG0 Figure 8.12.1 Block Diagram of EMG Detection Circuit 8.12.2 Operations in the EMG Condition When Port A and PMD are put in the EMG condition, the following operations are performed. * In Port A, output is disabled on PA[5:0]. * In PMD, PWM output is made inactive, ADC start trigger (PMDTRG) is disabled, and an INTEMG interrupt is generated. Table 8.12.1 shows a summary of operations in the EMG condition for PMD and Port A which operate independently of each other. Table 8.12.1 PMD and Port A Operations in the EMG Condition PMD Port A Normal Normal EMG EMG Inactive Hi-z Hi-z PA[5:0] PWM/Port output PMDTRG Trigger enabled Trigger disabled Trigger enabled Trigger disabled INTEMG Interrupt not generated Interrupt generated Interrupt generated (Note 1) Normal EMG Normal EMG Interrupt not generated Note: If PA6 is not set as the EMG0 pin, no EMG input will be accepted and thus PMD will not be put in the EMG condition. The combination of PMD=EMG and Port A=normal occurs only when the EMG condition is cleared in Port A when PMD=EMG and Port A=EMG. TMP19A71 8-36 TMP19A71 8.12.3 Register Settings for PA6 When PA6 is set as the EMG0 pin (PAFR.PAFR6=1), other registers related to PA6 (i.e., PACR6, PAIER6, PADSSR6, PAPUCR6) cannot be changed. Clearing the PAFR6 bit to 0 enables writes to these registers again. Table 8.12.2 shows the register settings for PA6 according to the selected function. Table 8.12.2 Register Settings for PA6 General-purpose I/O port PACR.PACR6 PAIER.PAIER6 PADSSR.PADSSR6 PAPUCR.PAPUCR6 PAFR.PAFR6 Note: Must be set before the PAFR.PAFR6 bit is set. General procedure for setting PA6 as the EMG0 pin (falling edge sensitive) PAECLR=0x550xAA PAECR (Note ) (Note) (Note) 0 X 0 (Note) 1 General procedure for clearing the EMG condition (edge sensitive) PAECLR=0x550xAA PAECR When EMG0 is set as edge sensitive, be sure to check that EMG0 is inactive before clearing the EMG condition. If the EMG condition is cleared only in PMD and not in Port A, PMD is put in the EMG condition again and an INTEMG0 interrupt is generated. General procedure for clearing the EMG condition (level sensitive) MDOUT0 When EMG0 is set as level sensitive, Port A is put in the EMG condition only while EMG0 is active. Thus, the EMG condition should be cleared only in PMD. If the EMG condition is cleared only in PMD and not in Port A, PMD is put in the EMG condition again and an INTEMG0 interrupt is generated. Procedure for returning PA6 to a general-purpose port IMR22 TMP19A71 8-37 TMP19A71 When EMG0 is set as level sensitive, Port A is put in the EMG condition only while EMG0 is active (PAECR.EMGFA=1). Thus, there is no need to clear the EMG condition in Port A by setting PAECR.EMGEA to 1. However, when the EMG detection circuit is enabled in PMD, the EMG condition must be cleared in PMD by setting EMGCR1.EMGRS to 1 after making sure that EMG0 is inactive. When EMG0 is set as edge sensitive, make sure that EMG0 is inactive before making an EMG condition setting. 8.12.4 Difference between P93 (TB0IN) and PA6 (EMG0)/PB6 (EMG1) P93 can also be used as the EMG pin. The main difference between P93 and PA6/PB6 is that Port 9 generates an EMG interrupt as shown in Figure 8.12.2. In the case of PA6/PB6, when the EMG function is disabled in PMD (EMGCR.EMGEN=0), no EMG interrupt (INTEMGx) is generated whereas P93 causes an EMG interrupt (INTTBE0) to be generated as soon as Port 9 is put in the EMG condition. Port 9 P9ECR INTTBE0 Port output disabled P9CR4 P9D4 Figure 8.12.2 P93 (EMG pin) Block Diagram TMP19A71 8-38 TMP19A71 9. Debug Support Unit (DSU) TMP19A71 is supplied with DSU (Debug Support Unit) mode. This function makes a subset of ports be DSU control pins. The DSU mode has two types; Lv.1 (12-pin mode) and Lv.0 (5-pin mode). Using 12 control pins, Lv.1 provides more pow erful debug function than Lv.0 does. The mode can be used like selsecting Lv.1 in the first stage of debug operation where it needs larger debug information, and Lv.0 in the last stage of debug operation since Lv.0 has less pin restriction. 9.1 DSU (EJTAG) Mode Setting To set the DSU mode, L must be set to EJE of an external pin that is in reset cycle, and then TMP19A71 becomes in DSU (EJTAG) mode when it is started up with the DSU level, DSU-PROBE first. If DSU-PROBE is not connected, it starts from Lv.0. Note 1: DSU disabled must be released for the Mask version. 9.1.1 Pin Status Upon the DSU (EJTAG) Mode Startup When TMP19A71 starts in DSU (EJTAG) mode, a specific pin register automatically changes into DSU control pin regardless of its setting. In addition, as a read value of register, a set value can be read. 9.1.2 Motor Breakage Prevention TMP19A71 has a mechanism that automatically turns its moter output OFF (RxCRn=0) to prevent the motor breakage upon the BREAK execution (including OneSTEP execution) in the DSU mode. Intended ports are P94(TB0OUT), PA[5:0](PMD0), and PB[5:0](PMD1). Their PxCrn becomes 0 (output of a prescribed bit n of PORTx disabled) only when they are set to the motor control outputs (TB0OUT, PMD0, and PMD1). To resume the motor control, 1 is to be set to PxCRn. The motor control output, however, does not restart when it is started after changing the port setting in IDE. The port must be set during the programming. TMP19A71 9-1 TMP19A71 9.2 9.2.1 Pin Status in Reset Cycle Pins Whose Status Change According to Mode; Normal and DSU Table 9.2. 1 shows the status change upon resetting of each pin. Even when a pin is not connected to DSU -PROBE in DSU mode, its status becomes the same as in DSU mode shown in Table 9.2.1. Table 9.2.1 Pin Status in Reset Cycle Pin P20(TCK) P21(TMS) P22(TDI) P23(TDO) ('* 2) P24(DINT) P30(TPC) P31(PCST0) P32(PCST1) P33(PCST2) P34(DCLK) P86(TX2/PCST3) P87(SCLK2/CTS2/PCST4) P94(TB0OUT/BOOT) Normal Mode (EJE="H") Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z External "H" fixed *Note 1 Hi-z DSU Mode (EJE="L") Hi-z(TCK) Hi-z(TMS) Hi-z(TDI) Undefined(TDO) Hi-z(DINT) Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z Hi-z External "H" fixed *Note 1 Hi-z Other general-purposed I/O port EJE External "H" fixed External "L" fixed RESET External "L" fixed External "L" fixed TEST0 External "L" fixed External "L" fixed TEST1 External "L" fixed External "L" fixed Note 1: These pins must be fixed externally until the reset is released. Note 2: Even during the reset, the behavior of P23(TDO) shall be unstable until its internal current becomes stable. TMP19A71 9-2 TMP19A71 9.2.2 Pin Status Upon the Connection to DSU-PROBE Upon the connection of DSU -PROBE, an output value of a port changes until the connection is completed. Since, as for pins used in Lv.1, there is only changes in output values of a pin to be used but no change in switching timing, here DCLK(P34) is described. 9.2.2.1 DSU-PROBE Connection (Lv.1) Reset by DSU-PROBE Debug Start Reset button is pressed with a debugger. VCC Reset ProbEn ('*1) DCLK(P34) Note1: Internal Signal -n10ms (T.B.D) Debug Lv.0*1 Hi-z Figure 9.2. 1 shows, in the connection in Lv.1, DSU-PROBE sets 1 to ProbEn of an internal register after the second reset being performed that follows the power supply. When the second reset is released, a DSU control pin used in Lv.1 mode switches to the one for DSU control and starts communication with DSU -PROBE. Note1: For the first reset releasing cycle, refer to the operation manual of DSU-PROBE you are using. Reset by DSU-PROBE VCC Reset ProbEn1) ('* DCLK(P34) Note1: Internal Signal -n10ms(T.B.D) Debug Start Reset button is pressed with a debugger. Hi-z Debug Lv.0*1 Figure 9.2.1 DSU-PROBE Connection (Lv.1) 9.2.2.2 DSU-PROBE Connection (Lv.0) As Figure 9.2.2 DSU-PROBE Connection (Lv.0) upon the connection in Lv.0 mode, DSU-PROBE sets 1 to Proben of an internal register after the second reset being performed that follows the power supply. By setting 0 to EJE, DSU control pin to be used in Lv.0 mode behaves as the one for DSU control immediately after t he power supply. Note1: For the first reset releasing cycle, refer to the operation manual of DSU-PROBE you are using. TMP19A71 9-3 TMP19A71 Reset by DSU-PROBE VCC Reset ProbEn1) ('* DCLK(P34) Note 1: Internal Signal -n10ms(T.B.D) Hi-z Debug Start Reset button is pressed by a debugger. Figure 9.2.2 DSU-PROBE Connection (Lv.0) TMP19A71 9-4 TMP19A71 9.2.3 DSU-PROBE Disabled This functions when debugging by using DSU-PROBE. It is an I/F exclusive for connecting to DSU -PROBE. For details of debug utilizing DSU -PROBE, refer to the operation manual of DSU-P ROBE you are using. Here, DSU -PROBE Enabled/Disabled in DSU (EJTAG) mode is described. 1. DSU-PROBE Enabled/Disabled This device can debug by using DSU-PROBE on borad. Therefore, it has the function that disables use of DSU -PROBE (hereinafter referred to as DSU Disabled), which allows no third party to read data of incorporated flash easily. Validating the DSU Disabled makes it impossible to use DSU-PROBE. 2. DSU Disabled (Disabling debug that uses DSU-PROBE) User can validate the writer security functin of flash itself by issuing the protect commands described later to all the two blocks of the flash upon the program debug completion. In this condition, even if a reading is tryed by using a writer, data of incorporated flash cannot be read. Debug is impossible by using DSU-BROBE after its power is turned off unless DSU Disabled is set upon the next powering and DSU Disabled is released. 3. DSU Enabled (Enabling debug that uses DSU-PROBE) DSU Disabled is fail-safe to prevent any accidental release caused wi th such as runaway. To release DSU Disabled, 0 must be set to the DSU security mode register, SEQMOD TMP19A71 9-5 TMP19A71 31 SEQMOD (0xFFFF_E510) Bit Symbol Read/Write Reset Value Function 23 Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 7 Bit Symbol Read/Write Reset Value Function 0 0 0 6 5 4 R 0 0 0 0 3 2 1 0 DSUOFF R/W 1 1: DSU Disabled 0: DSU Enabled 0 0 0 0 14 13 12 R 0 0 0 0 11 10 9 8 0 0 0 0 22 21 20 R 0 0 0 0 19 18 17 16 0 0 0 0 30 29 28 R 0 0 0 0 27 26 25 24 - Note 1: This register must be accessed by 32-bit system. It is not accessible with any bit operation instruction. 31 SEQCNT (0xFFFF_E514) Bit Symbol Read/Write Reset Value Function 23 Bit Symbol Read/Write Reset Value Function Bit Symbol Read/Write Reset Value Function 7 Bit Symbol Read/Write Reset Value Function 15 - 30 22 14 6 - 29 21 13 5 - 28 W 20 W 27 19 - 26 18 - 25 17 9 1 - 24 16 8 0 - Must be written as 0x0000_00C5. Must be written as 0x0000_00C5. 12 W 4 W Must be written as 0x0000_00C5. 3 2 Must be written as 0x0000_00C5. 11 10 - Note 1: This register must be accessed by 32-bit system. It is not accessible with any bit operation instruction. TMP19A71 9-6 TMP19A71 5. Example of Use by User Example of how to use DSU-PROBE using this function is shown below. TMP19A71 DSU Disabled by Power-On *i Disabled by RESET for MaskROM products*j External port data Determination Program of DSU Enabled (user made) N Is DSU Disabled released? Release of DSU Disabled as writing in SEQMOD and SEQCNT is executed. [DSU- PROBE Disabled] Remained DSU disabled [DSU- PROBE Enabled] DSU is enabled until Power Off (Flash product)/External Reset (Mask product*j Figure 9.2.3 Example Use of DSU Disabled TMP19A71 9-7 TMP19A71 10. DMA Controller (DMAC) The TMP19A71 contains an eight-channel DMA controller (DMAC). 10.1 Features The DMAC has the following features: (1) Eight independent DMA channels (2) Transfer requests: Internal transfer requests: Software initiated External transfer requests: Interrupt signals from on-chip I/O peripherals and external interrupt pins (3) Dual-address mode (4) Memory-to-memory, memory-to-I/O, and I/O-to-memory transfers (5) Transfer width: * Memory: 32-bit * I/O peripherals: 8-, 16-, and 32-bit (6) Address pointers can increment, decrement or remain constant. The user can program the bit positions at which address increment or decrement occurs. (7) Fixed channel priority TMP19A71 10-1 TMP19A71 10.2 Implementation 10.2.1 On-Chip DMAC Interface Figure 10.2.1 shows how the DMAC is internally connected with the TX19A core processor and the Interrupt Controller (INTC). DACK [7 : 0] * INTDREQ [7 : 0] * TX19A Core Processor Interrupt Controller (External Requests) External Interrupt Requests On-Chip I/O Peripheral Interrupt Requests Bus Grant DMAC BUSGNT * Bus Request Bus Release Request BUSREQ * BUSREL * Bus Grant Acknowledge Control Address Data HAVEIT * * Internal signals Figure 10.2.1 DMAC Connections within the TMP19A71 The DMAC provides eight independently programmable channels. With each DMA channel, there are two associated signals: a DMA request (INTDREQn) and a DMA acknowledge (DACKn), where n is a channel number from 0 to 7. Channel priority is fixed. Channel 0 has the highest priority, and Channel 7 has the lowest priority. The TX19A core processor has a snoop function. The snoop function releases the TX19A core processor's data bus to the DMAC, enabling the DMAC to access the internal ROM and internal RAM connected with the TX19A core processor. The DMAC can select whether or not to use this snoop function. For details, see "10.2.3 Snoop Function". The DMAC can use two types of bus request: SREQ and GREQ. GREQ is used when the snoop function is not used, and SREQ is used when the snoop function is used. SREQ has higher priority than GREQ. Note: In debug mode (CP0's Debug.DM=1), peripheral functions cannot be accessed properly with SREQ. In debug mode, do not use SREQ to access peripheral functions. TMP19A71 10-2 TMP19A71 10.2.2 DMAC Block The DMAC block diagram is shown in Figure 10.2.2. Channel 7 Channel 6 Channel 5 Channel 4 Channel 3 Channel 2 Channel 1 Channel 0 31 Source Address Register (SARx Destination Address Register (DARx Byte Count Register (BCRx Channel Control Register (CCRx Channel Status Register (CSRx DMA Transfer Control Register (DTCRx x0 to 7 0 DMA Control Register (DCR Data Holding Register (DHR Figure 10.2.2 DMAC Block Diagram 10.2.3 Snoop Function The TX19A core processor has the snoop function, which releases the TX19A core processor's data bus to the DMAC. When the snoop function is used, the TX19A core processor stops operating until the DMAC relinquishes the bus. The snoop function enables the DMAC to access the internal RAM and internal ROM so that these locations can be specified as source and destination addresses. When the snoop function is not used, the DMAC cannot access the internal RAM and internal ROM. However, even when the snoop function is not used, the G-Bus is released to the DMAC. If the TX19A core processor tries to access memory or I/O through the G-Bus, pipeline operation will be stalled until the DMAC relinquishes bus mastership. Note: When the snoop function is not used, the TX19A core processor does not release the data bus to the DMAC. In this case, if an internal RAM or ROM location is specified as a DMA source or destination address, no acknowledge signal will be returned for the bus request from the DMAC and bus operation will be locked. TMP19A71 10-3 TMP19A71 10.2.4 Register Description The DMAC has fifty 32-bit registers, as listed in Table 10.2.1 . Table 10.2.1 DMAC Register Map (1/2) Address 0xFFFF_D600 0xFFFF_D604 0xFFFF_D608 0xFFFF_D60C 0xFFFF_D610 0xFFFF_D618 0xFFFF_D620 0xFFFF_D624 0xFFFF_D628 0xFFFF_D62C 0xFFFF_D630 0xFFFF_D638 0xFFFF_D640 0xFFFF_D644 0xFFFF_D648 0xFFFF_D64C 0xFFFF_D650 0xFFFF_D658 0xFFFF_D660 0xFFFF_D664 0xFFFF_D668 0xFFFF_D66C 0xFFFF_D670 0xFFFF_D678 0xFFFF_D680 0xFFFF_D684 0xFFFF_D688 0xFFFF_D68C 0xFFFF_D690 0xFFFF_D698 0xFFFF_D6A0 0xFFFF_D6A4 0xFFFF_D6A8 0xFFFF_D6AC 0xFFFF_D6B0 0xFFFF_D6B8 0xFFFF_D6C0 0xFFFF_D6C4 0xFFFF_D6C8 0xFFFF_D6CC 0xFFFF_D6D0 0xFFFF_D6D8 Symbol CCR0 CSR0 SAR0 DAR0 BCR0 DTCR0 CCR1 CSR1 SAR1 DAR1 BCR1 DTCR1 CCR2 CSR2 SAR2 DAR2 BCR2 DTCR2 CCR3 CSR3 SAR3 DAR3 BCR3 DTCR3 CCR4 CSR4 SAR4 DAR4 BCR4 DTCR4 CCR5 CSR5 SAR5 DAR5 BCR5 DTCR5 CCR6 CSR6 SAR6 DAR6 BCR6 DTCR6 Register Name Channel Control Register (Channel 0) Channel Status Register (Channel 0) Source Address Register (Channel 0) Destination Address Register (Channel 0) Byte Count Register (Channel 0) DMA Transfer Control Register (Channel 0) Channel Control Register (Channel 1) Channel Status Register (Channel 1) Source Address Register (Channel 1) Destination Address Register (Channel 1) Byte Count Register (Channel 1) DMA Transfer Control Register (Channel 1) Channel Control Register (Channel 2) Channel Status Register (Channel 2) Source Address Register (Channel 2) Destination Address Register (Channel 2) Byte Count Register (Channel 2) DMA Transfer Control Register (Channel 2) Channel Control Register (Channel 3) Channel Status Register (Channel 3) Source Address Register (Channel 3) Destination Address Register (Channel 3) Byte Count Register (Channel 3) DMA Transfer Control Register (Channel 3) Channel Control Register (Channel 4) Channel Status Register (Channel 4) Source Address Register (Channel 4) Destination Address Register (Channel 4) Byte Count Register (Channel 4) DMA Transfer Control Register (Channel 4) Channel Control Register (Channel 5) Channel Status Register (Channel 5) Source Address Register (Channel 5) Destination Address Register (Channel 5) Byte Count Register (Channel 5) DMA Transfer Control Register (Channel 5) Channel Control Register (Channel 6) Channel Status Register (Channel 6) Source Address Register (Channel 6) Destination Address Register (Channel 6) Byte Count Register (Channel 6) DMA Transfer Control Register (Channel 6) TMP19A71 10-4 TMP19A71 Table 10.2.2 DMAC Register Map (2/2) Address 0xFFFF_D6E0 0xFFFF_D6E4 0xFFFF_D6E8 0xFFFF_D6EC 0xFFFF_D6F0 0xFFFF_D6F8 0xFFFF_D700 0xFFFF_D704 0xFFFF_D70C Symbol CCR7 CSR7 SAR7 DAR7 BCR7 DTCR7 DCR Reserved DHR Data Holding Register (DMAC) Register Name Channel Control Register (Channel 7) Channel Status Register (Channel 7) Source Address Register (Channel 7) Destination Address Register (Channel 7) Byte Count Register (Channel 7) DMA Transfer Control Register (Channel 7) DMA Control Register (DMAC) Note: Although the DMAC registers are 32-bit wide, they can be accessed in 8-bit or 16-bit units. For example, the CCR0[31:0] register can be divided into four 8-bit registers: CCR0[7:0]=CCR0LL, CCR0[15:8]=CCR0LH, CCR0[23:16]=CCR0HL and CCR0[31:24]=CCR0HH. For details, see "18. I/O Register Summary". TMP19A71 10-5 TMP19A71 There are basically no functional differences among the eight DMAC channels. In the following register descriptions, only DMAC0 is explained. 10.2.5 DMA Control Register (DCR) 7 Rst7 W 0 15 6 Rst6 W 0 14 5 Rst5 W 0 13 4 Rst4 W 0 12 R 0x00 23 Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value DCR (0xFFFF_D700) Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 3 Rst3 W 0 11 2 Rst2 W 0 10 1 Rst1 W 0 9 0 Rst0 W 0 8 22 21 20 R 0x00 19 18 17 16 31 Rstall W 0 30 29 28 0 0 0 27 R 0 26 25 24 0 0 0 Bit 31 Mnemonic Rstall Field Name Reset All Description Performs a software reset of the DMAC. When the Rstall bit is set to 1, all the DMAC internal registers are initialized to their reset values. Any transfer requests are removed and all the eight DMA channels are put in Idle state. 0: Don't care 1: Reset the DMAC. Performs a software reset of DMAC Channel 7. When the Rst7 bit is set to 1, all the DMAC Channel 7 internal registers are initialized to their reset values. Any transfer requests for Channel 7 are removed and Channel 7 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 7. Performs a software reset for DMAC Channel 6. When the Rst6 bit is set to 1, all the DMAC Channel 6 internal registers are initialized to their reset values. Any transfer requests for Channel 6 are removed and Channel 6 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 6. Performs a software reset for DMAC Channel 5. When the Rst5 bit is set to 1, all the DMAC Channel 5 internal registers are initialized to their reset values. Any transfer requests for Channel 5 are removed and Channel 5 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 5. 7 Rst7 Reset 7 6 Rst6 Reset 6 5 Rst5 Reset 5 TMP19A71 10-6 TMP19A71 Bit 4 Mnemonic Rst4 Field Name Reset 4 Description Performs a software reset of DMAC Channel 4. When the Rst4 bit is set to 1, all the DMAC Channel 4 internal registers are initialized to their reset values. Any transfer requests for Channel 4 are removed and Channel 4 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 4. Performs a software reset of DMAC Channel 3. When the Rst3 bit is set to 1, all the DMAC Channel 3 internal registers are initialized to their reset values. Any transfer requests for Channel 3 are removed and Channel 3 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 3. Performs a software reset of DMAC Channel 2. When the Rst2 bit is set to 1, al the DMAC Channel 2 internal registers are initialized to their reset values. Any transfer requests for Channel 2 are removed and Channel 2 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 2. Performs a software reset of DMAC Channel 1. When the Rst1 bit is set to 1, all the DMAC Channel 1 internal registers are initialized to their reset values. Any transfer requests for Channel 1 are removed and Channel 1 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 1. Performs a software reset of DMAC Channel 0. When the Rst0 bit is set to 1, all the DMAC Channel 0 internal registers are initialized to their reset values. Any transfer requests for Channel 0 are removed and Channel 0 is put in Idle state. 0: Don't care 1: Reset DMAC Channel 0. 3 Rst3 Reset 3 2 Rst2 Reset 2 1 Rst1 Reset 1 0 Rst0 Reset 0 Note 1: If a software reset command is written to the DCR register immediately after the completion of the transfer cycle of a DMA transaction, the DMA-done interrupt will not be cleared. In this case, the software reset only initializes channel registers and other settings. Note 2: Note 3: Do not issue a software reset command to the DCR register via a DMA transfer. This register does not support bit manipulation instructions. TMP19A71 10-7 TMP19A71 10.2.6 CCR0 (0xFFFF_D600) Channel Control Register (CCR0) Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 7 SAC R/W 0 15 R/W 0 23 NIEn R/W 1 31 Str W 0 6 DIO R/W 0 14 ExR R/W 0 22 AbIEn R/W 1 30 0 5 DAC R/W 00 13 0 21 R/W 1 29 0 4 3 TrSiz R/W 00 2 1 DPS R/W 00 0 12 R/W 0 20 0 28 R 0 11 0 19 R/W 0 27 0 10 0 18 0 26 0 9 STIO R/W 0 17 R/W 1 25 0 8 SAC R/W 0 16 R/W 0 24 W - Bit 31 Mnemonic Str Field Name Channel Start (Reset value: ) Description Enables the corresponding DMA channel. Setting this bit to 1 puts the DMA channel in Ready state. DMA transfer starts as soon as a transfer request is received. Only a write of 1 is valid, and a write of 0 has no effect. This bit is always read as 0. 1: Enable the DMA channel. 24 23 (Reserved) Normal Completion Interrupt Enable Abnormal Completion Interrupt Enable (Reserved) (Reserved) (Reserved) (Reserved) External Request Mode This bit is reserved. It must always be written as 0. (Reset value: 1) 1: Enable interrupts on normal conversion completion. 0: Disable interrupts on normal conversion completion. (Reset value: 1) 1: Enable interrupts on abnormal conversion completion. 0: Disable interrupts on abnormal conversion completion. This bit is reserved. It is reset to 1, but must always be written as 0. NIE0 22 AbIE0 21 20 : 18 17 16 : 15 14 This bit is reserved. It must always be written as 0. This bit is reserved. It is reset to 1, but must always be written as 0. This bit is reserved. It must always be written as 0. (Reset value: 0) Specifies a transfer request mode. 1: External transfer request (Interrupt request) 0: Internal transfer request (Software start) This bit is reserved. It must always be written as 0. ExR 13 (Reserved) TMP19A71 10-8 TMP19A71 Bit 12 11 Mnemonic Field Name (Reserved) Snoop request Description This bit is reserved. It is reset to 0, but must always be written as 1. SReq (Reset value: 0) Specifies whether or not to use the snoop function. When the snoop is used, the TX19A core processor releases the data bus to the DMAC. 1: Use the snoop function. (SREQ) 0: Do not use the snoop function. (GREQ) (Reset value: 0) Specifies whether or not to respond to a bus release request from the TX19A core processor. This bit is valid only when GREQ is used. When SREQ is used, the TX19A core processor cannot issue a bus release request. 1: Respond to a bus release request from the TX19A core processor when the DMAC has bus mastership. When the TX19A core processor issues a bus release request, the DMAC relinquishes the bus upon completion of the current bus operation. 0: Do not respond to a bus release request from the TX19A core processor. (Reset value: 0) Specifies the type of the source device. 1: I/O device 0: Memory (Reset value: 00) Specifies the manner in which the source address changes after each cycle. 1x: Fixed 01: Decremented 00: Incremented (Reset value: 0) Specifies the type of the destination device. 1: I/O device 0: Memory (Reset value: 00) Specifies the manner in which the destination address changes after each cycle. 1x: Fixed 01: Decremented 00: Incremented (Reset value: 00) Specifies the amount of data to be transferred in response to a DMA request. 11: 8 bits (1 byte) 10: 16 bits (2 bytes) 0x: 32 bits (4 bytes) (Reset value: 00) Specifies the bus width of the I/O device specified as a source or destination device. 11: 8 bits (1 byte) 10: 16 bits (2 bytes) 0x: 32 bits (4 bytes) 10 RelEn Release Request Enable 9 STIO Source I/O 8:7 SAC Source Address Count 6 DIO Destination I/O 5:4 DeAC Destination Address Count 3:2 TrSiz Transfer Size 1:0 DPS Device Port Size TMP19A71 10-9 TMP19A71 Note1: The CCRn register must be programmed before placing the DMAC in Ready state. Note 2: The DPS field has no meaning or effect on memory-to-memory transfers. Note 3: When CCRn.DIO=1 (I/O device), do not specify the internal RAM or CG/IRC registers as a destination device. Note 4: This register does not support bit manipulation instructions. 10.2.7 Channel Status Register (CSR0) 7 0 15 0 23 NC 0 31 Act 0 6 0 14 0 22 AbC R/W 0 30 0 5 R 0 13 0 21 0 29 0 4 0 12 R 0 20 BES 0 28 R 0 0 0 0 0 0 19 BED 0 27 0 18 Conf R 0 26 0 17 0 25 0 16 0 24 3 0 11 2 0 10 1 R/W 0 9 0 0 8 - CSR0 Bit Symbol (0xFFFF_D604) Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit 31 Mnemonic Act Field Name Channel Active Description (Reset value: 0) Indicates whether or not the DMA channel is in Ready state. 1: The DMA channel is in Ready state. 0: The DMA channel is not in Ready state. (Reset value: 0) If set, the DMA channel has terminated by normal completion. If the NIE0 bit in the CCR0 register is set, an interrupt is generated. The NC bit is cleared by writing a 0 to it. Clearing the NC bit causes the interrupt to be cleared. The NC bit must be cleared to prior to starting the next transfer. An attempt to set the Str bit in the CCE0 when NC=1 will cause an error. A write of 1 has no effect on this bit. 1: The DMA channel has terminated by normal completion. 0: The DMA channel has not terminated by normal completion. 23 NC Normal Completion TMP19A71 10-10 TMP19A71 Bit 22 Mnemonic AbC Field Name Abnormal completion Description (Reset value: 0) If set, the DMA channel has terminated with an error. If the AbIE0 bit in the CCR0 register is set, an interrupt is generated. The AbC bit can be cleared by writing a 0 to it. Clearing the AbC bit causes the interrupt to be cleared and the BES, BED and Conf bits to be also cleared. The AbC bit must be cleared prior to starting the next transfer. An attempt to set the Str bit in the CCR0 when AbC=1 will cause an error. A write of 1 has no effect on this bit. 1: The DMA channel has terminated with an error. 0: The DMA channel has not terminated with an error. This bit is reserved. It must always be written as 0. (Reset value: 0) 1: A bus error has occurred during the source read cycle. 0: A bus error has not occurred during the source read cycle. (Reset value: 0) 1: A bus error has occurred during the destination write cycle. 0: A bus error has not occurred during the destination write cycle. (Reset value: 0) 1: A configuration error is present. 0: No configuration error is present. This bit is reserved. It must always be written as 0. 21 20 (Reserved) Source Bus Error BES 19 BED Destination Bus Error 18 Conf Configuration Error 2:0 (Reserved) TMP19A71 10-11 TMP19A71 10.2.8 Source Address Register (SAR0) 7 SAR0 Bit Symbol (0xFFFF_D608) Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 6 5 4 SAddr R/W 3 2 1 0 0 15 0 14 0 13 0 12 SAddr R/W 0 11 0 10 0 9 0 8 0 23 0 22 0 21 0 20 SAddr R/W 0 19 0 18 0 17 0 16 0 31 0 30 0 29 0 28 SAddr R/W 0 27 0 26 0 25 0 24 0 0 0 0 0 0 0 0 Bit 31 : 0 Mnemonic SAddr Field Name Source Address (Reset value: ) Description Contains the physical address of the source device. The address changes as programmed in the SAC and TrSiz fields in the CCR0 and the SACM field in the DTCR0. TMP19A71 10-12 TMP19A71 10.2.9 Destination Address Register (DAR0) 7 DAR0 Bit Symbol (0xFFFF_D60C) Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 6 5 4 DAddr R/W 3 2 1 0 0 15 0 14 0 13 0 12 DAddr R/W 0 11 0 10 0 9 0 8 0 23 0 22 0 21 0 20 DAddr R/W 0 19 0 18 0 17 0 16 0 31 0 30 0 29 0 28 DAddr R/W 0 27 0 26 0 25 0 24 0 0 0 0 0 0 0 0 Bit 31 : 0 Mnemonic DAddr Field Name Destination Address (Reset value: ) Description Contains the physical address of the destination device. The address changes as programmed in the DAC and TrSiz fields in the CCR0 and the DACM field in the DTCR0. TMP19A71 10-13 TMP19A71 10.2.10 Byte Count Register (BCR0) 7 BCR0 Bit Symbol (0xFFFF_D610) Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 6 5 4 BC R/W 3 2 1 0 0 15 0 14 0 13 0 12 BC R/W 0 11 0 10 0 9 0 8 0 23 0 22 0 21 0 20 BC R/W 0 19 0 18 0 17 0 16 0 31 0 0 30 0 0 29 0 0 28 R 0 0 27 0 0 26 0 0 25 0 0 24 0 Bit 23 : 0 Mnemonic BC Field Name Byte Count (Reset value: ) Description Contains the number of bytes left to transfer on the DMA channel. The count is decremented by 1, 2 or 4 (as determined by the TrSiz field in the CCR0 register) for each successful transfer. TMP19A71 10-14 TMP19A71 10.2.11 DMA Transfer Control Register (DTCR0) 7 R 0 15 0 23 0 31 0 0 14 0 22 0 30 0 0 13 0 21 0 29 0 0 12 R 0 20 R 0 28 R 0 0 0 0 0 0 27 0 26 0 25 0 24 0 19 0 18 0 17 0 16 0 11 6 5 4 DACM 3 R/W 0 10 0 9 0 8 2 1 SACM 0 DTCR0 Bit Symbol (0xFFFF_D618) Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit 5:3 Mnemonic DACM Field Name Destination Address Count Mode Description Selects the manner in which the destination address is incremented or decremented. 000: Counting begins with bit 0 of the DAR0. 001: Counting begins with bit 4 of the DAR0. 010: Counting begins with bit 8 of the DAR0. 011: Counting begins with bit 12 of the DAR0. 100: Counting begins with bit 16 of the DAR0. 101: Reserved 110: Reserved 111: Reserved Selects the manner in which the source address is incremented or decremented. 000: Counting begins with bit 0 of the SAR0. 001: Counting begins with bit 4 of the SAR0. 010: Counting begins with bit 8 of the SAR0. 011: Counting begins with bit 12 of the SAR0. 100: Counting begins with bit 16 of the SAR0. 101: Reserved 110: Reserved 111: Reserved 2:0 SACM Source Address Count Mode TMP19A71 10-15 TMP19A71 10.2.12 Data Holding Register (DHR) 7 DHR (0xFFFF_D70C) Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value 0 0 0 0 0 31 0 30 0 29 0 28 DOT R/W 0 0 0 0 0 23 0 22 0 21 0 20 DOT R/W 0 27 0 26 0 25 0 24 0 15 0 14 0 13 0 12 DOT R/W 0 19 0 18 0 17 0 16 6 5 4 DOT R/W 0 11 0 10 0 9 0 8 3 2 1 0 Bit 31 : 0 Mnemonic DOT Field Name Data on Transfer Description (Reset value: - ) Contains data read from the source address during a dual-address operation. TMP19A71 10-16 TMP19A71 10.3 Operation This section describes the operation of the DMAC. 10.3.1 Overview The DMAC is a high-speed 32-bit DMA controller used to quickly move large blocks of data between I/O peripherals and memory without intervention of the TX19A core processor. (1) Devices supported for the source and destination The DMAC handles data transfers from memory to memory and between memory and I/O peripherals. The device from which data is transferred is referred to as a source device, and the device to which data is transferred is referred to as a destination device. Both memory and I/O peripherals can be a source or destination device. The DMAC supports data transfers from memory to I/O peripherals, from I/O peripherals to memory, and from memory to memory, but not from I/O peripherals to I/O peripherals. DMA protocols for memory and I/O peripherals differ in accessing an I/O peripheral. To access an I/O peripheral, the DMAC asserts the DACKn (n = channel number) signal to indicate that data is being transferred in response to a previous transfer request. Because each DMA channel has only one DACKn signal, the DMAC cannot handle data transfers between two I/O peripherals. Interrupt requests can be programmed to be a trigger to initiate a DMA process instead of requesting an interrupt to the TX19A core processor. If so programmed, the Interrupt Controller (INTC) forwards a DMA request to the DMAC. The DMA request coming from the INTC is cleared when the INTC receives a DACKn from the DMAC. Consequently, a DMA request for a transfer to/from an I/O peripheral is cleared after each DMA bus cycle (i.e., every time the number of bytes programmed into the CCRn.TrSiz field is transferred). On the other hand, during memory-to-memory transfer, the DACKn signal is not asserted until the byte count register (BCRn) reaches zero. Therefore, memory-to-memory transfer can continuously move large blocks of data in response to a single DMA request. The TMP19A71 on-chip I/O peripherals are handled as memory. For example, data transfers between the TMP19A71 on-chip I/O peripheral and on-chip memory is discontinued after every DMA bus cycle. Nonetheless, until the BCRn register reaches zero, the DMAC remains in Ready state to wait for the next transfer request. Data transfer is continued until the byte count register (BCRn) reaches zero. TMP19A71 10-17 TMP19A71 (2) Exchanging bus mastership (bus arbitration) In response to a DMA request, the DMAC issues a bus request to the TX19A core processor. When the DMAC receives a bus grant signal from the TX19A core processor, it assumes bus mastership to service the DMA request. The DMAC can select whether or not to use the snoop function in requesting bas masterhip to the TX19A core processor. The snoop function releases the TX19A core processor's data bus to the DMAC. This selection is made for each channel by programming the SReq bit in the CCRn register. The TX19A core processor may generate a bus release request to the DMAC. Whether or not to respond to a bus release request from the TX19A core processor is specified for each channel in the ReIEn bit in the CCRn register. The setting of this bit is valid only when the snoop function is not used (GREQ). When the snoop function is used (SREQ), the TX19A core processor cannot generate a bus release request signal. The DMAC relinquishes the bus to the TX19A core processor when there is no pending DMA request to be serviced. Note1: The NMI interrupt is left pending while the DMAC has control of the bus. Note 2: Do not place the TMP19A71 in Halt mode while the DMAC is operating. (3) Transfer request generation Each DMA channel supports two types of request generation methods: internal and external. Internal requests are those generated within the DMAC. The DMA channel is started as soon as the Str bit in the CCRn register is set. The channel immediately requests the bus and begins transferring data. If a channel is programmed for external request and the Str bit is set, the INTDREQn signal asserted by the INTC causes the channel to request the bus and begin a transfer. The DMAC can be programmed to recognize a transfer request with the low level of the INTDREQn signal. (4) Data transfer mode The TMP19A71 DMAC supports dual-address transfers, but not single-address transfers. The dual-address mode allows data to be transferred from memory to memory and between memory and an I/O peripheral. In this mode, the DMAC explicitly addresses both the source and destination devices. The DMAC also generates a DACKn signal when accessing an I/O peripheral. In dual-address mode, a transfer takes place in two DMA bus cycles: a source read cycle and a destination write cycle. In the source read cycle, the data being transferred is read from the source address and put into the DMAC internal Data Holding Register (DHR). In the destination write cycle, the DMAC writes data in the DHR to a destination address. TMP19A71 10-18 TMP19A71 (5) DMA channel operation The DMAC has eight independent DMA channels 0 to 7. Setting the Start (Str) bit in the CCRn (n = channel number) enables a particular channel and puts it in Ready state. When a DMA request is detected in any of the channels in Ready state, the DMAC arbitrates for the bus and begins a transfer. When no DMA request is pending, the DMAC relinquishes the bus to the TX19A core processor and returns to Ready state. The channel can terminate by normal completion or from an error of a bus cycle. When a channel terminates, that channel is put in Idle state. Interrupts can be generated by error termination or by normal channel termination. Figure 10.3.1 shows general state transitions of a DMA channel. The DMAC gives up bus matership. Ready Start The DMAC assumes bus mastership. The DMAC gives up Idle bus mastership. Transfer done Transfer The DMAC assumes bus mastership. Figure 10.3.1 DMA Channel State Transitions TMP19A71 10-19 TMP19A71 (6) Summary of transfer modes The DMAC can perform data transfers according to the combination of mode settings, as shown in the table below. Table 10.3.1 DMAC Mode Combinations Transfer Request Internal (Software) External (Interrupt) Edge/Level Address Mode Data Flow Memory-to-memory Dual Memory-to-memory Memory- to-I/O I/O-to-memory Low level INTDREQn (7) Address change options Address pointers can increment, decrement or remain constant. The SAC and DAC fields in the CCRn respectively select address change directions for the Source Address Register (SARn) and the Destination Address Register (DARn). While memory addresses can be programmed to increment, decrement or remain constant, I/O addresses must be programmed to remain constant. When an I/O peripheral is selected as the source or destination device, the SAC or DAC field in the CCRn must be set to 1x (address fixed). The SACM and DACM fields in the DTCRn provides options to program bit positions at which the source and destination addresses are incremented or decremented after each transfer. The bit position can be bit 0, 4, 8, 12, or 16. Use of bit 0 is the regular increment/decrement mode in which the address changes by 1, 2, or 4, according to the setting of the CCRn.TrSiz field. When bit 4, 8, 12 or 16 is selected, the specified bit of the address changes by 1 regardless of the CCRn.TrSiz field. Two examples of how increment/decrement modes affect address changes are shown below. Example 1: When address bit 0 is selected in the SACM field and address bit 4 is selected in the DACM field SAC: Programmed to increment the source address DAC: Programmed to increment the destination address TrSiz: Programmed to a transfer size of 32 bits Source address: 0xA000_1000 Destination address: 0xB000_0000 SACM: 000Bit 0 is the source address bit at which address increment occurs. DACM: 001Bit 4 is the destination address bit at which address increment occurs. Source 0xA000_1000 0xA000_1004 0xA000_1008 0xA000_100C ... Destination 0xB000_0000 0xB000_0010 0xB000_0020 0xB000_0030 ... 1st transfer 2nd transfer 3rd transfer 4th transfer TMP19A71 10-20 TMP19A71 Example 2: When address bit 8 is selected in the SACM field and address bit 0 is selected in the DACM field SAC: Programmed to decrement the source address DAC: Programmed to decrement the destination address TrSiz: Programmed to a transfer size of 16 bits Source address: 0xA000_0000 Destination address: 0xB000_0000 SACM: 000Bit 8 is the source address bit at which address increment occurs. DACM: 001Bit 0 is the destination address bit at which address increment occurs. Source 0xA000_0000 0x9FFF_FF00 0x9FFF_FE00 0x9FFF_FD00 ... Destination 0xB000_0000 0xAFFF_FFFE 0xAFFF_FFFC 0xAFFF_FFFA ... 1st transfer 2nd transfer 3rd transfer 4th transfer 10.3.2 Transfer Request Generation A DMA request must be issued for the DMAC to initiate a data transfer. Each DMA channel in the DMAC supports two types of request generation method: internal and external. In either request generation mode, once a DMA channel is started, a DMA request causes the DMAC to arbitrate for the bus and begin transferring data. * Internal request generation A channel is programmed for internal request by clearing the ExR bit in the CCRn. In internal request generation mode, a transfer request is generated as soon as the Str bit in the CCRn is set. An internally generated request keeps a transfer request pending until the transfer is complete. If no transition to a higher-priority DMA channel or a bus master occurs, the channel will use 100% of the available bus bandwidth to transfer all data continuously. Internally generated requests support only memory-to-memory transfer. * External request generation A channel is programmed for external request by setting the ExR bit in the CCRn. In external request generation mode, setting the Str bit in the CCRn puts the channel in Ready sate. While in Ready state, assertion of the INTDREQn signal (where n is the channel number) coming from the Interrupt Controller (INTC) causes a transfer request to be generated. Externally generated requests support data transfers from memory to memory and between memory and an I/O peripheral. The TMP19A71 can recognize a transfer request with the low level of INTDREQn. The transfer size, i.e., the amount of data to be transferred in response to a transfer request, is programmed in the TrSiz field in the CCRn. The transfer size can be 32 bits, 16 bits or 8 bits. Transfer request generation by INTDREQn is described in detail below. TMP19A71 10-21 TMP19A71 (1) Transfer request coming from the INTC A transfer request is removed by assertion of the DACKn signal (where n is the channel number). DACKn is asserted: 1) when an I/O peripheral bus cycle has completed and 2) when the Byte Count Register (BCRn) has reached zero in memory-to-memory transfer. Consequently, a memory-to-I/O or I/O-to-memory transfer request terminates after one DMA bus cycle completes, whereas memory-to-memory transfer can continuously move large blocks of data in response to a single DMA request. The INTC might clear INTDREQn before the DMAC accepts it and begins a data transfer. It must be noted that, even if that happens, a DMA bus cycle might be executed after the interrupt request has been cleared. TMP19A71 10-22 TMP19A71 10.3.3 DMA Address Modes DMA transfer is generally performed in either of two address modes: dual-address mode and single-address mode. In dual-address mode, both the source and destination devices are explicitly addressed. In single-address mode, only either the source device or the destination device is explicitly addressed. The TMP19A71, however, supports dual-address mode only. In dual-address mode, two bus transfers occur: a read from the source device and a write to the destination device. In the source read cycle, data is read from the source address and placed in the DMAC internal Data Holding Register (DHR). Then, in the destination write cycle, the data held in the DHR is written to the destination address. DMAC Source Device Address Address Bus (1) (2) Data Data Bus (2) (1) Destination Device Figure 10.3.32 Dual-Address Transfer Mode The transfer size programmed into the CCRn.TrSiz field determines the amount of data that is transferred from a source device in response to a DMA request. The transfer size can be 32 bits, 16 bits or 8 bits. The internal DHR is a 32-bit register that serves as a buffer for the data being transferred from a source device to a destination device during dual-address mode. Memory accesses occur in a manner to fulfill the CCRn.TrSiz setting. Memory-to-I/O and I/O-to-memory DMA transfers are governed by the setting of the CCRn.DPS field in addition to the setting of CCRn.TrSiz. The DPS field defines the port size of a source or destination I/O peripheral. The I/O port size can be 32 bits, 16 bits or 8 bits. TMP19A71 10-23 TMP19A71 If the transfer size is equal to the I/O port size, an I/O access takes a single read or single write cycle. If the I/O port size is less than the programmed transfer size, the internal 32-bit DHR serves as a buffer for the data being transferred. For example, assume that the transfer size is programmed to 32 bits. If the source I/O port size is 8 bits and the destination memory width is 32 bits, then four 8-bit read cycles occur, followed by a 32-bit write cycle. The 32 bits of data are buffered in the DHR until the destination write cycle occurs. Source and destination addresses can be programmed to increment or decrement after each transfer. The BRCn is decremented by TrSiz for each data transfer. It is forbidden to program the device port size (DPS) to a value greater than the DMA transfer size (TrSiz). The relationships between TrSiz and DPS are summarized below. Table 10.3.2 DMA Transfer Sizes and Device Port Sizes (in Dual-Address Mode) TrSiz 0x (32 bits) 0x (32 bits) 0x (32 bits) 10 (16 bits) 10 (16 bits) 10 (16 bits) 11 (8 bits) 11 (8 bits) 11 (8 bits) DPS 0x (32 bits) 10 (16 bits) 11 (8 bits) 0x (32 bits) 10 (16 bits) 11 (8 bits) 0x (32 bits) 10 (16 bits) 11 (8 bits) Number of I/O Bus Cycles 1 2 4 Setting prohibited 1 2 Setting prohibited Setting prohibited 1 TMP19A71 10-24 TMP19A71 10.3.4 DMA Channel Operation Each DMA channel is started by setting the Str bit in the CCRn to 1. Once started, the DMAC checks the channel setups for configuration errors. If no configuration error is present, the channel enters Ready state. When a DMA request is detected while in Ready state, the DMAC arbitrates for the bus and begins transferring data. The channel can terminate by normal completion or from an error. The state of termination is indicated in the CSRn. Channel startup A DMA channel is started by setting the Str bit in the CCRn. Once started, the DMAC checks the channel setups for configuration errors. If a configuration error is detected, the channel terminates abnormally. If no configuration error is present, the channel enters Ready state. Once a channel enters Ready state, the Act bit in the CSRn is set to 1. If the channel is programmed for internal requests, the channel requests the bus and starts transferring data immediately. If the channel is programmed for external requests, INTDREQn must be asserted before the channel requests the bus. Channel termination A DMA channel can terminate by normal completion or from an error. The status of a DMA operation can be determined by reading the CSRn. A channel terminates abnormally if an attempt is made to set the Str bit in the CCRn when the NC or AbC bit in the CSRn is set. Normal termination A DMA channel terminates by normal completion in the following case. Normal completion always occurs at the boundary of transfers programmed into the CCRn. TrSize field. * Data transfers have terminated, with the BCRn decremented to 0. Abnormal termination The following summarizes the cases in which a DMA channel terminates from an error. * Configuration errors A configuration error results when the channel initialization contains inconsistencies or errors. A configuration error is reported before any data transfer takes place; therefore, in case of a configuration error, the SARn, DARn and BCRn remain unaltered. When a DMA channel has terminated from a configuration error, the AbC and Conf bits in the CSRn are set. A configuration error occurs for the following cases: - Both the SIO and DIO bits in the CCRn are set to 1. - The CCRn.Str bit is set to 1 when the NC or AbC bit in the CSRn is set to 1. - The BCRn contains a value that is not an integer multiple of the transfer size programmed into the CCRn.TrSiz field. - The SARn or DARn contains a value that is not an integer multiple of the TMP19A71 10-25 TMP19A71 transfer size programmed into the CCRn.TrSiz field. - The CCRn.TrSiz and CCRn.DPS fields contain illegal combinations. - The CCRn.Str bit is set to 1 when the BCRn contains a value of zero. * Bus errors When a DMA channel has terminated from a bus error, the AbC bit and the BES or the BED bit in the CSRn are set. - A bus error has been reported during a source read or destination write cycle. Note: The contents of the BCRn, SARn and DARn are not guaranteed when a channel has terminated due to a bus error. Chapter 18 lists the reserved addresses that, if accessed, cause a bus error. 10.3.5 DMA Channel Priority The DMAC provides a fixed priority for the eight channels, with channel 0 always having the highest priority and channel 7 the lowest. For example, when transfer requests occur on channels 0 and 1 simultaneously, the channel 0 request is serviced first. The channel 1 request is left pending. In order for the channel 1 request to be serviced, it must be maintained until data transfer completes on channel 0. Remember that the internally generated request is kept until the servicing of the request is finished. External transfer requests come from the Interrupt Controller (INTC). The INTC can program any interrupts to be used as a DMA trigger instead of as an interrupt request. If such an interrupt is programmed to be edge-sensitive, the INTC internally maintains a transfer request. However, a level-sensitive interrupt is not held in the INTC; thus the interrupt request signal must remain asserted until the servicing of the DMA request begins. A higher-priority channel always gets the attention of the DMAC. If a transfer request occurs on channel 0 while a request on channel 1 is being serviced, the servicing of the channel 1 request is suspended temporarily in order to service the channel 0 request first. After the channel 0 request has been serviced, channel 1 resumes the remaining data transfer. Channel transitions take place at the boundary of a transfer size programmed for the current channel being serviced; that is, after all data in the DHR are written to a destination. Interrupts The DMAC can generate an interrupt request (INTDMAn) to the TX19A core processor upon completion of a channel operation: either by normal channel termination or by abnormal termination of a bus cycle. * Normal completion interrupt When a channel operation terminates by normal completion, the NC bit in the CSRn is set to 1. At this time, if the NIEn bit in the CCRn is set, an interrupt request is generated to the TX19A core processor. * Abnormal completion interrupt When a channel operation terminates abnormally, the AbC bit in the CSRn register is set to 1. At this time, if the AbIEn bit in the CCRn is set, an interrupt request is generated to the TX19A core processor. TMP19A71 10-26 TMP19A71 10.4 DMA Transfer Timing All DMAC operations are synchronous to the rising edges of the internal system clock. 10.4.1 Dual-Address Mode * Memory-to-memory transfer Figure 10.4.1 shows a DMA cycle from one external 16-bit memory to another, with the transfer size programmed to 16 bits. A block of data is transferred until the BCRn register reaches 0. tsys A [23 : 0] CS0 CS1 RD WR / HWR D [15 : 0] Data Data Read Write Figure 10.4.1 Memory-to-Memory Transfer (Dual-Address Mode) * Memory-to-I/O transfer Figure 10.4.2 shows a DMA cycle from a 16-bit memory to an 8-bit I/O peripheral, with the transfer size programmed to 16 bits. tsys A [23 : 0] CS0 CS1 RD WR D [15 : 0] Data Data Data Read Write Write Figure 10.4.2 Memory-to-I/O Transfer (Dual-Address Mode) TMP19A71 10-27 TMP19A71 * I/O-to-memory transfer Figure 10.4.3 shows a DMA cycle from an 8-bit I/O peripheral to a 16-bit memory, with the transfer size programmed to 16 bits. tsys A [23 : 0] CS0 CS1 RD WR / HWR D [15 : 0] Data Data Data Read Read Write Figure 10.4.3 I/O-to-Memory Transfer (Dual-Address Mode) TMP19A71 10-28 TMP19A71 10.4.2 Programming Example The following illustrates the programming required to transfer data from an SIO receive buffer (SC1BUF) to the on-chip RAM. (1) DMAC settings: * * * * DMA channel used: Channel 0 Source address: SC1BUF Destination address: 0xFFFF_9800 (physical address) Number of bytes transferred: 256 (2) SIO settings: * * * Data format: 8 bits, UART SIO channel used: Channel 1 Transfer rate: 9600 bps DMA channel 0 is used for the transfer. The SIO1 receive interrupt is used as a trigger to start the DMA channel 0. (3) DMA channel 0 settings: DCR IMR56 ICLR DTCR0 SAR0 DAR0 BCR0 CCR0 0x8000_0000 15 7 0 xxxx, xxxx, x100, x100 0xe0 0x0000_0000 **** 0xFFFF_F208 0xFFFF_9800 0x0000_00FF 0x80C0_5B0F 27 23 /* Reset DMAC * / /* Interrupt level = 4 (arbitrary) * / /* IVR [8:0] * / /* DACM = 000 * / /* SACM = 000 * / /* Physical address of SC1BUF */ /* Physical address of destination */ /* 256 (Number of bytes to be transferred) / (Contents) 31 19 1000000011000000 15 11 7 3 01011x11x0001111 (4) SIO channel 1 settings: IMR51 ICLR 31 15 xxxx, xxxx, x101, x000 0xCC 0x29 0x00 0xB5 0x05 /* Use INTRX1 as a DMA trigger and select DMA ch.0 * / /* IVR [8:0]; clear INTRX1 * / /* UART mode, 8-bit data format * / SC1MOD0 SC1CR BR1CR BR1ADD /* @IMCLK = 28 MHz (approx. 9615 bps) */ /* Baud rate generator divisor */ TMP19A71 10-29 TMP19A71 11. 16-Bit Timer/Event Counters (TMRBs) The TMP19A71 has a 16-bit timer/event counter consisting of four identical channels (TMRB0 to TMRB3). Each channel has the following three basic operating modes: * * * * * 16-Bit Interval Timer mode 16-Bit Event Counter mode 16-Bit Programmable Pulse Generation (PPG) mode Each channel has capture capability, which enables the following operations: Pulse width measurement One-shot pulse generation from an external trigger pulse Figure 11.1.1 shows a block diagram of the TMRB0. The main components of a TMRBn block are a 16-bit up-counter, two 16-bit timer registers (one of which is double-buffered), two 16-bit capture registers, two comparators, capture control logic and timer flip-flop logic. Each of the four channels (TMRB0 to TMRB3) is independently programmable and functionally equivalent except for the differences shown in Table 11.1.1. In the sections that follow, any references to the TMRB0 also apply to other channels. Table 11.1.1 Pins and Registers for the TMRB0 to TMRB3 Channel Specifications External Pins External Clock/ Capture Trigger Input Timer Flip-Flop Output Timer Run Register Timer Mode Register Timer Flip-Flop Control Registers Register TMRB0 TMRB1 TMRB2 TMRB3 TB0IN (shared with P93) TB1IN (shared with P70) TB2IN (shared with P71) TB3IN (shared with P72) TB0OUT (shared with P94) TB1OUT (shared with P84) TB2OUT(shared with PA7) TB3OUT (shared with PB7) TB0RUN (0xFFFF_C700) TB0MOD (0xFFFF_C704) TB0FF (0xFFFF_C708) TB1RUN (0xFFFF_C720) TB2RUN (0xFFFF_C740) TB3RUN (0xFFFF_C760) TB1MOD (0xFFFF_C724) TB2MOD (0xFFFF_C744) TB3MOD (0xFFFF_C764) TB1FF (0xFFFF_C728) TB2FF (0xFFFF_C748) TB3FF (0xFFFF_C768) (Addresses) Timer Registers Capture Registers Counter TB0REG0 (0xFFFF_C70C) TB1REG0 (0xFFFF_C72C) TB2REG0 (0xFFFF_C74C) TB3REG0 (0xFFFF_C76C) TB0REG1 (0xFFFF_C710) TB0CP0 (0xFFFF_C714) TB0CP1 (0xFFFF_C718) TB0CNT (0XFFFF_C71C) TB1REG1 (0xFFFF_C730) TB2REG1 (0xFFFF_C750) TB3REG1 (0xFFFF_C770) TB1CP0 (0xFFFF_C734) TB1CP1 (0xFFFF_C738) TB2CP0 (0xFFFF_C754) TB2CP1 (0xFFFF_C758) TB3CP0 (0xFFFF_C774) TB3CP1 (0xFFFF_C778) TB1CNT (0XFFFF_C73C) TB2CNT (0XFFFF_C75C) TB3CNT (0XFFFF_C77C) TMP19A71 11-1 TMP19A71 11.1 Block Diagram Figure 11.1.1 shows a block diagram of the 16-bit timer/event counter (TMRB0). IMBUS Run/ Clear TB0RUN 8 16 32 64 IMCLK 2 4 1/2 1/4 1/8 1/16 1/32 1/64 TB0IN TB0MOD TB0F F Timer Flip-Flop Control Timer Flip-Flop Output TB0OUT TB0RUN TMRB0 Interrupt INTTBCOM00/01 INTTBCAP00/01 TB0MOD 16-Bit Comparator TB0CP0 (TB0CMP0) 16-Bit Timer Register TB0REG0 TB0RUN Register Buffer 0 IMBUS IMBUS Figure 11.1.1 TMRB0 Block Diagram TMP19A71 11-2 TMP19A71 11.2 Timer Components (1) Prescaler The TMRB0 has a 6-bit prescaler that slows the rate of a clocking source to the counter. The prescaler clock source is the IMCLK selected by the PRS2 field in the CLKPRSC register within the clock generator. The prescaler output clock can be selected from IMCLK, IMCLK/2, IMCLK/4, IMCLK/8, IMCLK/16, IMCLK/32 and IMCLK/64 by programming the CLK field in the TB0MOD register. (2) Up-Counter (TB0CNT) The TMRB0 contains a 16-bit up-counter, which is driven by the clock selected by the CLK field in the TB0MOD register. The clock input to the TB0CNT can be selected from seven prescaler outputs (IMCLK, IMCLK/2, IMCLK/4, IMCLK/8, IMCLK/16, IMCLK/32 and IMCLK/64) or the external clock applied to the TB0IN pin. The RUN bit in the TB0RUN register is used to start the TB0CNT and to stop and clear the TB0CNT. The TB0CNT is cleared to 0000H, if so enabled, when it reaches the value in the TB0REG0 or TB0REG1 register. This clearing can be enabled and disabled by the CLE bit in the TB0MOD register. If the clearing is disabled, the TB0CNT acts as a free-running counter. If the overflow interrupt is enabled in the OFI bit in the TB0RUN register, an interrupt (INTTBCOM00) is generated upon a counter overflow. TMP19A71 11-3 TMP19A71 (3) Timer Registers (TB0REG0, TB0REG1) Each timer channel has two 16-bit registers containing a time constant. When the up-counter reaches the timer constant value in each timer register, the associated comparator block generates a match-detect signal. Each of the timer registers (TB0REG0, TB0REG1) can be written with a halfword-load instruction. Although it is also possible to use a series of two byte-load instructions, be sure to use a halfword-load instruction while the TB0CNT is counting to prevent an erroneous match detect when only the first byte-load instruction has been executed. To write to the timer register while the TB0CNT is counting and double-buffering is disabled, the write timing must be managed by software. One of the two timer registers, TB0REG0, is double-buffered. The double-buffering function can be enabled and disabled through the programming of the DBE bit in the TB0RUN register: 0 = disable, 1=enable. If double-buffering is enabled, the TB0REG0 latches a new time constant from the register buffer 0. This takes place when a match is detected between the TB0CNT and the TB0REG1. Upon reset, the contents of the TB0REG0 and TB0REG1 are cleared to zero; thus, they must be loaded with valid values before the timer can be used. A reset clears the TB0RUN.DBE bit to 0, disabling the double-buffering function. To use this function, the TB0RUN.DBE bit must be set to 1 after loading the TB0REG0 and TB0REG1with time constants. When TB0RUN.DBE=1, the next time constant can be written to the register buffer. The TB0REG0 and the corresponding register buffer are mapped to the same address (0xFFFF_C70C). When TB0RUN.DBE=0, a time constant value is written to both the TB0REG0 and the register buffer. When TB0RUN.DBE=1, a time constant value is written only to the register buffer. Therefore, the double-buffering function should be disabled when writing an initial time constant to each timer register. (4) Capture Registers (TB0CP0, TB0CP1) The capture registers are 16-bit registers used to latch the value of the up-counter (TB0CNT). Each of the capture registers can be read with a halfword-load instruction. Although it is also possible to use a series of two byte-load instructions, it is recommended to use a halfword-load instruction while the timer is counting because the register value may be updated before the second byte-load instruction is executed. The CPM field in the TB0MOD register is used to select the timing for latching the TB0CNT value to the TB0CP0 and TB0CP1. Furthermore, an up-counter value can be captured under software control: a write of 0 to the TB0MOD.CP0 bit causes the current TB0CNT value to be latched into the TB0CP0. To use the capture capability, the prescaler must be running (i.e., TB0RUN.PRUN=1). TMP19A71 11-4 TMP19A71 (5) Comparators (TB0CMP0, TB0CMP1) The TMRB0 contains two 16-bit comparators. The TB0CMP0 block compares the output of the up-counter (TB0CNT) with a time constant value in the TB0REG0. The TB0CMP1 block compares the output of the TB0CNT with a time constant value in the TB0REG1. When a match is detected, an interrupt (INTTBCOM0x) is generated. The TB0CMP0 does not detect a match when the TB0REG0 value is 0000H whereas the TB0CMP1 detects a match when TB0REG1=0000H. To use the match detect function of the TB0CMP1, setting TB0MOD.CLE=1 or TB0FF.INVC1=1 is required. However, if TB0REG1 is set to 0000H with TB0MOD.CLE=1, undefined operation will result. (6) Timer Flip-Flop (TB0FF) The timer flip-flop (TB0FF) is toggled, if so enabled, upon assertion of match-detect signals from the comparators and latch signals from the capture control logic. The toggling of the TB0FF can be enabled and disabled through the programming of the INVL1, INVL0, INVC1, INVC0, and MOD bits in the TB0FF register. Upon reset, the TB0FF is cleared to 0. A write of 00 to the MOD field in the TB0FF causes the TB0FF to be toggled to the opposite value; a write of 01 to this field sets the TB0FFto 1; and a write of 10 to this field clears the TB0FF to 0. The value of the TB0FF can be driven onto the TB0OUT pin, which is multiplexed with P94. The Port 9 registers (P9CR, P9FR1) must be programmed to configure the TB0OUT/P94 pin as an output from the TB0FF. After reset, the TB0OUT pin outputs 0 until the TB0FF.MOD field is set. TMP19A71 11-5 TMP19A71 11.3 Register Description As shown in Table 11.3.1, the main components of the TMRBn block are a 16-bit up-counter, two 16-bit timer registers (one of which is double-buffered), two 16-bit capture registers, two comparators, capture control logic and timer flip-flop control logic. The 11-byte registers provide control over the operating modes and timer flip-flops. Table 11.3.1 TMRB Register Map (1/2) Address 0xFFFF_C700 0xFFFF_C704 0xFFFF_C705 0xFFFF_C708 0xFFFF_C70C 0xFFFF_C710 0xFFFF_C714 0xFFFF_C718 0xFFFF_C71C 0xFFFF_C720 0xFFFF_C724 0xFFFF_C725 0xFFFF_C728 0xFFFF_C72C 0xFFFF_C730 0xFFFF_C734 0xFFFF_C73C Bits 8 16(8) 8 8 16 16 16 16 16 8 16(8) 8 8 16 16 16 16 Mnemonic TB0RUN TB0MOD(L) TB0MODH TB0FF TB0REG0 TB0REG1 TB0CP0 TB0CP1 TB0CNT TB1RUN TB1MOD(L) TB1MODH TB1FF TB1REG0 TB1REG1 TB1CP0 TB1CNT TMRB0 Run Register TMRB0 Mode Register (Low) TMRB0 Mode Register High TMRB0 Flip-Flop Control Register TMRB0 Compare Register 0 TMRB0 Compare Register 1 TMRB0 Capture Register 0 TMRB0 Capture Register 1 TMRB0 Counter Register TMRB1 Run Register TMRB1 Mode Register (Low) TMRB1 Mode Register High TMRB1 Flip-Flop Control Register TMRB1 Compare Register 0 TMRB1 Compare Register 1 TMRB1 Capture Register 0 TMRB1 Counter Register Register Name TMP19A71 11-6 TMP19A71 Table 11.3.2 TMRB Register Map (2/2) Address 0xFFFF_C740 0xFFFF_C744 0xFFFF_C745 0xFFFF_C748 0xFFFF_C74C 0xFFFF_C750 0xFFFF_C754 0xFFFF_C75C 0xFFFF_C760 0xFFFF_C764 0xFFFF_C765 0xFFFF_C768 0xFFFF_C76C 0xFFFF_C770 0xFFFF_C774 0xFFFF_C77C Note 1: Bits 8 16(8) 8 8 16 16 16 16 8 16(8) 8 8 16 16 16 16 Mnemonic TB2RUN TB2MOD(L) TB2MODH TB2FF TB2REG0 TB2REG1 TB2CP0 TB2CNT TB3RUN TB3MOD(L) TB3MODH TB3FF TB3REG0 TB3REG1 TB3CP0 TB3CNT TMRB2 Run Register TMRB2 Mode Register (Low) TMRB2 Mode Register High TMRB2 Flip-Flop Control Register TMRB2 Compare Register 0 TMRB2 Compare Register 1 TMRB2 Capture Register 0 TMRB2 Counter Register TMRB3 Run Register TMRB3 Mode Register (Low) TMRB3 Mode Register High TMRB3 Flip-Flop Control Register TMRB3 Compare Register 0 TMRB3 Compare Register 1 TMRB3 Capture Register 0 TMRB3 Counter Register Register Name Although the TBxMOD is a 16-bit register, it can be accessed as two 8-bit registers: TBxMODL (low) and TBxMODH (high). Note 2: The TBxCP0 and TBxCP1 can be read by two byte-load instructions. However, we recommend using a halfword-load instruction while the timer is counting as the register value may be updated between two byte-load instructions. Note 3: The TB0REG0 and TB0REG1 can be written by two byte-load instructions. However, we recommend using a halfword-load instruction as a match with TB0CNT may be erroneously detected when only the first byte has been written. TMP19A71 11-7 TMP19A71 TMRB0 Run Register 7 TB0RUN (0xFFFF_C700) Bit Symbol Read/Write Reset Value Function 0 Doublebuffer 0: Disable 1: Enable 0 Must be set as 0. 0 External trigger 0: Rising edge 1: Falling edge 0 Counter start DBE 6 5 TRGSEL 4 CSSEL R/W 3 IDL 2 PRUN 0 Prescaler start 0: Stop and clear 1:Run 1 OFI 0 Overflow interrupt 0: Disable 1: Enable 0 TRUN 0 Timer start 0: Stop and clear 1:Run 0 TMRB0 operation 0: Software 0: Stop & keep start counter 1: External value trigger 1:Normal operation Note 1: The difference between stopping the timer by setting IDL=0 and TRUN=0 is that IDL=0 preserves the TBxCNT value whereas TRUN=0 clears the TBxCNT value. Note 2: When the CSSEL bit is set to 1, the TB0CNT starts counting triggered by the TB0IN pin input as specified in the TRGSEL bit. To start counting by the external trigger signal, the TRUN bit must be set to 1. If TRUN=0, the counter remains stopped and cleared as in the case of software start. Note 3: Once the counter is started by an external trigger, the trigger is kept internally. To accept a next external trigger, it is necessary to clear and stop the counter by clearing the TRUN bit to 0 and then to set TRUN=1 again. Any external triggers accepted before the TRUN bit is cleared to 0 are ignored. TMP19A71 11-8 TMP19A71 TMRB0 Mode Register 7 TB0MOD(L) (0xFFFF_C704) Bit Symbol Read/Write Reset Value Function W 0 0 Capture timing 00: Disable 10: Latches the counter value into TB0CP0 at rising edges of TB0IN and generates INTTBCAP01. Latches the counter value into TB0CP1 at falling edges of TB0IN and generates INTTBCA00. Others: Reserved 0 Up-counter clear control 0:Clearing disabled 1: Clears up-counter upon a match with TB0REG1 6 5 CPM 4 3 CLE R/W 2 1 CLK 0 000 Clock source 000: TB0IN pin input (TMRB0 only) 001: IMCLK 010: IMCLK/2 011: IMCLK/4 100: IMCLK/8 101: IMCLK/16 110: IMCLK/32 111: IMCLK/64 15 Bit Symbol TB0MODH (0xFFFF_C705) Read/Write Reset Value Function 0 14 0 13 R 0 12 0 11 0 10 0 9 R/W 0 Must be set as 0. 8 CP0 W 1 Software capture control 0: Software capture 1:Don't care This bit is always read as 1. Note: This register does not support bit manipulation instructions. TMP19A71 11-9 TMP19A71 TMRB0 Flip-Flop Control Register 7 Bit Symbol TB0FF (0xFFFF_C708) Read/Write Reset Value Function W 0 When the up-counter value is latched into TB0CP1 0: Toggletrigger disabled 1:Toggletrigger enabled 6 5 INVL1 4 INVL0 R/W 0 When the up-counter value is latched into TB0CP0 0: Toggletrigger disabled 1:Toggletrigger enabled 3 INVC1 0 When the up-counter value reaches TB0REG1 0: Toggletrigger disabled 1: Toggletrigger enabled 2 INVC0 0 When the up-counter value reaches TB0REG0 0: Toggletrigger disabled 1:Toggletrigger enabled 1 MOD W 0 11 Flip-flop control 00: Toggles TB0OUT (software toggle) 01: Sets TB0OUT to 1 10: Clears TB0OUT to 0 11: Don't care This field is always read as 11. TMRB0 Compare Register 0 7 Bit Symbol TB0REG0 (0xFFFF_C70C) Read/Write Reset Value Function 6 5 4 CMP0 R/W 3 2 1 0 0x00 When double-buffering is enabled, this register stores the value used for the second comparison. 15 Bit Symbol Read/Write Reset Value Function Note 1: Note 2: 14 13 12 CMP0 R/W 0x00 11 10 9 8 The TB0CMP0 does not detect a match when TB0REG0=0x0000. To use the INTTBCOM0x interrupt, capture operation must be disabled by setting TB0MOD.CPM=00. When TB0MOD.CPM is set to a value other than 00, no interrupt is generated. However, match detection is performed so that the output on the TB0OUT pin can be toggled. TMRB0 Compare Register 1 7 Bit Symbol TB0REG1 (0xFFFF_C710) Read/Write Reset Value Function 6 5 4 CMP1 R/W 3 2 1 0 0x00 This register stores the value used for comparison. 15 Bit Symbol Read/Write Reset Value Function 14 13 12 CMP1 R/W 0x00 11 10 9 8 Note 1: The TB0CMP1 detects a match even when TB0REG1=0x0000. Note 2: Match detection by the TB0CMP1 requires setting TB0MOD.CLE=1 or TB0FF.INV1=1. TMP19A71 11-10 TMP19A71 TMRB0 Capture Register 0 7 Bit Symbol TB0CP0 (0xFFFF_C714) Read/Write Reset Value Function 6 5 4 CP0 R 3 2 1 0 0x00 Capture value 0 of the up-counter (Low) 15 Bit Symbol Read/Write Reset Value Function 14 13 12 CP0 R 11 10 9 8 0x00 Capture value 0 of the up-counter (High) TMRB0 Capture Register 1 7 Bit Symbol TB0CP1 (0xFFFF_C718) Read/Write Reset Value Function 6 5 4 CP1 R 3 2 1 0 0x00 Capture value 1 of the up-counter (Low) 15 Bit Symbol Read/Write Reset Value Function 14 13 12 CP1 R 11 10 9 8 0x00 Capture value 1 of the up-counter (High) TMRB0 Counter Register 7 Bit Symbol TB0CNT (0xFFFF_C71C) Read/Write Reset Value Function 6 5 4 CNT R 3 2 1 0 0x00 Count value of the up-counter (Low) 15 Bit Symbol Read/Write Reset Value Function 14 13 12 CNT R 11 10 9 8 0x00 Count value of the up-counter (High) TMP19A71 11-11 TMP19A71 11.4 Operating Modes The 16-bit timer has the following operation modes: (A) 16-Bit Interval Timer mode (B) 16-Bit Event Counter mode (C) 16-Bit Programmable Pulse Generation (PPG) mode The TMRB0 has the capture capability used to latch the value of the counter. The capture capability allows: (D) Pulse width measurement (E) One-shot pulse generation using an external trigger pulse 11.4.1 16-Bit Interval Timer Mode To accomplish periodic interrupt generation, the interval time is set in the TB0REG1 register, and the INTTBCOM01 interrupt is enabled. Example: Setting the 20 s interval timer (IMCLK: 28 MHz) using INTTBCOM01 1. 2. TB0RUN = 0x00; IMR25 = 0x00; IMR26 = 0x41; 3. TB0FF = 0x0A; TB0MOD = 0x010A; TB0REG1 = 0x0118; 4. TB0RUN = 0x0D; // Stop timer 0 // Disable INTTBCOM00 // Enable INTTBCOM01 // INVC1=1, FF=0 // Select prescaler (IMCLK/2) // Set interval time // Start timer 71.4ns IMCLK/2 TB0CNT TB0REG1 INTTBCOM01 TB0OUT 20sec Figure 11.4.1 16-Bit Interval Timer Mode 0x0000 0x0001 0x01180x0000 0x0001 0x01180x0000 0x0001 0x01180x0000 TMP19A71 11-12 TMP19A71 11.4.2 16-Bit Event Counter Mode This mode is used to count events by interpreting the rising edges of the external counter clock (TB0IN) as events. The up-counter counts up on each rising edge of the TB0IN pin input. The counter value can be latched into a capture register under software control. To determine the number of events (i.e., cycles) counted, the value in the capture register must be read. Example: Setting the event counter 1. 2. TB0RUN = 0x00; IMR84 = 0x41; IMR85 = 0x00; 3. TB0FF = 0x03; TB0MOD = 0x0124; TB0REG1 = 0x0050; 4. TB0RUN = 0x0D; // Stop timer 0 // Enable INTTBCAP00 // Disable INTTBCAP01 // Disable trigger // Select external time, IMCLK/8 // Set interval time // Start timer TMP19A71 11-13 TMP19A71 11.4.3 16-Bit Programmable Pulse Generation (PPG) Mode The 16-Bit PPG mode can be used to generate a square wave with any frequency and duty cycle. The pulse can be high-going or low-going, as determined by the initial setting of the timer flip-flop (TB0FF). A square wave is generated by toggling the timer flip-flop (TB0FF) every time the up-counter (TB0CNT) reaches the value in each timer register (TB0REG0, TB0REG1). The square-wave output is driven to the TB0OUT pin. In this mode, the following relationship must be satisfied: (TB0REG0 value) < (TB0REG1 value) TB0REG0 Match (INTTBCOM00 Interrupt) TB0REG1 Match (INTTBCOM01 Interrupt) TB0OUT Pin Figure 11.4.2 PPG Output Waveform If the double-buffering function is enabled, the TB0REG0 value can be changed dynamically by writing a new value into the register buffer. Upon a match between the TB0REG1 and the TB0CNT, the TB0REG0 latches a new value from the register buffer. The TB0REG0 can be loaded with a new value upon every match thus making it easy to generate a square wave with virtually any duty cycle. TB0REG0 Match TB0REG1 Match TB0REG0 (Compare Value) Register Buffer Up-Counter = Q1 Up-Counter = Q2 Shift into TB0REG1 Q1 Q2 Q2 Q3 Write to TB0REG0 Figure 11.4.3 Register Buffer Operation TMP19A71 11-14 TMP19A71 Example: Setting the event counter with double-buffering 1. 2. TB0RUN = 0x00; TB0REG0 = 0x0050; TB0REG1 = 0x0080; // Stop timer 0 // Set interval time 3. 4. TB0RUN = 0x80; TB0FF = 0x0E; TB0MOD = 0x010D; // Enable double buffer // Initialize flip-flop // Select prescaler (IMCLK/16) // P94 TB0OUT // P94 output enable // Start timer 5. P9FR1 = 0x10; P9CR = 0x10; 6. TB0RUN = 0x8D; TB0CNT buffer0 TB0REG0 TB0REG1 tb0cmp (Note 1) tb1cmp (Note 1) INTTBCOM00 INTTBCOM01 TB0OUT #00 Value #01 Value #00 #10 0 #01 Write the next value #02 #01 Value #10 #10 0 #02 #03 #02 Variable Duty Cycle Variable Duty Cycle Note 1: Internal signal Period Figure 11.4.4 Programmable Pulse Generation (PPG) Mode TMP19A71 11-15 TMP19A71 11.4.4 Pulse Width Measurement The capture function can be used to measure the pulse width of an external clock. The external clock is applied to the TB0IN pin. The up-counter (TB0CNT) is programmed to operate as a free-running counter, clocked by one of the prescaler outputs. The capture function is used to latch the TB0CNT value into the capture registers (TB0CP0, TB0CP1) at the clock rising edge and at the next clock falling edge, respectively. The Interrupt Controller (INTC) should be programmed to generate the INTTBCAP00 interrupt at the falling edge of the TB0IN input. Multiplying the counter clock period by the difference between the values captured into the TB0CP0 and TB0CP1 gives the high pulse width of the TB0IN0 clock. For example, if the prescaler output clock has a period of 0.5 s and the difference between the TB0CP0 and TB0CP1 is 100, the high pulse width is calculated as 0.5 s x 100 = 50 s. Prescaler Output Clock C1 TB0IN0 Input (External Clock) Capture into TB0CP0 Capture into TB0CP1 INTTBCAP00 C2 C3 C4 C1 C2 C3 C4 Figure 11.4.5 Pulse Width Measurement The low pulse width of the external clock can be measured by setting the INTTBCAP01 interrupt to be generated on the rising edge of the TB0IN pin, and multiplying the difference between the TB0CP1 value at C2 and the TB0CP0 value at C3 by the prescaler output clock period. If no edge input occurs on the TB0IN pin, this can be detected by a counter overflow. TMP19A71 11-16 TMP19A71 11.4.5 One-Shot Pulse Generation Using an External Trigger Pulse The TMRBn can be used to produce a one-time pulse as follows. (1) The 16-bit up-counter (TB0CNT) is programmed to function as a free-running counter, clocked by one of the prescaler outputs. The TB0IN pin is used as an active-high external trigger pulse input for latching the counter value into the capture register (TB0CP0). (2) The Interrupt Controller (INTC) must be programmed to generate an INTTBCAP01 interrupt upon detection of a rising edge on the TB0IN pin. The TB0REG0 is loaded with the sum of the TB0CP0 value (c) and the pulse delay (d)i.e., (c) + (d). The TB0REG1 is loaded with the sum of the TB0REG0 value and the pulse width (p)i.e., (c) + (d) + (p). (3) Next, the INVC0 and INVC1 bits in the timer flip-flop control register (TB0FF) are set to 11, so that the timer flip-flop (TB0FF) will toggle when a match is detected between the TB0CNT and the TB0REG0 and between the TB0CNT and the TB0REG1. With the TB0FF toggled twice, a one-shop pulse is produced. Upon a match between the TB0CNT and the TB0REG1, the TMRB0 generates the INTTBCOM01 interrupt, which must disable the toggle trigger for the TB0FF. Figure 11.4.6 depicts one-shot pulse generation, with annotations showing (c), (d) and (p). The counter is free-running. Counter Clock (Internal Clock) TB0IN0 Input Pin (External Trigger Pulse) c c+d c+d+p The TB0CNT value is latched into TB0CP0. INTTBCAP01 is generated. INTTBCOM00 is generated. Toggle is enabled. Toggle is disabled for a capture into TB0CP1. Delay (d) Toggle is enabled. INTTBCOM01 is generated. TB0REG0 Match TB0REG1 Match TB0OUT (Timer Output) Pin Pulse Width (p) Figure 11.4.6 One-Shop Pulse Generation (with a Delay) TMP19A71 11-17 TMP19A71 Example: Generating a one-shot pulse with a width of 2 ms and a delay of 3 ms on assertion of an external trigger pulse on the TB0IN pin Clocking conditions: System clock: Prescaler clock: 56 MHz IMCLK/2 (IMCLK = fsys/2) Settings in the main routine Place the counter in free-running mode. 7 TB0MOD - 6 - 5 1 4 0 3 0 2 0 1 1 0 Select IMCLK/2 as the counter clock source. 0 Latch TB0CNT value into TB0CP0 at rising edges of the TB0IN input. TB0FF - - 0 0 0 0 1 0 Clear TB0FF0 to 0. Disable the toggle trigger for TB0FF0. P9IER P9CR P9FR1 IMR85 IMR25 TB0RUN - - - X X - - - - 1 1 0 - - - 0 0 X 1 1 1 0 0 X - - - X X 1 - - - 1 0 1 - - - 0 0 X - - - 0 Enable INTTBCAP01 and disable INTTBCOM00. 0 1 Start TMRB0. Configure the P94 pin as TB0OUT. Settings in INTTBCAP01 TB0REG0 TB0REG1 TB0FF TB0CP0 + 3ms/(IMCLK/2) TB0REG0 + 2ms/(IMCLK/2) ----111 1 Enable the TB0FF0 toggle trigger for TB0REG0 and TB0REG1 matches. Enable INTTBCOM00. IMR25 X 1 0 0 X 1 0 0 Settings in INTTBCOM01 TB0FF - - - - 0 0 1 1 Disable the TB0FF0 toggle trigger for TB0REG0 and TB0REG1 matches. Disable INTTBCOM00. IMR25 X: Don't care, X 1 0 0 X 0 0 0 -: No change If no delay is necessary, enable the TB0FF toggle trigger for a capture of the TB0CNT value into the TB0CP0. Use the INTTBCAP01 interrupt to load the TB0REG1 with a sum of the TB0CP0 value (c) and the pulse width (p) and to enable the TB0FF toggle trigger for a match between the TB0CNT and TB0REG1 values. A match generates the INTTBCOM1 interrupt, which then is to disable the TB0FF toggle trigger. TMP19A71 11-18 TMP19A71 Counter Clock (Prescaler Output Clock) TB0IN Input (External Trigger Pulse) TB0REG1 Match c c+p The TB0CNT value is latched into TB0CP0. INTTB0CAP01 is generated. INTTBCOM01 is generated. Toggle is enabled. Pulse Width The TB0CNT value is latched into TB0CP1. TB0OUT (Timer Output) Pin Toggle is enabled for a capture into TB0CP0. (p) Toggle is left disabled for a capture into TB0CP1 so that it will not be toggled. Figure 11.4.7 One-Shot Pulse Generation (without a Delay) TMP19A71 11-19 TMP19A71 11.4.6 One-Shot Pulse Generation Using an External Count Start Trigger Using an external count start trigger enables one-shot pulse generation with a shorter delay. (1) The 16-bit up-counter (TB0CNT) is programmed to count up on the rising edge of the TB0IN pin (TB0RUN.TREGSEL=1, TB0RUN.CSSEL=1). The TB0REG0 is loaded with the pulse delay (d), and the TB0REG1 is loaded with the sum of the TB0REG0 value (d) and the pulse width (p)--i.e., (d) + (p). (2) The TB0CNT is programmed to start counting on the rising edge of the external trigger pulse. (3) Next, the INVC0 and INVC1 bits in the timer flip-flop control register (TB0FF) are set to 11, so that the timer flip-flop (TB0FF) will toggle when a match is detected between the TB0CNT and the TB0REG0 and between the TB0CNT and the TB0REG1. With the TB0FF toggled twice, a one-shot pulse is produced. Upon a match between the TB0CNT and the TB0REG1, the TMRB0 generates the INTTBCOM01 interrupt, which must disable the toggle trigger for the TB0FF. Figure 11.4.8 depicts one-shot pulse generation, with annotations showing (d) and (p). Counter Clock (Internal Clock) TB0IN0 Input Pin (External Trigger Pulse) 0 d d+p The counter starts on the risinge edge of external trigger. INTTBCOM00 is generaged. Toggle is enabled. Toggle is disabled for a Toggle is cpature into CAP1. enabled. INTTBCOM01 is generated. TB0RG0 Match TB0RG1 Match TB0OUT (Timer Output) Pin Delay (d) Pulse Width (p) Figure 11.4.8 One-Shot Pulse Generation Using an External Count Start Trigger (with a Delay) TMP19A71 11-20 TMP19A71 12. Serial I/O (SIO) 12.1 Overview The TMP19A71 contains four channels of serial I/O (SIO0 to SIO3). The SIO2 and SIO3 can be used in UART mode (asynchronous) and I/O Interface mode (synchronous). The SIO0 and SIO1 only support UART mode. The SIO0 and SIO1 do not have the SCLK and CTS pins; thus an external clock cannot be used as a UART transfer clock in these channels. * I/O Interface mode Mode 0: Transmits/receives a serial clock (SCLK) as well as data streams for a synchronous clock mode of operation Mode 1: 7 data bits Mode 2: 8 data bits Mode 3: 9 data bits * UART mode In Mode 1 and Mode 2, each frame can include a parity bit. In Mode 3, the wake-up feature is available for multidrop applications in which a master station is connected to several slave stations through a serial link. Figure 12.2.1 shows a block diagram of the SIO2. The main components of an SIO channel are a clock prescaler, a serial clock generator, a receive buffer, a receive controller, a transmit buffer and a transmit controller. Each SIO channel is independently programmable and functionally equivalent. In the following sections, any references to the SIO2 also apply to the other channels unless otherwise noted. Mode 0 (I/O Interface Mode): LSB first bit 0 1 2 3 4 5 6 7 Goes out first Mode 0 (I/O Interface Mode): MSB first bit 7 6 5 4 3 2 1 0 Goes out first Mode 1 (7-Bit UART Mode) Without parity start bit 0 1 2 3 4 5 6 stop With parity start bit 0 1 2 3 4 5 6 parity stop Mode 2 (8-Bit UART Mode) Without parity start bit 0 1 2 3 4 5 6 7 stop With parity start bit 0 1 2 3 4 5 6 7 parity stop Mode 3 (9-Bit UART Mode) start bit 0 1 2 3 4 5 6 7 8 stop start bit 0 1 2 3 4 5 6 7 bit 8 Stop (Wake-up) Bit 8 = 1: Address (select code) Bit 8 = 0: Data Figure 12.1.1 Data Formats TMP19A71 12-1 TMP19A71 12.2 Block Diagram (SIO2 Prescaler IMCLK 2 4 8 16 32 64 128 IMCLK/2 IMCLK/8 IMCLK/32 IMCLK/128 Serial Clock Generator BR2CR BR2CR |