Part Number Hot Search : 
LC866556 HDOB001A 90121 R3003 12AL8 DS1236 4470K ECH810
Product Description
Full Text Search
 

To Download TMP19A71CYFG Datasheet File

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


  Datasheet File OCR Text:
 32 bit 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 Warm-Up Timer CLKOSC fsys (System Clock) /2 /4 /8 /2 CLKPRSC /3 /4 /5
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=0. When a NMI occurs, the ERL and NMI bits of the CP0 Status register are set to 1 and a control jumps to the exception vector address 0xBFC0_0000. The PC value at the time of an NMI is stored in the CP0 ErrorEPC register. However, if a bus error occurs during a store instruction, a NMI exception is generated asynchronously to the instruction execution timing and the PC is stored not at the instruction that caused the NMI but at the instruction that is being executed when the NMI is generated. Upon NMI generation, when Shadow Register Set is enabled, SSCR will be overwritten by the value of SSCR but the register bank will not be switched because the value of SSCR is not updated. The reason why only the SSCR value is updated is because it is necessary to prevent the register bank from being changed when SSCR is overwritten by the value of SSCR due to an ERET instruction executed upon returning from NMI. The cause of NMI generation can be determined by NMIFLG and of CG. A reset initializes the NMI pin (P95) as a general-purposed port. To use the NMI pin, it is necessary to set the P9FR15 bit of the Port 9 Function Register 1 (P9FR1) and the NMISEN field of the CLKNMI register. For a detailed description of NMI handling, refer to the chapter "Exception Handling Nonmaskable Interrupts"of the separate volume, TX19A Core Architecture.
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 will be overwritten by the value of SSCR but the register bank will not be switched because the value of SSCR is not updated. The reason why only the SSCR value is updated is because it is necessary to prevent the register bank from being changed when SSCR is overwritten by the value of SSCR due to an ERET instruction executed upon returning from the exception. The illegal address that caused an Address Error exception (instruction fetch, load, store) or Bus Error exception (instruction fetch, data access) is stored in the CP0 BadVAddr register. For a detailed description of general exception handling, refer to the chapter "Exception Handling"of the separate volume, TX19A Core Architecture.
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 will be overwritten by the value of SSCR but the register bank will not be switched because the value of SSCR is not updated. The reason why only the SSCR value is updated is because it is necessary to prevent the register bank from being changed when SSCR is overwritten by the value of SSCR due to an ERET instruction executed upon returning from the software interrupt. Software interrupts are processed in a process flow shown in Figure 7.7.1.
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 =0), CP0register SSCR is updated, thus a register bank of the same number as an interrupt level becomes effective. 4. The CMASK and PMASKx fields of the ILEV register of the INTC are updated to set the interrupt mask level to the priority level of the accepted interrupt. 5. Bits 0 to 8 of the IVR register of the INTC are set to the value corresponding to the accepted interrupt as shown in Table 7.8.1.
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=0).
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 ="0" P6IER ="0" P6FR ="1" CLKINT3 ="010" CLKINT3 ="1" CLKACT ="0x5A5A""0xF0F0" IMR08 ="10" ICLR ="0x020" IMR08 ="101" ILEV/ ="1"/"xxx" SYNC instruction Status ="1" ; Disable interrupts ; Enable port input ; Configure port as INT3 ; Set INT3 as falling edge sensitive ; Set INT3 as STOP wakeup signal ; Enable CG register settings ; Set INT3 as falling edge sensitive ; Clear INT3 interrupt request ; Set INT3 interrupt level to 5 ; Set mask level to "xxx" (set simultaneously with ILEV ; Stall until interrupt settings take effect ; Enable interrupts
Setting example: Using the external pin interrupt INT3 for making it disable Status ="0" IMR08 ="000" ICLR ="0x020" ; Disable interrupts ; Disable INT3 interrupt ; Clear INT3 interrupt request
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 ="0" P6IER ="0" P6FR ="1" IMR74 ="01" ICLR ="0x020" IMR74 ="010" ILEV/ ="1"/"xxx" SYNC instruction Status ="1" ; Disable interrupts ; Enable port input ; Configure port as INT4 ; Set INT4 as high level sinsitive ; Clear INT4 interrupt request ; Set INT4 interrupt level to 2 ; Set mask level to "xxx" (set simultaneously with ILEV) ; Stall until interrupt settings take effect ; Enable interrupts
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 of INTC (see 7.8.10 Register ). EMG
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 of INTC (see 7.8.10 Register ).
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 of INTC (see 7.8.10 Register ).
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 of INTCb (IMRxx ="000"), set Staus of CP0 register by following the example shown below, and then disable an interrupt source after disabling the interrupt.
Programming example for disabling interrupt sources individually mtc0 sb sync mtc0 r29, IER r0, IER r0, IMRxx ; Disable interrupts (Clear Status to 0) ; Disable interrupt sources ; Stall until writing becomes effective ; Enable interrupts (Set Status to 1)
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, respectively, to notify the TX19A processor core of the interrupt level. When the interrupt level is notified, the TX19A processor core sets 1 to Status of the CP0 register to disable interrupts and saves the PC value at the interrupt generation to EPC. If Shadow Register Set is enabled (CP0 register SSCR = 0), the processor core sets the interrupt level to SSCR of the CP0 register and switches the register bank. When an interrupt is accepted, any ongoing execution is suspended and it automatically jumps to the exception vector address (for interrupts). Figure 7.8.2 shows the sequence of accepting interrupts.
1. Interrupt Accepted by Hardware
TMP19A71 7-19
TMP19A71
Interrupt Detection
Compared to ILEV, Interrupt level is Higher The highest priority interrupt request ? YES Are both Status and "0" YES Status? 1 YES Branch Delay Within slot
Low
NO
NO
0
NO Interrupt suspended
Set 1 to Cause Set a jump or branch instruction of PC to EPC
Set 0 to Cause Set PC to EPC
Set 0x00 to Cause Set 1 to Status Set an interrupt level to SSCR
If Cause=0, then set 0xBFC0_0380 to PC If Cause=1, then set 0xBFC0_0400 to PC
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 = 0), the general-purposed register values other than r26, r27, r28, and r29 (Shadow Register Set number 1 to 7) are automatically saved, thus user program doesn't need to save them. Refer to the separate volume, TX19A Core Architecture for details of general-purposed registers that are to be saved. Generally, registers other than general-purposed registers are dependent on user programs. The Status, EPC, SSCR, HI, LO, Cause, and Config values of the CP0 register shall be saved as appropriate. Clearing Statusto 0 after the saving process, nesting interrupts can be used by enabling interrupts.
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 ="0" ; Saving SSCR values (as appropriate) ; Saving EPC values (as appropriate) ; Saving Status values (as appropriate) ; Stall before the execution of ERET instruction ; Stall before the execution of ERET instruction ; Interrupt enabled (only when nesting interrupts)
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 to clear the interrupt mask level. By executing the ERET instruction after all the restorings are completed, Status of the CP0 register is cleared to 0 and the EPC address is restored in PC for resuming the main process. When Shadow Register Set is sensitive (CP0 register SSCR = 0), SSCR is updated by the ERET instruction, and the previous number of Shadow Register Set is restored automatically, thus the general-purposed registers saved in the register bank is also automatically restored. If nesting interrupts are used, it is necessary to set 1 to Status of the CP0 register before restoring to disable interrupts.
Setting example of restoring from interrupt handler Status ="1" ILEV ="0" SYNC instruction SSCR saved SSCR NOP instruction NOP instruction EPC saved EPC Status saved Status NOP instruction NOP instruction ERET instruction NOP instruction ; Interrupt disabled (only when nesting interrupts) ; Restore the mask level by one ; Stall until the mask level is restored ; Restore SSCR values (as appropriate) ; Stall until SSCR is switched ; Stall until SSCR is switched ; Restore EPC values (as appropriate) ; Restore Status values (as appropriate) ; Stall before executing ERET instruction ; Stall before executing ERET instruction ; Status ="0", PC EPC, SSCR SSCR ; Stall after ERET instruction (only for TMP19A70)
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 of INTC is automatically updated to the interrupt level of the interrupt accepted, so that it can be arbitrated according to the priority preset by the user program. 1. Additional processes required for nesting interrupts When an interrupt is accepted, 1 is set to the Status of the CP0 register, and interrupt becomes disabled. In order to allow nesting interrupts, it is necessary to save the registers that could be overwritten by the second and the following interrupts before enabling the nesting interrupt process. For this purpose, in addition to the typical exception handler and interrupt handler processes, save the following registers before setting 0 to Status of the CP0 register and then enable interrupts. CP0 registers that must be saved: EPC SSCR
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 of the CP0 register to 0. Therefore, by setting 1 to Status of the CP0 register to disable interrupts in the restoration, it is possible to restore automatically from the interrupt which is in interrupts enabled state. 3. Proper use of Status and Status While there is no significant distinction between the Status and Status parameters, Status is automatically set to 1 upon interrupt generation and cleared to 0 by the ERET instruction automatically. In saving and restoring register values at the top and end, where interrupts have to be disabled, Status controlled by hardware is normally used. Status is used for other general interrupt enabled/disabled control functions. A control flow of interrupt enabled/disabled is described in Section 7.8.9.1 Interrupt Control for Nesting Interrupt.
TMP19A71 7-23
TMP19A71
7.8.9.1
Interrupt Control for Nesting Interrupt
Save Process
Nesting Interrupt Enabled
Restore Process
Status Status
Interrupt Enabled Interrupt Enabled Interrupt Enabled
Status =1
Interrupt Generation
Status =0
Status =1
ERET Instruction
Status =1
Figure 7.8.3 1. Status=1
Interrupt Enabled/Disabled of Nesting Interrupt Control
Enabling interrupts becomes possible by setting 1 to Status of CP0 register in the condition that Status of CP0 register is 0. This process shall be optionally set by software as appropriate. 2. Interrupt Generation As interrupts be generated, 1 is automatically set to Status of CP0 register, and the interrupt becomes disabled. This is processed automatically by hardware. 3. Status=0 To enable nesting interrupts, it is necessary to enable interrupts by setting 0 to Status of the CP0 register after saving relevant registers. If interrupts are made enabled before saving registers, a higher priority level interrupt may corrupt the register data. This process shall be optionally set by software as appropriate. 4. Nesting Interrupt Enabled It is an enabled interval of nesting interrupts. The interrupts of higher level than the current interrupt level (ILEV) are accepted. To disable interrupts in this interval, set 0 to Status of CP0 register. 5. Status=1 If nesting interrupts are made enabled, it is necessary to to disable interrupts by setting 1 to Status of the CP0 register before restoring relevant register values. If registers are saved before disabling interrupts, a higher priority level interrupt may corrupt the register data. This process shall be optionally set by software as appropriate. 6. ERET Instruction It is the instrucition to restore the state before an interrupt generation. If this instruction is executed while Status of the CP0 register is set to 1, 0 is automatically set to the Status, and interrupt becomes enabled (provided that 1 is set to Status of the CP0 register). 7. Status=0 Disabling interrupts is possible by setting 0 to Status of CP0 register. This process shall be optionally set by software as appropriate.
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 are suspended. The top of the priority is 7 and the lowest is 1. Note that any interrupt of the interrupt level 0 is not suspended. When an interrupt is generated, its interrupt level is stored in , and any previously stored values are incremented in mask levels such that the previous CMASK is saved in PMASK0, PMASK0 in PMASK1, and so on. To write newly a value of , write as set 1 to . No value of can be rewritten. When 0 is set to , the interrupt mask level in the register shifts back to the previous state such that PMASK0 is moved to CMASK, PMASK1 to PMASK0, and so on. To , 000 is set. To restore from an interrupt, set 0 to before executing the ERET instruction. always can read 0.
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
=0
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:
: determines the interrupt level by sources : set to starting souces of DMA transfer : determines Sensitivity of interrupt request The interrupt numbers to which Reserved is set in Table 7.8.1 Hardware Interrupt Sources are reserved area for expansion. 0, the same as the initial value shall be set to IMRxx of relevant interrupt numbers. This register can access in the quantity of 16-/8-/1-bit by deviding IMR00 (32 bits) by 8 bits into IMR00/IMR01/IMR02/IMR03.
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 of INTC, which may be level "H"/"L" or rising/faling edge, interrupt request shall be cleared to retain its interrupt source. Note 3: This register is not accessible with any bit manipulation instruction. Note 4: No external transfer request caused by interrupt sources of DMAC is cleared. An external transfer request once accepted is not cancelled until DMA transfer is executed. Therefore, to clear unnecessary external transfer request, DMA transfer execution, disabling interrupt in IMRxx before accepting, or cancelling a starting source of DMAC in IMRxx is required. 0 0 0 15 14 13 12 R 0 0 0 0 6 5 4 IV W 11 10 9 8 IV W Set the values in IVR[8:0] of sources to the interrupts whose request is desired to clear. 3 2 1 0
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 of CP0 register. Exceptions cannot be disabled. Note that some of them have two types of instructions whose differences are only Generated Exception or Non-generated. Use them as usage. Software Sets of software interrupt and hardware interrupt sources are different interrupt source. Place two NOP instructions immediately after rewriting SSCR of CP0 register because it takes two clocks to change a register bank. When the interrupt requests of the same level are accepted simultaneously by changing ILEV, it is necessary to save in user program since register banks do not switch. IER of CP0 register is only accessible from 32-bit ISA. Stack pointers (r29) needs to be set twice since they are distinguished as Shadow Register Set number 0 and Shadow Register Set number from 1 to7. Using Shadow Register Set number 1 by setting 1 to SSCR in main processing is the way to use a common stack pointer. In this meshod, it is necessary to save in user program because no register bank is switched even if an interrupt of level 1 is accepted. If an ERET instruction is executed while interrupts are disabled by setting 1 to Status of the CP0 register, it restores ErrorEPC of CP0 register in main processing as a restoring address. Since TX19A processor core saves the interrupt restoring address in EPC, it is necessary to be careful with disabling interrupts in Status. Do not execuse ERET instruction within two clocks after accessing Status, ErrorEPC, EPC, or SSCR of CP0 register. When disabling an interrupt by setting Status of CP0 register, the interrupt becomes disabled at the instruction execution point (Stage E) while the value set to the register becomes effective two clocks later. When enabling an interrupt by setting Status of CP0 register, it becomes enabled two clocks after the instruction execution point (Stage E), and the value set to the register also becomes effective two clocks after the instruction execution point (Stage E). TMP19A71 has two types of register number: r9 (SEL6) which is accessible with 32-bit ISA only and r22 (SEL0) which is asscessible with 32-bit/16-bit ISA. In both cases, it turns out to be the same result. To use the register number r9 (SEL6) with Toshiba's C compiler, specify -tx19_sscr9 as a compiling option. For details, refer to the additional documents of Toshiba C compiler, TX19A C Compilier Reference.
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 of INTC and setting value may be different. ILEV of INTC must be accessed in 32-bit quantity. ICLR of INTC must be accessed in 16-bit quantity. When an interrupt request is cleared in ICLR before reading IVR value of INTC, IVR value is cleared and interrupt sources cannot be distinguished. To enable an interrupt, it must be set in the detection order (from outside to inside) and to disable it, in reverse of the detection order (from inside to outside). If not, unexpected interrupt may be generated or unexpected transfer of EMG state may occur. To prevent such cases, interrupt sources or EMG state must be cleared before enabling interrupts. To rewrite ILEV values of INTC, set 1 to simultaneously.
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=10 P9CR=0 P9IER=0 P9PUCR=0 P9ECLR=0x550xAA P9ECR=1 P9ECLR=0x55 0xAA P9FR2=1 IMR33=10 ICLR=0x084 IMR33= 111 ; release lock ; falling edge sensitive ; disable output ; enable input ; disable pull-up ; release lock ; clear EMG condition ; release lock ; set P93 as EMG pin ; clear INTTBE0 ; set INTTBE0 interrupt level to 7 (or any level)
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=1 ; release lock ; clear EMG condition
Procedure for returning P93 to a general-purpose port IMR33= 000 ICLR=0x084 P9ECLR=0x55 0xAA P9FR23=0 ; disable INTTBE0 interrupt ; clear INTTBE0 ; release lock ; set P93 as a general-purpose port
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 PAIER6 EMG0 EMG detection circuit MDOUT0 EMGCR0 EMG detection circuit PWM inactive PMDTRG disabled INTEMG0 PMD0
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=10 PACR=0 PAIER=0 PAPUCR=0 PAECLR=0x550xAA PAECR=1 PAECLR=0x550xAA PAFR=1 IMR22=10 ICLR=0x058 IMR22=111 ; release lock ; falling edge sensitive ; disable output ; enable input ; disable pull-up ; release lock ; clear EMG condition (must be set separately from setting edge sensitivity) ; release lock ; set PA6 as EMG0 ; clear INTEMG0 ; set INTEMG0 interrupt level to 7 (or any level) X X X X 0 EMG pin 0
(Note ) (Note) (Note)
0
X 0
(Note)
1
General procedure for clearing the EMG condition (edge sensitive) PAECLR=0x550xAA PAECR=1 MDOUT0=000000 EMGCR0=1 MDOUT0=xxxxxx Note 1: Note 2: ; release lock ; clear EMG condition in Port A ; make PWM output inactive (through PMD register) ; clear EMG condition in PMD (through PMD register) ; set PWM output as desired (through PMD register)
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=000000 EMGCR0=1 MDOUT0=xxxxxx Note 1: Note 2: ; make PWM output inactive (through PMD register) ; clear EMG condition in PMD (through PMD register) ; set PWM output as desired (through PMD register)
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= 000 ICLR=0x058 PAECLR=0x550xAA PAFR=0 ; disable INTEMG0 interrupt ; clear INTEMG0 ; release lock ; set PA6 as a general-purpose port
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 P9IER3 EMG input P9FR23 EMG detection circuit
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, and the security code "0x0000_00C5" must be written in the DSU security control register, SEQCNT. Then the debug using DSU-PROBE becomes active. The security function becomes active again by setting 1 to SEQMOD without turning off the power and writing "0x0000_00C5" in SEQCNT. 4. Initialization of SEQMOD Flash products are not initialized by the normal reset. They are initialized only by supplying power (Power-On Reset). Mask products are not initialized by the reset with WDT. They are initialized by an external reset.
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 Capture Register 0 TB0CP0 Capture Register 1 TB0CP1 IMBUS
IMCLK
2
4
1/2 1/4 1/8 1/16 1/32 1/64
TB0IN
TB0MOD , Capture Control TB0MOD IMCLK to IMCLK/64 Selector Count Clock
TB0F F Timer Flip-Flop Control
Timer Flip-Flop Output TB0OUT
TB0RUN TB0MOD 16-Bit Up-Counter TB0CNT
TMRB0 Interrupt INTTBCOM00/01 INTTBCAP00/01
TB0MOD Match Detect Match Detect 16-Bit Comparator TB0CP1 (TB0CMP1) 16-Bit Timer Register TB0REG1
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  BR2CR  TB2OUT (from TMRB2) UART Mode Selector Selector Selector Divider
IMCLK/2 IMCLK/8 IMCLK/32 IMCLK/128 BR2CR Baud Rate Generator IMCLK SCLK2 Input (Shared with P87) /2
SC2MOD0 Selector SC2CR
SC2MOD0 SIOCLK
I/O Interface Mode
SCLK2 Output (Shared with P87) SC2MOD0 Receive Counter (/16 for UART) RXDCLK SC2MOD0 Receive Control SC2CR Parity Control Receive Buffer 1 (Shift Register) SC2CR Receive Buffer 2 (SC2BUF)
Interrupt Request INTRX2 Interrupt Request INTTX2 Transmit Counter (/16 for UART) TXDCLK Transmit Control SC2MOD0 CTS2 (Shared with P87)
Serial Channel Interrupt Control
RX2 (Shared with P85)
Transmit Buffer 1 (Shift Register) SC2CR Transmit Buffer 2 (SC2BUF)
TX2 (Shared with P86)
Error Flag SC2CR
IM-BUS
Receive FIFO
To Serial Channel Interrupt Control
Interrupt Request INTRX2 Interrupt Request INTTX2
Transmit FIFO
SC2FRC
Receive Control
Transmit Control
SC2FRC
SC2FR C
FIFO Interrupt Control
SC2FTC
SC2FTC
SC2FTC
Figure 12.2.1
SIO2 Block Diagram
TMP19A71
12-2
TMP19A71
12.3 SIO Components (SIO2)
12.3.1 Prescaler
The SIO2 has a 7-bit prescaler that slows the rate of a clocking source to the serial clock generator. The prescaler clock source (IMCLK) can be programmed in the PRS2 bit of the CLKPRSC located within the clock generator. The prescaler can output four types of clocks to the baud rate generator: IMCLK/2, IMCLK/8IMCLK/32 and IMCLK/128. The serial clock is selectable from several clocks; the prescaler is only enabled when the baud rate generator output clock is selected as a serial clock. Table 12.3.1 shows prescaler output clock resolutions. Table 12.3.1 Prescaler Output Clock Resolutions
fc = 12 MHz (PLL output clock) Clock Gear Value CLKPRSC.PRS1 IMCLK Selection CLKPSC.PRS2 000 (fsys/2) 00 (fc/2) 010 (fsys/3) 100 (fsys/4) 110 (fsys/5) 000 (fsys/2) 01 (fc/4) 010 (fsys/3) 100 (fsys/4) 110 (fsys/5) 000 (fsys/2) 10 (fc/8) 010 (fsys/3) 100 (fsys/4) 110 (fsys/5) IMCLK/2 fc/8 (71.4 ns) fc/12 (107 ns) fc/16 (143 ns) fc/20 (178 ns) fc/16 (143 ns) fc/24 (187 ns) fc/32 (286 ns) fc/40 (357 ns) fc/32 (0.29 s) fc/48 (0.43 s) fc/64 (0.57 s) fc/80 (0.71 s) Prescaler Output Clock Resolution IMCLK/8 fc/32 (0.29 s) fc/48 (0.43 s) fc/64 (0.57 s) fc/80 (0.71 s) fc/64 (0.57 s) fc/96 (0.86 s) fc/128 (1.1 s) fc/160 (1.43 s) fc/128 (1.1 s) fc/192 (1.7 s) fc/256 (2.3 s) fc/320 (2.9 s) IMCLK/32 fc/128 (1.1 s) fc/192 (1.7 s) fc/256 (2.3 s) fc/320 (2.9 s) fc/256 (2.3 s) fc/384 (3.4 s) fc/512 (4.6 s) fc/640 (5.7 s) fc/512 (4.6 s) fc/768 (6.9 s) fc/1024 (9.1 s) fc/1280 (11.4 s) IMCLK/128 fc/512 (4.6 s) fc/768 (6.9 s) fc/1024 (9.1 s) fc/1280 (11.4 s) fc/1024 (9.1 s) fc/1524 (13.7 s) fc/2048 (18.3 s) fc/2560 (22.9 s) fc/2048 (18.3 s) fc/3048 (17.4 s) fc/4096 (36.6 s) fc/5120 (45.8 s)
Note: Do not change the clock gear value while the SIO is operating.
TMP19A71
12-3
TMP19A71 12.3.2 Baud Rate Generator
The frequency used to transmit and receive data through the SIO2 is derived from the baud rate generator. The clock source for the baud rate generator can be selected from the 7-bit prescaler outputs (IMCLK/2, IMCLK/8, IMCLK/32, IMCLK/128) through the programming of the PRE bit in the BR2CR. The baud rate generator contains a clock divider that can divide the selected clock by N (N = 1 to 16) or N+(16-K)/16 ( N = 2 to 15, K = 1 to 15). The clock divisor is programmed into the DVS and BR2S bits in the BR2CR and the BR2K bit in the BR2ADD. * I/O Interface mode I/O Interface mode cannot utilize the N + (16 - K)/16 clock division function. The DVS bit in the BR2CR must be cleared to 0. * UART mode 1) When BR2CR.DVS=0 When the BR2CR.DVS bit is cleared, the BR2ADD.BR2K field has no meaning or effect. In this case, the baud rate generator input clock is divided down by a value of N (1 to 16) programmed in the BR2CR.BR2S field. 2) When BR2CR.DVS=1 Setting the BR2CR.DVS bit to 1 enables the N + (16 - K)/16 division function. The baud rate generator input clock is divided down according to the value of N (2 to 15) programmed in the BR2CR.BR2S field and the value of K (1 to 15) programmed in the BR2ADD.BR2K field.
Note: Setting N to 1 or 16 disables the N + (16K)/16 clock division function. When N = 1 or 16, the BR2CR.DVS bit must be cleared to 0.
* Baud rate calculations 1) I/O Interface mode Baud rate generator input clock Baud rate = Baud rate generator divisor
/2
When the clock input to the baud rate benerator is IMCLK/2 (14 MHz) and the baud rate generator divisor is set to 2, the maximum baud rate is 3.5 Mbps.
TMP19A71
12-4
TMP19A71
2) UART mode Baud rate =
Baud rate generator input clock Baud rate generator divisor
/ 16
When the clock input to the baud rate generator is IMCLK/2 (14 MHz), the maximum baud rate is 875 Kbps. The baud rate generator can be bypassed if the user wants to use the IMCLK clock as a serial clock. In this case, the maximum baud rate is 1.75 Mbps (at IMCLK = 28 MHz). * Calculation examples 1) Integral division (divide-by-N) IMCLK = 28 MHz Baud rate generator input clock: IMCLK/8 Clock divisor N (BR2CR.BR2S) = 4 BR2CR.DVS = 0 Clocking conditions System clock : 56 MHz IMCLK : 28 MHz (divide-by-2)
Baud rate =
IMCLK/8 / 16 4
= 28 x 106 / 8 / 4 / 16 = 54.7Kbps)
Note:
Clearing the BR2CR.DVS bit to 0 disables the N + (16 - K)/16 clock division function. At this time, the BR2ADD.BR2K field is ignored.
2) N + (16 - K)/16 clock division (UART mode only) IMCLK = 28 MHz Baud rate generator input clock: IMCLK/32 N (BR2CR.BR2S) = 5 K (BR2ADD.BR2K) = 5 BR2CR.DVS = 1 Clocking conditions System clock : 56 MHz IMCLK Baud rate = IMCLK/32 (16-5) 5+ 16 : 28 MHz (divide-by-2)
/ 16
= 28 x 106 / 32 / (5 + 11 ) / 16 = 9615 (bps) 16
TMP19A71
12-5
TMP19A71
The SIO2 can use an external clock as a serial clock, bypassing the baud rate generator. When an external clock is used, the baud rate is determined as shown below. * Using an external clock as a serial clock 1) I/O Interface mode Baud rate = external clock input When double-buffering is used, the external clock period must be greater than 12/fsys. Therefore, when fsys = 56 MHz, the maximum baud rate is 4.7 Mbps (56 / 12). When double-buffering is not used, the exernal clock period must be greater than 16/fsys. Therefore, when fsys = 56 MHz, the maximum baud rate is 3.5 Mbps (56 / 16). 2) UART mode Baud rate = external clock input / 16 The external clock input must be greater than or equal to 4/fsys. Therefore, when fsys = 56 MHz, the maximum baud rate is 875 Kbps (56 / 4 / 16). Table 12.3.2 and Table 12.3.3 show baud rate setting examples in UART mode.
TMP19A71
12-6
TMP19A71
Table 12.3.2 UART Baud Rate Selection
Logic Baud Rate (bps) 1200 2400 4800 9600 14400 19200 28800 31250 38400 57600 115200 230400 Generated Baud Rate (bps) 1202 2404 4808 9615 14403 19231 28689 31250 38462 57613 115702 229508 Prescaler IMCLK/128 IMCLK/128 IMCLK/32 IMCLK/32 IMCLK/8 IMCLK/8 IMCLK/8 IMCLK/8 IMCLK/8 IMCLK/2 IMCLK/2 IMCLK/2 Divisor N 11 5 11 5 15 11 7 7 5 15 7 3 Correction Value 10 5 10 5 13 10 6 None 5 13 7 3 Error (%) 0.16 0.16 0.16 0.16 0.02 0.16 0.39 0 0.16 0.02 0.44 0.39
Note 1: This table assumes: fsys = 56 MHz, IMCLK = fsys/2 (28 MHz). Note 2: When a baud rate slower than 600 bps is used, the input clock must be TMRB2.
Table 12.3.3 UART Baud Rate Selection TB2REG1 values when the TMRB2 timer trigger output (Internal TB2OUT) is used (TMRB2 input clock = IMCLK/4)
IMCLK Baud rate (bps) 100 150 200 300 400 500 600 28 MHz 4375 2916 2188 1458 1094 875 729 20 MHz 3125 2084 1563 1042 781 625 521 14 MHz 2188 1458 1094 729 547 438 365 10 MHz 1563 1042 781 521 391 313 260 7 MHz 1094 730 547 365 273 219 182
When the timer TMRB2 is used to generate a serial clock, the baud rate is determined by the following equation: Baud rate = IMCLK TB2REG1 x 4 x 16 (When the TMRB2 clock source is IMCLK/4)
Note: In I/O Interface mode, the SIO2 and SIO3 cannot utilize the trigger output signal (internal) from the timer TMRB2 as a serial clock.
TMP19A71
12-7
TMP19A71 12.3.3 Serial Clock Generator
This block generates a basic clock that controls the transmit and receive operations. * I/O Interface mode If the SCLK2 pin is configured as an output by clearing the SC2CR.IOC bit to 0, the output clock from the baud rate generator is divided by two to generate the basic clock. If the SCLK2 pin is configured as an input by setting the SC2CR.IOC bit to 1, the external SCLK2 clock is used as the basic clock; the SC2CR.SCLKS bit determines the active clock edge. * UART mode The basic clock (SIOCLK) is selected from a clock produced by the baud rate generator, the system clock (IMCLK/2), the internal output signal from the timer TMRB2, and the external SCLK2 clock, according to the setting of the SC2MOD0.SC field.
12.3.4
Receive Counter
The receive counter is a 4-bit binary up-counter used in UART mode. This counter is clocked by SIOCLK. The receiver utilizes 16 clocks for each received bit, and oversamples each bit three times around their center (with 7th to 9th clocks). The value of a bit is determined by voting logic which takes the value of the majority of three samples.
12.3.5
Receive Controller
* I/O Interface mode If the SCLK2 pin is configured as an output by clearing the SC2CR.IOC bit to 0, the receive controller samples the RX2 input at the rising edge of the shift clock driven out from the SCLK2 pin. If the SCLK2 pin is configured as an input by setting the SC2CR.IOC bit to 1, the receive controller samples the RX2 input at either the rising or falling edge of the SCLK2 clock, as programmed in the SC2CR.SCLKS bit. * UART mode The receive controller uses 16 clocks for receiving the start bit. It samples the 7th to 9th clocks to determine by voting logic whether or not the correct start bit is received. Receive operation is started upon reception of the correct start bit.
12.3.6
Receive Buffer
The receive buffer is double-buffered to prevent overrun errors. Received data is serially shifted bit by bit into Receive Buffer 1. When a whole frame is loaded into Receive Buffer 1, it is transferred to Receive Buffer 2 (SC2BUF), and the INTRX2 is generated. At this time, the Receive Buffer Full flag (SC2MOD2.RBFLL) is set to 1, indicatig that Receive Buffer 2 contains valid data. The TX19A core processor reads a frame from Receive Buffer 2 (SC2BUF), causing the Receive Buffer Full flag (SC2MOD2.RBFLL) to be cleared to 0. Receive Buffer 1
TMP19A71
12-8
TMP19A71
can accept a new frame before the TX19A core processor picks up the previous frame in Receive Buffer 2 (SC2BUF). If the SCLK2 pin is configured as an output in I/O Interface mode, Receive Buffer 2 (SC2BUF) can be enabled or disabled by programming the WBUF bit in the SC2MOD2. Disabling Receive Buffer 2 (double-buffering) enables handshaking during data transfer; the SIO2 stops outputting the SCLK2 clock every time a single frame has been transmitted. In this case, the TX19A core processor reads a frame from Receive Buffer 1, causing the output of the SCLK2 clock to be restarted. If Receive Buffer 2 (double-buffering) is enabled, a received frame is transferred from Receive Buffer 1 to Receive Buffer 2. Once a next frame is received resulting in both Receive Buffers 1 and 2 containing valid data, the SIO2 stops outputting the SCLK2 clock. When the TX19A core processor reads a frame from Receive Buffer 2, the frame stored in Receive Buffer 1 is transferred to Receive Buffer 2, causing a receive-done interrupt (INTRX2) to occur and the SIO2 to restart outputting the SCLK2 clock. Consequently, no overrun error occurs if the SCLK2 pin is configured as an output in I/O Interface mode, regardless of the setting of the SC2MOD2.WBUF bit.
Note: In SCLK output mode, the OEER flag in the SC2CR has no meaning; it is read as undefined. When exiting SCLK output mode, first read the SC2CR to initialize this flag.
In other operating modes, Receive Buffer 2 is always enabled to improve performance during continuous transfer. However, the TX19A core processor must read Receive Buffer 2 (SC2BUF) before Receive Buffer 1 is filled with a new frame. Otherwise, an overrun error occurs, causing the frame previously stored in Receive Buffer 1 to be lost. Even in that case, the contents of Receive Buffer 2 and the SC2CR.RB8 bit are preserved. The SC2CR.RB8 bit holds the parity bit in 8-Bit UART mode and the most significant bit in 9-Bit UART mode. In 9-Bit UART mode, the receiver wake-up feature can be enabled for slave controllers by setting the SC2MOD0.WU bit to 1. The receiver generates the INTRX2 interrupt only when the SC2CR.RB8 bit is set to 1.
TMP19A71
12-9
TMP19A71
12.3.7
Transmit Counter
The transmit counter is a 4-bit binary up-counter used in UART mode. Like the receive counter, the transmit counter is also clocked by SIOCLK. The transmitter generates a transmit clock (TXDCLK) pulse every 16 SIOCLK pulses.
SIOCLK 15 TXDCLK 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2
Figure 12.3.1 Transmit Clock Generation
12.3.8
Transmit Controller
* I/O Interface mode If the SCLK2 pin is configured as an output by clearing the SC2CR.IOC bit to 0, the transmit controller shifts out each bit in the transmit buffer to the TX2 pin at the falling edge of the shift clock driven out on the SCLK2 pin. If the SCLK2 pin is configured as an input by setting the SC2CR.IOC bit to 1, the transmit controller shifts out each bit in the transmit buffer to the TX2 pin at either the rising or falling edge of the SCLK2 input, as programmed in the SC2CR.SCLKS bit. * UART mode Once the TX19A core processor loads a frame into the transmit buffer, the transmit controller begins transmission at the next falling edge of TXDCLK, producing a transmit shift clock.
TMP19A71
12-10
TMP19A71
Handshaking (SIO2 and SIO3 only) The SIO2 has a clear-to-send (CTS2) pin. If the CTS operation is enabled, a frame can be transmitted only when the CTS2 input is low. This feature can be used for flow control to prevent overrun errors in the receiver. The SC2MOD0.CTSE bit enables and disables the CTS operation. If the CTS2 pin goes high in the middle of a transmission, the transmit controller stops transmission upon completion of the current frame until CTS2 goes low again. If so enabled, the transmit controller generates the INTTX2 interrupt to notify the TX19A core processor that the transmit buffer is empty. After the next frame is loaded into the transmit buffer, the transmit controller remains in an idle state until it detects CTS2 going low. Although the SIO2 does not have the RTS pin, any general-purpose port pins can serve as the RTS pin. The receiving device uses the RTS output to control the CTS2 input of the transmitting device. Once the receiving device has received a frame, RTS should be set to high in the receive-done interrupt handler to temporarily stop the transmitting device from sending the next frame. This way, the user can easily implement a two-way handshake protocol.
TMP19A71 TMP19A71
TX2 CTS2 Transmitting Device
RX2 RTS2 (Any port) Receiving Device
Figure 12.3.2 Handshaking Signals
Write to Transmit Buffer No transmission during this (2) period 14 13
CTS2 (1) SIOCLK TXDCLK
15
16
1
2
3
14
15
16
1
2
3
TX2
start bit
bit 0
Note 1:
If the CTS2 signal goes high in the middle of a transmission, the transmitter sotps transmission after the current frame has been sent.
Note 2:
The transmitter starts transmission at the first falling edge of the TXDCLK clock after the CTS2 signal goes low.
Figure 12.3.3 Clear-To-Send (CTS) Signal Timing
TMP19A71
12-11
TMP19A71
12.3.9
Generating a Waveform with a 50% Duty Cycle
When the UART bit in the SC2MOD1 is set to 1, the UART output and the internal transmit signal are ORed, as shown in Figure 12.3.4. When the baud rate generator divisor is set to a value of N in UART mode, a waveform with a 50% duty cycle is generated. The duty ratio varies when the N+ (16-K)/16 clock division function is used.
UART Output Internal Signal Output with a 50% Duty Cycle
Figure 12.3.4 Waveform Generation with a 50% Duty Cycle (Divide-by-N)
12.3.10
Accuracy of Waveform Generation with a 50% Duty Cycle
(A) When the baud rate generator divisor is set to a value of N A waveform with a 50% duty cycle is generated. (B) When the N + (16 - K)/16 clock division function is used The duty ratio is calculated as the ratio of low width to high width as shown below. K = 0 to 8 : (K x N) +8 - K) x (N + 1): 8 x (N + 1) K = 8 to 16 : 8 x N: (K - 8) x N + (16 - K) x (N + 1) The largest deviation occurs when K = 8 and N = 1. In this case, the ratio of low width to high width is 8:16 (33%:67%).
Example: Generating 9600 bps by using the N + (16 - K)/16 clock division function System clock : fsys = 56 MHz (IMCLK = 28 MHz) Input clock Baud rate Duty ratio : IMCLK/32 = 875 KHz : 9615 bps (N = 5, K = 5) : Low:High = 43:48 = 47.25%:52.75%
TMP19A71
12-12
TMP19A71
12.3.11 Transmit Buffer
The transmit buffer is double-buffered. Double-buffering can be enabled or disabled by programming the WBUF bit in the SC2MOD2. If double-buffering is enabled, a frame is first written to Transmit Buffer 2 (SC2BUF) and then transferred to Transmit Buffer 1 (shift register), causing the INTTX2 interrupt to occur and the Transmit Buffer Empty flag (SC2MOD2.TBEMP) to be set. This flag indicates that Transmit Buffer 2 is empty and a next transmit frame can be written. Writing a next frame to Transmit Buffer 2 clears the TBEMP flag. When the SCLK2 pin is configured as an input in I/O Interface mode, an underrun error occurs upon completion of transmitting a frame from Transmit Buffer 1 if a next frame is not written to Transmit Buffer 2 before the clock pulse for the next frame is input. An underrun error is indicated by the parity/underrun flag (PERR) in the SC2CR. When the SCLK2 pin is configured as an output in I/O Interface mode, the SIO2 stops outputting the SCLK2 clock after transmitting a frame which has been transferred from Transmit Buffer 2 to Transmit Buffer 1. In this mode, therefore, no underrun error occurs.
Note: When the SCLK2 pin is configured as an output in I/O Interface mode, the PERR flag in the SC2CR has no meaning; it is read as undefined. When exiting SCLK output mode, first read the SC2CR to initialize this flag.
If double-buffering is disabled, the TX19A core processor writes a transmit frame to Transmit Buffer 1. The INTTX2 interrupt is generated upon completion of transmission. If handshaking is required, Transmit Buffer 2 must be disabled by clearing the WBUF bit in the SC2MOD2. For continuous transmission without handshaking, Transmit Buffer 2 can be enabled by setting the WBUF bit to improve performance. When double-buffering is not used, do not write to Transmit Buffer 1 while a frame is being transmitted.
12.3.12 Parity Controller
For transmit operations, setting the SC2CR.PE bit to 1 enables parity generation in 7and 8-Bit UART modes. The SC2CR.EVEN bit selects either even or odd parity. If enabled, the parity controller automatically generates parity for the frame in the transmit buffer (SC2BUF). In 7-Bit UART mode, the TB7 bit in the SC2BUF holds the parity bit. In 8-Bit UART mode, the TB8 bit in the SC2MOD holds the parity bit. The parity bit is set after the frame has been transmitted. The SC2CR.PE and SC2CR.EVEN bits must be programmed prior to a write to the transmit buffer. For receive operations, the parity controller automatically computes the expected parity when a frame in Receive Buffer 1 is transferred to Receive Buffer 2 (SC2BUF). The received parity bit is compared to the SC2BUF.RB7 bit in 7-Bit UART mode and to the SC2CR.RB8 bit in 8-Bit UART mode. If a frame is received with incorrect parity, the SC2CR.PERR bit is set. In I/O Interface mode, the SC2CR.PERR bit indicates an underrun error rather than a parity error.
TMP19A71
12-13
TMP19A71 12.3.13 Error Flags
The SIO2 has the following three error flags for improved data reception reliability. 1. Overrun error: SC2CR.OERR In UART and I/O Interface mode, an overrun error is reported with the OERR bit set to 1 if all bits of a new frame are received before the current frame is read from the receive buffer. Reading the flag causes it to be cleared. Note that an overrun error can only be cleared by reading the receive buffer or executing a software reset using the SC2MOD2.SWRST. When the SCLK2 pin is configured as an output in I/O Interface mode, however, no overrun error occurs so that the OERR flag has no meaning and is read as undefined. 2. Parity error/underrun error: SC2CR.PERR In UART mode, this flag indicates whether a parity error has occurred. A parity error is reported when the parity bit attached to a received frame does not match the expected parity computed from the frame. Reading the flag causes it to be cleared. In I/O Interface mode, this flag indicates whether an underrun error has occurred, only when double-buffering (Transmit Buffer 2) is enabled (SC2MOD2.WBUF = 1) with the SCLK2 pin configured as an input. An underrun error is reported upon completion of transmitting a frame from Transmit Buffer 1 if a next frame is not written to Transmit Buffer 2 before the clock pulse for the next frame is input. When the SCLK2 pin is configured as an output, no underrun error occurs so that the PERR flag nas no meaning and is read as undefined. Reading the flag causes it to be cleared. 3. Framing error: SC2CR.FERR In UART mode, this flag indicates whether a framing error has occurred. A framing error is reported if a 0 is detected where a stop bit was expected. (The middle three of the 16 samples are used to determine the bit value.) Reading the flag causes it to be cleared. During reception, only a single stop bit is detected regardless of the setting of the SBLEN bit in the SC2MOD2.
TMP19A71
12-14
TMP19A71
Table 12.3.4
Operating Mode UART Error Flag OERR PERR FERR I/O Interface (SCLK Input) OERR PERR
Error Flags
Function Overrun error flag Parity error flag Framing error flag Overrun error flag Underrun error flag (WBUF=1) Fixed to 0 (WBUF=0)
FERR I/O Interface (SCLK Output) OERR PERR FERR
Fixed to 0 Undefined Undefined Fixed to 0
12.3.14 Bit Transfer Sequence
The DRCHG bit in Serial Mode Control Register 2 (SC2MOD2) determines whether the most significant bit (MSB) or least significant bit (LSB) is transmitted first in I/O Interface mode. The setting of the DRCHG bit cannot be modified while the SIO is transferring data.
12.3.15 Stop Bit Length
The SBLEN bit in the SC2MOD2 determines the number of stop bits (1 or 2) used in UART mode.
TMP19A71
12-15
TMP19A71
12.3.16 Status Flag
The RBFLL bit in the SC2MOD2 indicates whether Receive Buffer 2 is full when double-buffering is enabled (SC2MOD2.WBUF = 1). It is set to 1 once a received frame is transferred from Receive Buffer 1 to Receive Buffer 2. The RBFLL bit is cleared to 0 when the TX19A core processor or DMAC reads data from Receive Buffer 2. When WBUF = 0, the RBFLL bit has no meaning; it should not be used as a status flag. The TBEMP bit in the SC2MOD2 indicates whether Transmit Buffer 2 is empty when double-buffering is enabled (SC2MOD2.WBUF = 1). It is set to 1 once a transmit frame is transferred from Transmit Buffer 2 to Transmit Buffer 1 (shift register). The TBEMP bit is cleared to 0 when the TX19A core processor or DMAC stores data in Transmit Buffer 2. When WBUF = 0, the TBEMP bit has no meaning; it should not be used as a status flag.
12.3.17 Transmit/Receive Buffer Configuration
Table 12.3.5 Transmit/Receive Buffer Configuration
WBUF = 0 UART I/O Interface (SCLK Input) I/O Interface (SCLK Output) Transmit Receive Transmit Receive Transmit Receive Single Double Single Double Single Single WBUF = 1 Double Double Double Double Double Double
TMP19A71
12-16
TMP19A71
12.3.18 Transmit/Receive FIFO Buffers
As shown in Figure 12.3.5 and Figure 12.3.6, a total of 16 bytes of FIFO buffer is available both in UART mode (excluding 9-Bit UART mode) and I/O Interface mode. When the FIFO buffer is used for both transmit and receive operations, 8 bytes are assigned to each. When the FIFO buffer is required for only transmit or receive, all the 16 bytes can be used as transmit or receive buffers.
Receive Buffer 1 (Shift Register)
RX2 (P85)
Receive Buffer 2 (SC2BUF)
Receive FIFO
SC2FCNF. CNFG2
Internal Bus
Figure 12.3.5 Receive FIFO Block Diagram
Transmit FIFO Internal Bus
SC2FCNF. CNFG2
Transmit Buffer 2 (SC2BUF)
Transmit Buffer 1 (Shift Register)
TX2 (P86)
Figure 12.3.6 Transmit FIFO Block Diagram
TMP19A71
12-17
TMP19A71
In SCLK Output mode (in I/O Interface mode), writing data in the transmit buffer starts a transmission in half-duplex mode. If the transmit buffer contains no data, transmit operation is halted. Setting the RXE bit in the SC2MOD0 to 1 starts receive operation in half-duplex mode. Receive operation can be stopped by clearing the SC2MOD0.RXE bit to 0 before reading the last frame. When the FIFO buffer is enabled, the following sequence must be executed to stop receive operation in half-duplex mode. 1. After receiving the last frame but one, disable the receive FIFO.
2. After receiving the last frame, disable receive operation by clearing the SC2MOD0.RXE bit. 3. Enable the receive FIFO with the same conditions as before. (When the transmit FIFO is enabled, it should be kept enabled.) 4. Read the data in the FIFO. 5. Disable the receive FIFO. 6. Read the last frame. Operation in full-duplex mode is the same as transmit operation in half-duplex mode. The received data must be read before a next transmit frame has been written.
Note 1:
When the transmit FIFO is used, do not access registers other than the SC2BUF, SC2FRS, and SC2FTS.
Note 2: Note 3:
When the receive FIFO is used, do not access the SC2CR or write to the SC2FRS. Do not write to the transmit FIFO when it is full. Before writing to the transmit FIFO, check the number of bytes stored in the transmit FIFO by using the SC2FTS.TLVL field.
Note 4:
Do not read from the receive FIFO when it is empty. Before reading the receive FIFO, check the number of bytes stored in the receive FIFO by using the SC2FRS.RLVL field.
TMP19A71
12-18
TMP19A71 12.3.19 Signal Generation Timing
(1) I/O Interface mode Table 12.3.6 Receive operation
Interrupt (WBUF = 0) Interrupt (WBUF = 1) SCLK Input Mode SCLK Output Mode SCLK Input Mode Immediately after the rising edge of the last SCLK pulse Immediately after the rising or falling edge of the last SCLK pulse, as programmed SCLK Output Mode Immediately after the rising edge of the last SCLK pulse (i.e., immediately after the frame is transferred to Receive Buffer 2) or immediately after the frame is read from Receive Buffer 2 Immediately after the rising or falling edge of the last SCLK pulse, as programmed (i.e., immediately after the frame is transferred to Receive Buffer 2) Overrun Error SCLK Input Mode Immediately after the rising or falling edge of the last SCLK pulse, as programmed
Signal Generation Timing in I/O Interface Mode
Transmit operation
Interrupt (WBUF = 0) Interrupt (WBUF = 1) SCLK Input Mode SCLK Output Mode Immediately after the rising edge of the last SCLK pulse SCLK Input Mode Immediately after the rising or falling edge of the last SCLK pulse, as programmed SCLK Output Mode Immediately after the rising edge of the last SCLK pulse or immediately after the frame is transferred to Transmit Buffer 1 Immediately after the rising or falling edge of the last SCLK pulse, as programmed or immediately after the frame is transferred to Transmit Buffer 1 Underrun error (WBUF=1) Note 1: SCLK Input Mode Immediately after the rising or falling edge of the next SCLK pulse, as programmed
Do not modify any control registers while data is being transmitted or received (receive operation is enabled).
Note 2:
Do not disable receive operation (SC2MOD0.RXE = 0) while data is being received.
TMP19A71
12-19
TMP19A71
(2) UART mode Table 12.3.7 Receive operation
8 Data Bits with No Parity, Mode Interrupt Framing Error Parity Error Overrun Error 9 Data Bits 8 Data Bits with Parity 7 Data Bits with Parity 7 Data Bits wih No Parity Middle of the first stop bit Middle of the first stop bit Middle of the stop bit Middle of the stop bit Middle of the stop bit parity bit) Middle of the stop bit Middle of the stop bit Middle of the first stop bit Middle of the stop bit
Signal Generation Timing in UART Mode
Middle of the last bit (i.e., Middle of the last bit (i.e., parity bit)
Transmit operation
8 Data Bits with No Parity, Mode Interrupt (WBUF = 0) Interrupt (WBUF = 1) 9 Data Bits Simultaneously with transferring the stop bit Immediately after the frame is transferred to Transmit Buffer 1 (i.e., simultaneously with transferring the start bit) Note 1: 8 Data Bits with Parity Simultaneously with transferring the stop bit Immediately after the frame is transferred to Transmit Buffer 1 (i.e., simultaneously with transferring the start bit) 7 Data Bits with Parity, 7 Data Bits with No Parity Simultaneously with transferring the stop bit Immediately after the frame is transferred to Transmit Buffer 1 (i.e., simultaneously with transferring the start bit)
Do not modify any control registers while data is being transmitted or received (or receive operation is enabled).
Note 2: Note 3:
Do not disable receive operation (SC2MOD0.RXE = 0) while data is being received. The "middle" in the above table means the 9th bit of SIOCLK.
TMP19A71
12-20
TMP19A71
12.4 Register Descripsion (Only channel 2 registers are described.)
Table 12.4.1
Address 0xFFFF_C480 0xFFFF_C481 0xFFFF_C484 0xFFFF_C485 0xFFFF_C488 0xFFFF_C489 0xFFFF_C490 0xFFFF_C494 0xFFFF_C498 0xFFFF_C499 0xFFFF_C49C 0xFFFF_C49D 0xFFFF_C4A0 0xFFFF_C4A1 0xFFFF_C4A4 0xFFFF_C4A5 0xFFFF_C4A8 0xFFFF_C4A9 0xFFFF_C4B0 0xFFFF_C4B4 0xFFFF_C4B8 0xFFFF_C4B9 0xFFFF_C4BC 0xFFFF_C4BD Bits 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Mnemonic SC0MOD0 SC0MOD1 SC0CR SC0MOD2 BR0CR BR0ADD SC0BUF SC0FCNF SC0FTC SC0FRC SC0FTS SC0FRS SC1MOD0 SC1MOD1 SC1CR SC1MOD2 BR1CR BR1ADD SC1BUF SC1FCNF SC1FTC SC1FRC SC1FTS SC1FRS
SIO Register Map
Register Name
Serial 0 Mode Control Register 0 Serial 0 Mode Control Register 1 Serial 0 Control Register Serial 0 Mode Control Register 2 Baud Rate Generator Control Register (SIO0) Baud Rate Generator Additional Control Register (SIO0) Serial 0 Transmit/Receive Buffer Register Serial 0 FIFO Configuration Register Serial 0 FIFO Transmit Control Register Serial 0 FIFO Receive Control Register Serial 0 FIFO Transmit Status Register Serial 0 FIFO Receive Status Register Serial 1 Mode Control Register 0 Serial 1 Mode Control Register 1 Serial 1 Control Register Serial 1 Mode Control Register 2 Baud Rate Generator Control Register (SIO1) Baud Rate Generator Additional Control Register (SIO1) Serial 1 Transmit/Receive Buffer Register Serial 1 FIFO Configuration Register Serial 1 FIFO Transmit Control Register Serial 1 FIFO Receive Control Register Serial 1 FIFO Transmit Status Register Serial 1 FIFO Receive Status Register
Note: Although these registers are 8-bit wide, two registers at consecutive addresses can be accessed simultaneously with a 16-bit access instruction.
TMP19A71
12-21
TMP19A71
Address 0xFFFF_C4C0 0xFFFF_C4C1 0xFFFF_C4C4 0xFFFF_C4C5 0xFFFF_C4C8 0xFFFF_C4C9 0xFFFF_C4D0 0xFFFF_C4D4 0xFFFF_C4D8 0xFFFF_C4D9 0xFFFF_C4DC 0xFFFF_C4DD 0xFFFF_C4E0 0xFFFF_C4E1 0xFFFF_C4E4 0xFFFF_C4E5 0xFFFF_C4E8 0xFFFF_C4E9 0xFFFF_C4E0 0xFFFF_C4F4 0xFFFF_C4F8 0xFFFF_C4F9 0xFFFF_C4FC 0xFFFF_C4FD
Bits 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
Mnemonic SC2MOD0 SC2MOD1 SC2CR SC2MOD2 BR2CR BR2ADD SC2BUF SC2FCNF SC2FTC SC2FRC SC2FTS SC2FRS SC3MOD0 SC3MOD1 SC3CR SC3MOD2 BR3CR BR3ADD SC3BUF SC3FCNF SC3FTC SC3FRC SC3FTS SC3FRS
Register Name Serial 2 Mode Control Register 0 Serial 2 Mode Control Register 1 Serial 2 Control Register Serial 2 Mode Control Register 2 Baud Rate Generator Control Register (SIO2) Baud Rate Generator Additional Control Register (SIO2) Serial 2 Transmit/Receive Buffer Register Serial 2 FIFO Configuration Register Serial 2 FIFO Transmit Control Register Serial 2 FIFO Receive Control Register Serial 2 FIFO Transmit Status Register Serial 2 FIFO Receive Status Register Serial 3 Mode Control Register 0 Serial 3 Mode Control Register 1 Serial 3 Control Register Serial 3 Mode Control Register 2 Baud Rate Generator Control Register (SIO3) Baud Rate Generator Additional Control Register (SIO3) Serial 3 Transmit/Receive Buffer Register Serial 3 FIFO Configuration Register Serial 3 FIFO Transmit Control Register Serial 3 FIFO Receive Control Register Serial 3 FIFO Transmit Status Register Serial 3 FIFO Receive Status Register
Note: Although these registers are 8-bit wide, two registers at consecutive addresses can be accessed simultaneously with a 16-bit access instruction.
TMP19A71
12-22
TMP19A71
7
Bit Symbol SC2MOD0 Read/Write (0xFFFF_C4C0) Reset Value TB8 0
Serial 2 Mode Control Register 0 6 5 4 3
CTSE 0 RXE 0 control 0: Disable 1: Enable WU R/W 0 Wake-up function 0: Disable 1: Enable 0 SM
2
1
SC
0
0
0
0
Bit 8 of a Handshake Receive transmitted control character Function 0: Disable CTS operation 1: Enable CTS operation
Serial transfer mode (for SIO2, SIO3 only) 01: 7-bit UART mode 10: 8-bit UART mode 11: 9-bit UART mode
Serial clock (for UART) 01: Baud rate generator 10: Internal clock (IMCLK) 11: External clock (SCLK2 input)
(for SIO2, SIO3 only)
00: I/O Interface mode 00: Timer TB2OUT
Wake-up function 0 1 9-bit UART mode Interrupt on every received frame Interrupt only when RB8 = 1 Other modes Don't care
Handshake ( CTS ) control (for SIO2, SIO3 only) 0 1 Disable (Accept data streams at all times) Enable
Note 1: Note 2: Note 3: Note 4: Note 5:
In I/O Interface mode, the Serial Control Register (SC2CR) is used to select a serial clock. Like the SIO2, the SIO0, SIO1 and SIO3 allows use of the timer TB2OUT as a serial clock. The SC2MOD0, SC2MOD1 and SC2MOD2 registers must be set with the RXE bit cleared to 0. After setting these registers, set the RXE bit to 1. During transmit operation in half-duplex mode (SC2MOD1.FDPX=0) in I/O Interface mode (SC2MOD0.SM=00), do not set the RXE bit to 1. The TB8 bit is not double-buffered. Before writing to this bit, make sure that double-buffering is disabled and no transmit operation is in progress.
TMP19A71
12-23
TMP19A71
Serial 2 Mode Control Register 1 7
SC2MOD1 (0xFFFF_C4C1) Bit Symbol Read/Write Reset Value Function R/W 0
6
FDPX R/W 0 Sync method 0: Half duplex 1: Full duplex
5
R/W 0
4
UART R/W 0 UART output 0: Normal 1: 50% duty cycle
3
0
2
W 0
1
0
0
0
Note: When the N + (16 - K)/16 clock division function is used, the duty ratio varies with the value of K.
TMP19A71
12-24
TMP19A71
Serial 2 Mode Control Register 2
SC2MOD2 (0xFFFF_C4C5)
7
Bit Symbol Read/Write Reset Value TBEMP
6
5
TXRUN
4
SBLEN
3
2
WBUF 0 Doublebuffering 0: Disable 1: Enable
1
SWRST
0
Function
RBFLL R 1 0 Transmit Receive buffer buffer full empty flag flag 0: Full 0: Empty 1: Empty 1: Full
DRCHG R/W 0 0 0 Transmit-in Number of Bit -progress stop bits sequence flag 0: 1 bit 0: LSB first 0: Stopped 1: 2 bits 1: MSB first 1: Transmitting
00 Software reset A write of 10 followed by a write of 01
Symbol SWRST
Function A write of 10 followed by a write of 01 to this field resets the module, thus initializing the RXE bit in the SC2MOD0, the TBEMP, RBFLL and TXRUN bits in the SC2MOD2, the OERR, PERR and FERR bis in the SC2CR, and the internal circuits.
WBUF
Enables or disables double-buffering for transmit (SCLK output or input) or receive (SCLK output) operation in I/O Interface mode and transmit operation in UART mode. For any other modes of operation, double-buffering is always enabled.
DRCHG
Specifies the bit transfer sequence in I/O Interface mode. In UART mode, the LSB is always transferred first.
SBLEN
Specifies the number of transmit stop bits in UART mode. For receive operation, a single stop bit is used regardless of the setting of this bit.
TXRUN
A status flag indicating whether transmit shift operation is in progress. When this bit is set to 1, transmit operation is in progress. When this bit is cleared to 0, transmit operation is completed (if TBEMP = 1) or the trnamit buffer contains a next frame and is ready for transmission (if TBEMP= 0).
RBFLL
A flag indicating whether Receive Buffer 2 is full. The RBFLL bit is set to 1 once a received frame is transferred from Receive Buffer 1 to Receive Buffer 2. It is cleared when the frame is read from Receive Buffer 2. When double-buffering is disabled, the RBFLL bit has no meaning.
TBEMP
A flag indicating whether Transmit Buffer 2 is empty. The TBEMP bit is set to 1 once a frame is transferred from Transmit Buffer 2 to Transmit Buffer 1. It is cleared when a next frame is written to Transmit Buffer 2. When double-buffering is disabled, the TBEMP bit has no meaning.
Note 1:
If the module needs to be reset while it is transmitting data, two consecutive software reset sequences (i.e., 10, 01, 10, 01) must be executed.
Note 2:
This register does not support bit manipulation instructions.
TMP19A71
12-25
TMP19A71
Serial 2 Control Register 5 4 3
PE
7
SC2CR (0xFFFF_C4C4) Bit Symbol Read/Write Reset Value RB8 R 0 Bit 8 of a received character
6
EVEN
2
1
SCLKS
0
IOC
Function
R/W 0 0 Parity type Parity 0: Odd 0: Enable 1: Even 1: Disable
OERR PERR FERR R (Cleared when read) 0 0 0 1: Error has occurred. Overrun Parity/ underrun Framing
R/W 0 0 0: SCLK2 0: Baud rate generator 1: SCLK2 1: SCLK2 input
Input clock in I/O Interface mode (for CH2, CH3 only) 0 1 Baud rate generator SCLK2 pin input
Active edge for SCLK2 input (for CH2, CH3 only) 0 1 Data is transmitted/received on the SCLK2 rising edge. Data is transmitted/received on the SCLK2 falling edge. These bits are cleared to 0 when read.
Framing error flag Parity error/underrun error flag Overrun error flag
Patiy type 0 1 Note 1: All error flags are cleared to 0 when read. Note 2: This register does not support bit manipulation instructions. Note 3: The SC2CR.FERR bit should not be polled; instead, it should be read in the INTRX2 interrupt routine before the receive buffer is read. For details, see the example in "12.5.3 8-Bit UART Mode". Odd parity Even parity
TMP19A71
12-26
TMP19A71
Baud Rate Generator Control Register 6 5 4 3
DVS 0 N+ division function 0: Disable 1: Enable 0 00: IMCLK/2 10: IMCLK/32 11: IMCLK/128 PRE R/W 0 Must be written as Function 0. 0 0 0 0 0
7
BR2CR (0XFFFF_C4C8) Read/Write Reset Value Bit Symbol
2
BR2S
1
0
(16 - K)/16 01: IMCLK/8 Clock divisor value N
Clock source for baud rate generator 00 01 10 11 Internal clock IMCLK/2 Internal clock IMCLK/8 Internal clock IMCLK/32 Internal clock IMCLK/128
Baud Rate Generator Additional Control Register 7 6 5 4 3 2
BR2ADD (0xFFFF_C4C9) Bit Symbol Read/Write Reset Value 0 0 0 0 0 0 BR2K R/W
1
0
0
0
Function
Value K in N +16 - K)/16
Clock divisor value for the baud rate generator BR2CR.DVS= 1 BR2CR. BR2S BR2ADD. BR2K 0000 0001(K = 1) to 1111(K = 15) Prohibited Divide by N + (16 - K)
16
BR2CR.DVS= 0 0001 (N = 1) (UART only) to 1111N = 15 0000N = 16 Divide by N Divide by N
0000 (N = 16) to 0001 (N = 1) Prohibited
0010 (N = 2) to 1111 (N = 15) Prohibited
Note 1: The baud rate generator divisor cannot be set to 1 in UART mode if the N + (16 - K)/16 clock division function is enabled. In I/O Interface mode, do not set the baud rate generator divisor to 1; setting the divisor to 1 will cause incorrect operation. Note 2: To use the N + (16 - K)/16 clock division function, the value of K must be programmed in the BR2ADD.BR2K field before setting the BR2CR.DVS bit to 1. However, the N + (16 - K)/16 clock division function is not usable when BR2CR.BR2S = 0000 (N = 16) or 0001 (N = 1). Note 3: The N + (16 - K)/16 clock division function can only be used in UART mode. In I/O Interface mode, it must be disabled by clearing the BR2CR.DVS bit to 0.
TMP19A71
12-27
TMP19A71
Serial Transmit/Receive Buffer Register 7
Bit Symbol Read/Write Reset Value Function 0 0 0 0
6
5
4
TB W
3
2
1
0
0
0
0
0
Transmit buffer SC2BUF (0xFFFF_C4D0)
7
bit Symbol Read/Write Reset Value Function Note: 0
6
5
4
RB R
3
2
1
0
0
0
0
0
0
0
0
Receive buffer
In I/O Interface mode (SC2MOD0.SM = 0), do not write to the transmit buffer during receive operation in half-duplex mode (SC2MOD1.FDPX = 0).
TMP19A71
12-28
TMP19A71
Serial 2 FIFO Configuration Register 7
Bit Symbol SC2FCNF (0xFFFF_C4D4) Read/Write Reset Value Function 0
6
0
5
R 0
4
0
3
0
2
0
1
CNFG R/W 00 FIFO 00: Disable
0
01: Transmit (16 bytes) 10: Receive (16 bytes) 11: Transmit/Receive (8 bytes each) Note: For continuous transmit/receive operations using the FIFO, double-buffering must be enabled (SC2MOD2.WBUF=1).
Serial 2 FIFO Receive Control Register 7
Bit Symbol SC2FRC (0xFFFF_C4D9) Read/Write Reset Value Interrupt level Function 0000: Interrupt is generated when the receive FIFO reaches 1 byte. 0001: Interrupt is generated when the receive FIFO reaches 2 bytes. 0010: Interrupt is generated when the receive FIFO reaches 3 bytes. 0011: Interrupt is generated when the receive FIFO reachs 4 bytes. ... 1111: Interrupt is generated when the receive FIFO reaches 16 bytes. Setting has no effect when CNFG=00/01. The most significant bit must be cleared to 0 when CNFG=11. RFIS: When RFIS=0, a receive FIFO interrupt is generated only when the number of bytes stored in the receive FIFO set in the SC2FRS.RLVL matches the interrupt generation level set in the SC2FRC.RIL. When RFIS=1, a receive FIFO interrupt is generated when the number of bytes stored in the receive FIFO set in the SC2FRS.RLVL is equal to or greater than the interrupt generation level set in the SC2FRC.RIL. Note: This register does not support bit manipulation instructions.
0: Interrupt generated only when RIL=RLVL 1: Interrupt generated when RILRLVL
6
RIL
5
R/W 0000
4
3
RFIS 0
Interrupt condition
2
RFCL W 0
FIFO clear Setting this bit to 1 clears FIFO value. (This bit is always read as 0.)
1
RFIE R/W 0
Receive FIFO interrupt 0: Disable 1: Enable
0
R 0
TMP19A71
12-29
TMP19A71
Serial 2 FIFO Transmit Control Register 7
Bit Symbol SC2FTC (0xFFFF_C4D8) Read/Write Reset Value Interrupt level Function 0000: Interrupt is generated when the transmit FIFO reaches 1 byte. 0001: Interrupt is generated when the transmit FIFO reaches 2 bytes. 0010: Interrupt is generated when the transmit FIFO reaches 3 byes. 0011: Interrupt is generated when the transmit FIFO reaches 4 bytes. ... 1111: Interrupt is generated when the transmit FIFO reaches 16 bytes. Setting has no effect when CNFG=00/10. The most significant bit must be cleared to 0 when CNFG=11. TFIS: When TFIS=0, a transmit FIFO interrupt is generated only when the number of bytes stored in the transmit FIFO set in the SC2FTS.TLVL matches the interrupt generation level set in the SC2FTC.TIL. When TFIS=1, a transmit FIFO interrupt is generated when the number of bytes stored in the transmit FIFO set in the SC2FTS.TLVL is equal to or smaller than the interrupt generation level set in the SC2FTC.TIL. Note: This register does not support bit manipulation instructions.
When SC2FRC.RIL=0001 When SC2FTC.TIL=1110
6
TIL
5
R/W 0111
4
3
TFIS 0
Interrupt condition
2
TFCL W 0
FIFO clear Setting this
1
TFIE R/W 0
Transmit FIFO interrupt 0Disable 1: Enable
0
R 0
0: Interrupt generated only when TIL=TLVL. 1: Interrupt generated when TILTLVL
bit to 1 clears the FIFO value. (This bit is always read as 0.)
RLVL=00000 Receive FIFO: 0 bytes
TLVL=10000 Transmit FIFO: 16 bytes
Data received
FIFO data read
Data transmitted
FIFO data written
RLVL=00001 Receive FIFO: 1 byte Interrupt generated (RFIS=0/1) Interrupt generated (TFIS=0/1)
TLVL=01111 Transmit FIFO: 15 bytes
Data received
FIFO data read
Data transmitted
FIFO data written
RLVL=00010 Receive FIFO: 2 bytes
TLVL=01110 Transmit FIFO: 14 bytes
Data received
FIFO data read Interrupt generated (RFIS=1)
Data transmitted
FIFO data written Interrupt generated (TFIS=1)
RLVL=00011 Receive FIFO: 3 bytes
TLVL=01101 Receive FIFO: 13 bytes
Data received
FIFO data read Interrupt generated (RFIS=1)
Data transmitted
FIFO data written Interrupt generated (TFIS=1)
Data received
Data transmitted
FIFO data read RLVL=10000 Receive FIFO: 16 bytes Interrupt generated (RFIS=1) TLVL=00000 Receive FIFO: 0 bytes
FIFO data written Interrupt generated (TFIS=1)
Figure 12.4.1
Example of Interrupt Generaton Timing when Using FIFO
TMP19A71
12-30
TMP19A71
Serial 2 FIFO Receive Status Register 7
Bit Symbol SC2FRS (0xFFFF_C4DD) Read/Write Reset Value Function RUR 0 This bit is set to 1 when the receive FIFO is full. RUR:
6
0 Can be read as 0.
5
4
R
3
2
RLVL 00000
1
0
0 Can be read as 0. Receive FIFO byte count 00000: 0 bytes 00001: 1 byte 00010: 2 bytes 00011: 3 bytes ... 10000: 16 bytes
The RUR bit is set to 1 if an attempt to store a new value is made when the receive FIFO is already full. This bit is cleared to 0 when it is read while the receive FIFO buffer is not full.
Note: This register does not support bit manipulation instructions.
Serial 2 FIFO Transmit Status Register 7
SC2FTS (0xFFFF_C4DC) Bit Symbol Read/Write Reset Value Function 1 This bit is set to 1 when the transmit FIFO is empty. 0 Can be read as 0. 0 Can be read as 0. Transmit FIFO byte count 00000: 0 bytes 00001: 1 byte 00010: 2 bytes 00011: 3 bytes ... 10000: 16 bytes TUR: The TUR bit is set to 1 when the transmit FIFO becomes empty. When the first byte is stored in the transmit FOFO, it is immediately transferred to the transfer buffer (SC2BUF), causing the transmit FIFO to become empty and the TUR bit to be set to 1. This bit is automatically cleared to 0 when data is written to the transmit FIFO. TUR
6
5
4
R
3
2
TLVL 00000
1
0
TMP19A71
12-31
TMP19A71
12.5 Operating Modes
12.5.1 I/O Interface Mode
I/O Interface mode utilizes a synchronization clock (SCLK), which can be configured for either Output mode in which the SCLK clock is driven out from the TMP19A71 or Input mode in which the SCLK clock is supplied externally. (1) Transmit operation (half-duplex) SCLK Output mode When transmit double-buffering is disabled (SC2MOD2.WBUF = 0) in SCLK Output mode, each time the TX19A core processor writes a frame to the transmit buffer, the 8 bits of the frame are shifted out on the TXD2 pin, and the synchronization clock is driven out from the SCLK2 pin. When all the bits have been shifted out, the INTTX2 interrupt is generated. When transmit double-buffering is enabled (SC2MOD2.WBUF = 1), a frame is transferred from Transmit Buffer 2 to Transmit Buffer 1 (shift register) once the TX19A core processor writes the frame to Transmit Buffer 2 when no data is being transmitted or the last frame in Transmit Buffer 1 has been sent. At this time, the transmit buffer empty flag (SC2MOD2.TBEMP) is set to 1 and the INTTX2 interrupt is generated. If there is no data to be transferred from Transmit Buffer 2 to Transmit Buffer 1, however, the INTTX2 interrupt is not generated and SCLK2 output is stopped.
Transmit Data Write Timing SCLK2 Output TX2 (INTTX2) bit 0 bit 1 bit 6 bit 7 bit 0
TBRUN Figure 12.5.1 Transmit Operation in I/O Interface Mode (SCLK Output mode, double-buffering disabled)
Transmit Data Write Timing SCLK2 Output TX2 (INTTX2) TBRUN TBEMP bit 0 bit 1 bit 6 bit 7 bit 0
Figure 12.5.2 Transmit Operation in I/O Interface Mode (SCLK Output mode, double-buffer enabled, data in Transmit Buffer 2)
TMP19A71
12-32
TMP19A71
Transmit Data Write Timing SCLK2 Output TX2 (INTTX2) TBRUN TBEMP bit 0 bit 1 bit 6 bit 7
Figure 12.5.3 Transmit Operation in I/O Interface mode (SCLK Output mode, double-buffering enabled, no data in Transmit Buffer 2)
SCLK Input mode When transmit double-buffering is disabled (SC2MOD2.WBUF = 0) in SCLK Input mode, the 8 bits of a frame in the transmit buffer are shifted out on the TX2 pin when the SCLK2 input becomes active (i.e., the first rising or falling edge, as programmed) with transmit data written in the transmit buffer. The TX19A core processor must load a next frame into the transmit buffer by point A (shown in Figure 12.5.4). When transmit double-buffering is enabled (SC2MOD2.WBUF = 1), a frame is transferred from Transmit Buffer 2 to Transmit Buffer 1 (shift register) once the TX19A core processor writes the frame to Transmit Buffer 2 before the SCLK2 input becomes active or once the last frame in Transmit Buffer 1 has been sent. At this time, the transmit buffer empty flag (SC2MOD2.TBEMP) is set to 1 and the INTTX2 interrupt is generated. If the SCLK2 input becomes active before a frame is written to Transmit Buffer 2, an underrun error occurs and 8 bits of dummy data (0xFF) are sent although the internal bit counter starts counting.
Transmit Data Write Timing SCLK2 Input (SCLKS = 0: Rising Edge) SCLK2 Input (SCLKS = 1: Falling Edge) TX2 (INTTX2) bit 0 bit 1 bit 5 bit 6 bit 7 bit 0 bit 1 A
Figure 12.5.4 Transmit Operation in I/O Interface Mode (SCLK Input mode, double-bufferig disabled)
TMP19A71
12-33
TMP19A71
Transmit Data Write Timing SCLK2 Input (SCLKS = 0: Rising Edge) SCLK2 Input (SCLKS = 1: Falling Edge) TX2 (INTTX2) TBRUN TBEMP bit 0 bit 1 bit 5 bit 6 bit 7 bit 0 bit 1 A
Figure 12.5.5 Transmit Operation in I/O Interface Mode (SCLK Input mode, double-buffering enabled, data in Transmit Buffer 2)
Transmit Data Write Timing SCLK2 Input (SCLKS = 0: Rising Edge) SCLK2 Input: (SCLKS = 1: Falling Edge) TX2 (INTTX2) TBRUN TBEMP PERR (Underrun error) bit 0 bit 1 bit 5 bit 6 bit 7 1 A
Figure 12.5.6 Transmit Operation in I/O Interface Mode (SCLK Input mode, double-buffering enabled, no data in Transmit Buffer 2)
TMP19A71
12-34
TMP19A71
(2) Receive operation (half-duplex) SCLK Output mode When receive double-buffering is disabled (SC2MOD2.WBUF = 0) in SCLK Output mode, each time the TX19A core processor picks up the frame in Receive Buffer 1, the synchronization clock is driven out from the SCLK2 pin to shift the next frame into Receive Buffer 1. When a whole-8-bit frame has been received in Receive Buffer 1, the INTRX2 interrupt is generated. The SCLK output is initiated by setting the SC2MOD0.RXE bit to 1. When receive double-buffering is enabled (SC2MOD2.WBUF = 1), the frame received first is transferred to Receive Buffer 2 and then a next frame is received into Receive Buffer 1. Once a frame is transferred from Receive Buffer 1 to Receive Buffer 2, the Receive Buffer Full flag (SC2MOD2.RBFULL) is set to 1 and the INTRX2 interrupt is generated. After a frame has been transferred to Receive Buffer 2, the TX19A core processor or DMAC should read it before all 8 bits of a next frame are received. Otherwise, the INTRX2 interrupt is not generated and SCLK2 output is stopped. If the TX19A core processor or DMAC subsequently reads the frame in Receive Buffer 2 in this state, the next frame is transferred from Receive Buffer 1 to Receive Buffer 2, generating the INTRX2 interrupt to restart receive operation.
Receive Data Read Timing SCLK2 Output RX2 (INTRX2) bit 0 bit 1 bit 6 bit 7 bit 0
Figure 12.5.7 Receive Operation in I/O Interface Mode (SCLK Output mode, double-buffering disabled)
Receive Data Read Timing SCLK2 Output RX2 (INTRX2) RBFULL bit7 bit 0 bit 1 bit 6 bit 7 bit 0
Figure 12.5.8 Receive Operation in I/O Interface Mode (SCLK Output mode, double-buffering enabled, reading Receive Buffer 2)
TMP19A71
12-35
TMP19A71
Receive Data Read Timing SCLK2 Output RX2 (INTRX2) RBFULL bit7 bit 0 bit 1 bit 6 bit 7
Figure 12.5.9 Receive Operation in I/O Interface Mode (SCLK Output mode, double-buffering enabled, not reading Receive Buffer 2) SCLK Input mode In SCLK Input mode, receive double-buffering is always enabled. A received frame is transferred to Receive Buffer 2 so that a next frame can be received continuously into Receive Buffer 1. The INTRX2 interrupt is generated every time a frame is transferred from Receive Buffer 1 to Receive Buffer 2.
Receive Data Read Timing SCLK2 Input (SCLKS = 0: Rising Edge) SCLK2 Input (SCLKS = 1: Falling Edge) RX2 (INTRX2) RBFULL bit 0 bit 1 bit 5 bit 6 bit 7 bit 0
Figure 12.5.10
Receive Operation in I/O Interface Mode
(SCLK Input mode, reading Receive Buffer 2)
Receive Data Read Timing SCLK2 Input (SCLKS = 0: Rising Edge) SCLK2 Input (SCLKS = 1: Falling Edge) RX2 (INTRX2) RBFULL OERR bit 0 bit 1 bit 5 bit 6 bit 7 bit 0
Figure 12.5.11
Receive Operation in I/O Interface Mode
(SCLK Input mode, not reading Receive Buffer 2)
TMP19A71
12-36
TMP19A71
Note: To perform receive operation, the SC2MOD0.RXE bit must be set to 1 in both SCLK Input and SCLK Output modes.
(3) Transmit/receive operation (full-duplex) Setting the SC2MOD1.FDPX2 bit to 1 enables full-duplex communication. SCLK Output mode When transmit/receive double-bufferig is disabled (SC2MOD2.WBUF = 0) in SCLK Output mode, each time the TX19A core processor writes a frame to the transmit buffer, the synchronization clock is driven out from the SCLK2 pin to shift an 8-bit frame into Receive Buffer 1, generating the INTRX2 interrupt. At the same time, the frame written to the transmit buffer is shifted out on the TX2 pin. When all the bits have been shifted out, the transmit-done interrupt (INTTX2) is generated and SCLK2 output is stopped. When the TX19A core processor subsequently picks up the frame in the receive buffer and writes a next frame to the transmit buffer, next transmit/receive operation starts, regardless of whether the TX19A core processor first reads the receive buffer or writes data to the transmit buffer. When transmit/receive double-buffering is enabled (SC2MOD2.WBUF = 1), each time the TX19A core processor writes a frame to Transmit Buffer 2, the synchronization clock is driven out from the SCLK2 pin to shift an 8-bit frame into Receive Buffer 1; it is then transferred to Receive Buffer 2, generating the INTRX2 interrupt. At the same time, the frame stored in Transmit Buffer 1 is shifted out on the TXD2 pin. When all the bits have been shifted out, the transmit-done interrupt (INTTX2) is generated and the next frame is transferred from Transmit Buffer 2 to Transmit Buffer 1. Durnig the above sequence, SCLK output is stopped if Transmit Buffer 2 becomes empty (SC2MOD2.TBEMP = 1) or if Receive Buffer 2 still contains data (SC2MOD2.RBFULL = 1). When the TX19A core processor suqsequently picks up the frame in Receive Buffer 2 and writes a next frame to Transmit Buffer 2, SCLK2 output is restarted so that next transmit/receive operation starts.
Receive Data Read Timing Transmit Data Write Timing SCLK2 Output TX2 RX2 (INTTX2) (INTRX2) bit 0 bit 0 bit 1 bit 1 bit 5 bit 5 bit 6 bit 6 bit 7 bit 7 bit 0 bit 0 bit 1 bit 1
Figure 12.5.12
Transmit/Receive Operation in I/O Interface Mode
(SCLK Output mode, double-buffering disabled)
TMP19A71
12-37
TMP19A71
Receive Data Read Timing Transmit Data Write Timing SCLK2 Output TX2 RX2 (INTTX2) (INTRX2) bit 0 bit 0 bit 1 bit 1 bit 5 bit 5 bit 6 bit 6 bit 7 bit 7 bit 0 bit 0 bit 1 bit 1
Figure 12.5.13
Transmit/Receive Operation in I/O Interface Mode
(SCLK Output mode, double-buffering enabled, no next data)
Receive Data Read Timing Transmit Data Write Timing SCLK2 Output TX2 RX2 (INTTX2) (INTRX2) bit 0 bit 0 bit 1 bit 1 bit 5 bit 5 bit 6 bit 6 bit 7 bit 7
Figure 12.5.14
Transmit/Receive Operation in I/O Interface Mode
(SCLK Output mode, double-buffering enabled, continuous transfer)
TMP19A71
12-38
TMP19A71
SCLK Input mode When transmit double-buffering is disabled (SC2MOD2. WBUF = 0) in SCLK Input mode (receive double-buffering is always enabled in this mode), the TX19A core processor must write a frame to the transmit buffer before the SCLK2 input becomes avtive. The 8 bits of a frame in the transmit buffer are shifted out on the TX2 pin, and the 8 bits of a received frame are shifted into Receive Buffer 1, synchronous to the programmed edge of the SCLK2 input. When all the bits have been shifted out, the transmit-done interrupt (INTTX2) is generated. When all the bits have been received, the frame is transferred from Receive Buffer 1 to Receive Buffer 2, generating the INTRX2 interrupt. The TX19A core processor must load a next frame into the transmit buffer before the SCLK signal for the next frame is input (i.e., by point A shown in Figure 12.5.15 below). The TX19A core processor must also pick up the frame in Receive Buffer 2 before a next frame has been received. When transmit/receive double-buffering is enabled (SC2MOD2.WBUF = 1), a frame is transferred from Transmit Buffer 2 to Transmit Buffer 1 once the last frame in Transmit Buffer 1 has been sent. At this time, the INTTX2 interrupt is generated. When the 8-bit frame, received in parallel with transmission, has been shifted into Receive Buffer 1, it is transferred to Receive Buffer 2, generating the INTRX2 interrupt. When the SCLK2 is subsequently activated, the frame stored in Transmit Buffer 1 is shifted out while a next frame is received into Receive Buffer 1. If the TX19A core processor does not read the frame from Receive Buffer 2 before the last bit of a next frame is received, an overrun error occurs. If the TX19A core processor does not write a frame to Transmit Buffer 2 before the SCLK2 input is subsequently activated, an underrun error occurs.
A
Receive Data Read Timing Transmit Data Write Timing SCLK2 input
TX2 RX2 (INTTX2) (INTRX2)
bit 0 bit 0
bit 1 bit 1
bit 5 bit 5
bit 6 bit 6
bit 7 bit 7
bit 0 bit 0
bit 1 bit 1
Figure 12.5.15
Transmit/Receive Operation in I/O Interface Mode
(SCLK Input mode, double-buffering disabled)
TMP19A71
12-39
TMP19A71
Receive Data Read Timing Transmit Data Write Timing SCLK2 Input
TX2 RX2 (INTTX2) (INTRX2)
bit 0 bit 0
bit 1 bit 1
bit 5 bit 5
bit 6 bit 6
bit 7 bit 7
bit 0 bit 0
bit 1 bit 1
Figure 12.5.16
Transmit/Receive Operation in I/O Interface Mode
(SCLK Input mode, double-buffering enabled, no error occurred)
Receive Data Read Timing Transmit Data Write Timing SCLK2 Input
TX2 RX2 (INTTX2) (INTRX2) PERR (Underrun Error)
bit 0 bit 0
bit 1 bit 1
bit 5 bit 5
bit 6 bit 6
bit 7 bit 7
bit 0 bit 0
bit 1 bit 1
Figure 12.5.17
Transmit/Receive Operation in I/O Interface Mode
(SCLK Input mode, double-buffering enabled, an underrun error occurred)
TMP19A71
12-40
TMP19A71
12.5.2
7-Bit UART Mode
Setting the SM field in the SC2MOD0 to 01 puts the SIO2 in 7-Bit UART mode. In this mode, the parity bit can be added to the transmitted frame, and the receiver can perform a parity check on incoming data. Parity can be enabled and disabled through the programming of the PE bit in the SC2CR. When the PE bit is set to 1 to enable parity, the SC2CR.EVEN bit selects even or odd parity. The SBLEN bit in the SC2MOD2 specifies the number of stop bits.
Example: Transmitting 7-bit UART frames with an even-parity bit
start
bit 0
1
2
3
4
5
6
even parity
stop
Clocking conditions:
System clock: IMBUS clock Prescaler clock Transfer rate
: 56 MHz : 1/2 (28 MHz) : IMCLK/32 : 4800 bps (fsys = 56 MHz)
765 P8CR -1- P8FR1 -1- SC2MOD0 X 0 - SC2CR X11 BR2CR 011 BR2ADD 0 0 0 IMR52 -10 SC2BUF X * * Note: X = Don't care,
43210
----- ----- X0101
Configure the P86 pin as TX2. Select 7-Bit UART mode. Select even parity. N=11, and K is valid. IMCLK/32 Set the transfer rate to 4800 bps. (K = 10) Enable the INTTX2 interrupt and set its priority level to 4. Load the transmit buffer with a frame.
XXX00 010X1 01010 0-100 ***** -: No change
12.5.3
8-Bit UART Mode
Setting the SM field in the SC2MOD0 to 10 puts the SIO2 in 8-Bit UART mode. In this mode, the parity bit can be added to the transmitted frame, and the receiver can perform a parity check on incoming data. Parity can be enabled and disabled through the programming of the PE bit in the SC2CR. When the PE bit is set to 1 to enable parity, the SC2CR.EVEN bit selects even or odd parity.
Example: Transmitting 8-bit UART frames with an odd-parity bit
start
bit 0
1
2
3
4
5
6
7
odd parity
stop
Clocking conditions
System clock High-speed clock gear Prescaler clock Transfer rate
: 56 MHz : 1/2 (28 MHz) : IMCLK/32 : 9600 bps (fsys = 56 MHz)
TMP19A71
12-41
TMP19A71
*
Settings in the main routine 76543210 P8IER P8FR1 SC2MOD0 SC2CR BR2CR BR2ADD IMR53 SC2MOD0
--0----- --1----- -00X1001 X01XXXXX 01100101 00000101 -100-100 --1X----
Configure the P85 pin as RX2. Select 8-Bit UART mode. Select odd parity. N=5, and K is valid. Set the transfer rate to 9600 bps. (K = 5) Enable the INTRX2 interrupt and set its priority level to 4. Enable reception.
*
Example of interrupt routine processing ICLR 0 1 1 0 1 0 1 0 0 Reg. SC2CR AND 0x1C if Reg. 0 then error Reg. SC2BUF End of interrupt processing Note: X = Don't care, -: No change Clear the interrupt request. Check for errors. Read received data.
TMP19A71
12-42
TMP19A71 12.5.4 9-Bit UART Mode
Setting the SM field in the SC2MOD0 to 11 puts the SIO2 in 9-Bit UART mode. In this mode, the parity bit cannot be used and must be disabled by clearing the SC2CR.PE bit to 0. For transmit operation, the most-significant bit (9th bit) is stored in the TB8 bit in the SC2MOD0. For receive operation, the most-significant bit is stored in the RB8 bit in the SC2CR. Reads and writes from and to the transmit and receive buffers must be done with the most-significant bit first, followed by the SC2BUF. The SBLEN bit in the SC2MOD2 specifies the number of stop bits. Wake-up feature In 9-Bit UART mode, the wake-up feature can be enabled for slave controllers by setting the WU bit in the SC2MOD0 to 1. When this feature is enabled, the INTRX2 interrupt is generated only when SC2CR.RB8 = 1.
TX2
RX2
TX2
RX2
TX2
RX2
TX2
RX2
Master
Slave 1
Slave 2
Slave 3
Note:
The TX2 pin of a slave controller must be configured as an open-drain output by programming the Port 8 Open-Drain Control Register (P8ODCR).
Figure 12.5.18
Serial Link Using the Wake-Up Feature
TMP19A71
12-43
TMP19A71
Protocol (1) Put all the master and slave controllers in 9-Bit UART mode. (2) Enable the receiver in each slave controller by setting the SC2MOD0.WU bit to 1. (3) The master controller transmits an 8-bit address frame (i.e., select code) that identifies a slave controller. The most-significant bit (TB8) of an address frame is a 1.
start
bit 0
1
2
3
4
5
6
7
8 "1"
stop
Slave controller select code
(4) Each slave controller compares the received address to its station address and clears the WU bit to 0 if they match. (5) The master controller transmits a block of data to the selected salve controller (with SC2MOD.WU = 0). The most-significant bit (TB8) of a data frame is a 0.
start
bit 0
1
2
3 Data
4
5
6
7
bit 8 "0"
stop
(6) Slave controllers not addressed (with SC2MOD.WU = 1) continue to monitor the data stream but discard any frames with the most-significant bit (RB8) cleared to 0. Thus, the receive-done interrupt (INTRX2) is not generated. The addressed slave controller (with SC2MOD.WU = 0) can transmit data to the mater controller to notify that is has successfully received the message.
Example: Connecting a master controller with two slave controllers through a serial link using the IMCLK/2 clock as a serial clock
TX2
RX2 Master
TX2
RX2 Slave 1
TX2
RX2 Slave 2
Select Code 00000001
Select Code 00001010
TMP19A71
12-44
TMP19A71
3) Master controller setings
Main routine P8IER P8CR P8FR1 IMR53 IMR52

- - - - -
---- ---- 11---- 100-10 100-10
10 10
- - -
1 0
Configure the P86 pin as TX2 and the P85 pin as RX2.
Enable INTRX2 and set its interrupt level to 5. Enable INTTX2 and set its interrupt level to 4. Select 9-Bit UART mode and select IMCLK as a serial clock. Load the select code for slave 1.
SC2MOD0 1 0 1 0 1 1 1 0 SC2BUF 00000001 Interrupt routine (INTTX2) ICLR 0 1 1 0 1 0 0 0 0 SC2MOD0 0 - - - - - - - SC2BUF ******** End of interrupt processing
Clear the interrupt request. Clear the TB8 bit to 0. Load transmit data.
4)
Slave controller settings
Main routine P8IER P8CR P8FR1 P8ODCR IMR53 IMR52 SC2MOD0
-10---- -10---- -11---- -1----- - - -
Set the P86 pin as TX2 (open-drain output) and the P85 pin as RX2.
- --110110 --110101 00111110
Enable INTTX2 and INTRX2. Select 9-Bit UART mode, select IMCLK as a serial clock and set the WU bit to 1.
Interrupt routine (INTRX2) ICLR Reg. 011010100 SC2CR AND 0x1C Clear the interrupt request. Check for errors.
if Reg. 0 then error Reg. SC2BUF if Reg. = Select code Then SC2MOD0 - - - 0 - - - -
Clear the WU bit to 0.
TMP19A71
12-45
TMP19A71
13. Analog-to-Digital Converters (ADCs)
The TMP19A71 contains two 10-bit successive-approximation analog-to-digital converters (ADCs). Both ADCs have two modes; Normal mode and PMD mode. While Normal mode supports typical AD conversion with two 8-channel inputs, PMD mode is specifically designed for AD conversion for motor control. In PMD mode, the ADCs have 8-channel and 11-channel inputs. The two ADCs can be programmed to operate independently, and the operating mode can be separately selected for each of the ADCs.
13.1 Features
13.1.1
1 2 3 4 5
Normal Mode
Two 8-channel, 10-bit AD converters are available. Each channel has a separate conversion result register. The two AD converters can be independently programmed for Fixed-Channel or Channel Scan mode. The two AD converters can be independently programmed for Single Conversion or Continuous Conversion mode. The INTAD0/1 interrupt is generated upon completion of a conversion. The interrupt interval is selectable. Setting register enables starting of an AD conversion under the following conditions: * TMRB interrupt (INTTB1) * * External trigger input (ADTRG0/1) Software trigger (ADSFT0)
The highest-priority conversion can interrupt the ongoing conversion in Channel Scan and Fixed-Channel Continuous Conversion modes (The highest-priority conversion can only initiated by software). 7 The INTADHP0/1 interrupt is generated upon completion of the highest-priority conversion. 8 AD conversions can be monitored via the Busy and Overrun flags. 9 In Channel Scan Continuous Conversion mode, the interval between conversions can be selected. 10 The conversion result can be compared to the two compare registers. The user can select whether or not to generate an interrupt when the conversion result equals the compare register. 6
13.1.2
1 2 3 4
PMD Mode
Two 10-bit AD converters are available. One has 8 conversion result registers, and the other has 11 conversion result registers. The conversion enable, input channel and PMD timing trigger can be programmed independently for each conversion result register. Conversions are started in ascending order from the smallest-numbered enabled conversion result register. The conversion interval can be increased by a maximum of 255 times the PMD trigger interval.
TMP19A71
13-1
TMP19A71
13.2 Register Description
Each of the two ADCs contains a group of registers for both Normal mode and PMD mode as shown in Table 13.2.1. Table 13.2.1 ADC Register Map (1/3) Normal Mode (ADC0)
Address 0xFFFFC900 0xFFFFC904 0xFFFFC908 0xFFFFC90C 0xFFFFC910 0xFFFFC914 0xFFFFC918 0xFFFFC91C 0xFFFFC920 0xFFFFC924 0xFFFFC925 0xFFFFC928 0xFFFFC92C 0xFFFFC92C 0xFFFFC930 0xFFFFC934 0xFFFFC938 0xFFFFC93C 0xFFFFC940 Bits 16 16 16 16 16 16 16 16 16 8 8 16(8) 8 8 16 16 16 8 Mnemonic ADNRES0 ADNRES1 ADNRES2 ADNRES3 ADNRES4 ADNRES5 ADNRES6 ADNRES7 ADCHPR0 Register Name AD Normal Mode Result Register 0 AD Normal Mode Result Register 1 AD Normal Mode Result Register 2 AD Normal Mode Result Register 3 AD Normal Mode Result Register 4 AD Normal Mode Result Register 5 AD Normal Mode Result Register 6 AD Normal Mode Result Register 7 Highest-Priority Conversion Result Register (ADC0)
16(8) ADNMOD0 (L) AD Normal Mode Control Register (Low) (ADC0) ADNMOD0H AD Normal Mode Control Register High (ADC0) ADNCLK0 AD Normal Mode Clock Control Register (ADC0) CMPCTL0 (L) AD Monitor Control Register (Low) (ADC0) CMPCTL0H AD Monitor Control Register High (ADC0) ADCHPC0 ADCMP00 ADCMP01 Highest-Priority Conversion Control Register (ADC0) AD Compare Register 0(ADC0) AD Compare Register 1 (ADC0)
ADCBASN0 AD Normal Mode Basic Setting Register (ADC0) ADCSTART0 AD Software Start Register (ADC0)
TMP19A71
13-2
TMP19A71
Table 13.2.2 ADC Register Map (2/3) Normal Mode (ADC1)
Address 0xFFFFC980 0xFFFFC984 0xFFFFC988 0xFFFFC98C 0xFFFFC990 0xFFFFC994 0xFFFFC998 0xFFFFC99C 0xFFFFC9A0 0xFFFFC9A4 0xFFFFC9A5 0xFFFFC9A8 0xFFFFC9AC 0xFFFFC9AC 0xFFFFC9B0 0xFFFFC9B4 0xFFFFC9B8 0xFFFFC9BC 0xFFFFC9C0 Bits 16 16 16 16 16 16 16 16 16 8 8 8 8 16 16 16 8 Mnemonic ADNRES8 ADNRES9 ADNRES10 ADNRES11 ADNRES12 ADNRES13 ADNRES14 ADNRES15 ADCHPR1 ADNMOD1H ADNCLK1 CMPCTL1H ADCHPC1 ADCMP10 ADCMP11 ADCBASN1 Register Name AD Normal Mode Result Register 8 AD Normal Mode Result Register 9 AD Normal Mode Result Register 10 AD Normal Mode Result Register 11 AD Normal Mode Result Register 12 AD Normal Mode Result Register 13 AD Normal Mode Result Register 14 AD Normal Mode Result Register 15 Highest-Priority Conversion Result Register (ADC1) AD Normal Mode Control Register High (ADC1) AD Normal Mode Clock Control Register (ADC1) AD Monitor Control Register High (ADC1) Highest-Priority Conversion Control Register (ADC1) AD Compare Register 0(ADC1) AD Compare Register 1 (ADC1) A/D Normal Mode Basic Setting Register (ADC1)
16(8) ADNMOD1 (L) AD Normal Mode Control Register (Low) (ADC1)
16(8) CMPCTL1 (L) AD Monitor Control Register (Low) (ADC1)
ADCSTART1 AD Software Start Register (ADC1)
PMD Mode (ADC0)
Address 0xFFFFCD00 0xFFFFCD04 0xFFFFCD08 0xFFFFCD0C 0xFFFFCD10 0xFFFFCD14 0xFFFFCD18 0xFFFFCD1C 0xFFFFCD40 0xFFFFCD41 0xFFFFCD48 0xFFFFCD49 0xFFFFCD4C 0xFFFFCD4D 0cFFFFCD58 0xFFFFCD5C 0xFFFFCD60 0xFFFFCD61 0xFFFFCD64 0xFFFFCD65 0xFFFFCD68 0xFFFFCD6C 0xFFFFCD70 Bits 16 16 16 16 16 16 16 16 16(8) 8 16(8) 8 16(8) 8 8 8 16(8) 8 16(8) 8 8 16 8 Mnemonic ADPRES0 ADPRES1 ADPRES2 ADPRES3 ADPRES4 ADPRES5 ADPRES6 ADPRES7 ADCSETT00H ADCSET00H ADCSET01H ADPCLK0 ADPMOD00 ADPMOD01H ADCNE0 (L) ADCNE0H ADCNT0 ADCBASP0 ADMODSEL0 Register Name AD PMD Mode Result Register 0 AD PMD Mode Result Register 1 AD PMD Mode Result Register 2 AD PMD Mode Result Register 3 AD PMD Mode Result Register 4 AD PMD Mode Result Register 5 AD PMD Mode Result Register 6 AD PMD Mode Result Register 7 AD Input Timing Trigger Register 0 High (ADC0) AD Input Port Select Register 0 High (ADC0) AD Input Port Select Register 1 High (ADC0) AD PMD Mode Clock Control Register (ADC0) AD PMD Mode Control Register 0 (ADC0) AD PMD Mode Control Register 1 High (ADC0) A/D Count Enable Register (Low) (ADC0) A/D Count Enable Register High (ADC0) A/D Conversion Count Setting Register (ADC0) A/DPMD Mode Basic Setting Register (ADC0) AD Mode Control Register (ADC0)
ADCSETT00 (L) AD Input Timing Trigger Register 0 (Low) (ADC0) ADCSET00 (L) AD Input Port Select Register 0 (Low) (ADC0) ADCSET01 (L) AD Input Port Select Register 1 (Low) (ADC0)
ADPMOD01 (L) AD PMD Mode Control Register 1 (Low) (ADC0)
TMP19A71
13-3
TMP19A71
Table 13.2.3 ADC Register Map(3/3) PMD Mode (ADC1)
Address 0xFFFFCD80 0xFFFFCD84 0xFFFFCD88 0xFFFFCD8C 0xFFFFCD90 0xFFFFCD94 0xFFFFCD98 0xFFFFCD9C 0xFFFFCDA0 0xFFFFCDA4 0xFFFFCDA8 0xFFFFCDC0 0xFFFFCDC1 0xFFFFCDC4 0xFFFFCDC8 0xFFFFCDC9 0xFFFFCDCC 0xFFFFCDCD 0xFFFFCDD0 0xFFFFCDD1 0xFFFFCDD8 0xFFFFCDDC 0xFFFFCDE0 0xFFFFCDE1 0xFFFFCDE4 0xFFFFCDE5 0xFFFFCDE8 0xFFFFCDEC 0xFFFFCDF0 Bits 16 16 16 16 16 16 16 16 16 16 16 8 8 Mnemonic ADPRES8 ADPRES9 ADPRES10 ADPRES11 ADPRES12 ADPRES13 ADPRES14 ADPRES15 ADPRES16 ADPRES17 ADPRES18 ADCSETT10H ADCSETT11 Register Name AD PMD Mode Result Register 8 AD PMD Mode Result Register 9 AD PMD Mode Result Register 10 AD PMD Mode Result Register 11 AD PMD Mode Result Register 12 AD PMD Mode Result Register 13 AD PMD Mode Result Register 14 AD PMD Mode Result Register 15 AD PMD Mode Result Register 16 AD PMD Mode Result Register 17 AD PMD Mode Result Register 18 AD Input Timing Trigger Register 0 High (ADC1) AD Input Timing Trigger Register 1 (ADC1)
16(8) ADCSETT10 (L) AD Input Timing Trigger Register 0 (Low) (ADC1)
16(8) ADCSET10 (L) AD Input Port Select Register 0 (Low) (ADC1) 8 ADCSET10H AD Input Port Select Register 0 High (ADC1)
16(8) ADCSET11 (L) AD Input Port Select Register 1 (Low) (ADC1) 8 8 8 8 8 8 8 16 8 ADCSET11H ADCSET12H ADPCLK1 ADPMOD10 ADPMOD11H ADCNE1H ADCNT1 ADCBASP1 ADMODSEL1 AD Input Port Select Register 1 High (ADC1) AD Input Port Select Register 2 High (ADC1) AD PMD Mode Clock Control Register (ADC1) AD PMD Mode Control Register 0 (ADC1) AD PMD Mode Control Register 1 High (ADC1) A/D Counting Conversion Enable Register (Low) (ADC1) A/D Counting Conversion Enable Register High (ADC1) A/D Conversion Count Setting Register (ADC1) A/DPMD Mode Basic Setting Register (ADC1) AD Mode Control Register (ADC1) 16(8) ADCSET12 (L) AD Input Port Select Register 2 (Low) (ADC1)
16(8) ADPMOD11 (L) AD PMD Mode Control Register 1 (Low) (ADC1) 16(8) ADCNE1 (L)
Note 1: Some of 16-bit ADC registers is accessible in 8-bit system by dividing higher 8bits and lower 8 bits. i.e. ADNMOD0 becomes accessible in 8-bit system by making it be ADNMOD0L/ADNMOD0H.
TMP19A71
13-4
TMP19A71
The MODSEL bit in the ADMODSEL0 register is used to select either Normal mode (MODSEL = 0) or PMD mode (MODSEL = 1). Normal mode provides the AD monitor and highest-priority conversion features. PMD mode is synchronous to the trigger inputs from a programmable motor driver (PMD). In Normal mode, the two ADCs are basically functionally equivalent; in the following description any references to ADC0 also apply to ADC1.
AD Mode Control Register (ADC0) 7
Bit Symbol ADMODSEL0 (0xFFFF_CD70) Read/Write Reset Value Function 0
6
0
5
0
4
R/W 0
3
0
2
0
1
VREFON 0 VREF control 0: OFF 1: ON
0
MODSEL 0 ADC conversion mode 0: Normal mode 1: PMD mode
Note 1: The MDOSEL bit must not be changed during an AD conversion. If it is changed, operation cannot be guaranteed. Note 2: Registers other than those for the selected conversion mode must not be programmed. Before programming registers, the MODSEL bit must be programmed to select Normal or PMD mode. Note 3: The VREFON bit must be set 3 us before an AD conversion is started to ensure the stable internal reference voltage. If an AD conversion is started with VREFON= 0 or before the internal reference voltage has stabilized, conversion accuracy cannot be guaranteed. Note 4: The VREFON bit is automatically set to 1 after an AD conversion is started. However, conversion accuracy cannot be guaranteed until the reference voltage has stabilized (see Note 3).
TMP19A71
13-5
TMP19A71
13.3
Normal Mode (ADMODSEL0.MODSEL=0)
AD Normal Mode Control Register (Low) (ADC0) 7 6 3
ADCH R/W 0
Must be set to 0.
4
3
LAT
2
ITM 0
1
REP 0
0
SCAN 0
Channel scan mode 0:FixedChannel 1: Channel Scan
Bit Symbol ADNMOD0(L) (0xFFFF_C924) Read/Write Reset Value Function
0
0
0
0
Latency 0: None 1: Wait until the result register is read.
Analog input channel select
Interrupt in Continuous Fixedconversion Channel mode Continuous 0: Single Conversion 1: Continumode ous
Analog Input Channel Select
SCAN ADCH0 [2:0] 000 001 010 011 100 101 110 111 0 1 Interrupt in Fixed-Channel Continuous Conversion Mode Fixed-Channel Continuous Conversion Mode SCAN=0, REP=1 0 1 Generate an interrupt when a single conversion has been completed. Generate an interrupt when a sequence of four conversions has been completed. Fixed-Channel Mode Channel Scan Mode AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 AIN0 AIN0 to AIN1 AIN0 to AIN2 AIN0 to AIN3 AIN0 to AIN4 AIN0 to AIN5 AIN0 to AIN6 AIN0 to AIN7 In ADC1, the input channels correspond as follows: AIN0AIN8 AIN1AIN9 AIN2AIN10 AIN3AIN11 AIN4AIN12 AIN5AIN13 AIN6AIN14 AIN7AIN15 Note 1: AIN7 pin (AIN15 pin for ADC1) may be used as ADTRG0 input pin. Therefore, when ADTRG0 is used in ADNMOD0= "10", do not set to ADNMOD0="111," and when ADTRG1 is used in ADNMOD1="11," do not set to ADNMOD1="111." Note 2: ADNMOD0 setting becomes effective only when it is in Continuous Conversion mode. When ADNMOD 0="1" is set, the next conversion does not start until the reading of the register stored at the end is finished. For example, when ADNMOD0="101," ADNMOD0="1," ADNMOD0="1," and
ADNMOD0="1," the next conversion does not start until reading of the result for ADNRES5 after Channel Scan conversion has finished. When ADNRES5 is read prior to ADNRES0 - 4, the next conversion starts as ADNRES5 starts to be read. And, when ADNMOD0="101," ADNMOD0="1," ADNMOD0="1," ADNMOD0="1," and ADNMOD0="0," the next conversion does not start until the results are stored four times in ADNRES5 and are read out.
TMP19A71
13-6
TMP19A71
AD Normal Mode Control Register (High) (ADC0) 15
(ADNMOD0H) Bit Symbol (0xFFFF_C925) Read/Write Reset Value Function 0
14
R 0
13
0
12
0 Must be set to 0.
11
0 Must be set to 0.
10
TRGE R/W 0 Normal mode conversion trigger 0: Software 1: Hardware
9
TSEL
8
0 0 Hardware trigger source 00: Reserved 01: INTTBCOM11 10: ADTRG0 11: ADTRG1
Note 1: When ="1" is set, too, it can be started up by software. Note 2: ADC1 also can select INTTBCOM11 as a hardware starting source by setting ADNMOD1=01.
AD Software Start Register (ADC0) 7
ADCSTART0 bit Symbol (0xFFFF_C940) Read/Write Reset Value Function BUSY R 0
Normal mode AD conversion busy flag 0: Idle 1: Busy
6
EOS R/W 0
Conversion Complete flag 0: Don't care 1:Completed Write a 0 to clear this bit.
5
0
4
0
3
R 0
2
0
1
0
0
ADSFT W 0
AD conversion start 0:Don't care 1:Start This bit is always read as 0.
Note: The BUSY bit indicates whether or not an AD conversion is in progress. Use the EOS bit to check whether or not an AD conversion has completed.
A/D Normal Mode Basic Setting Register (ADC0) 7
ADCBASN0 (0xFFFF_C93C) Bit Symbol Read/Write Reset Value Function 0 Must be set to 0. 0 Must be set to 0. 0 Must be set to 0. 0 Must be set to 0.
6
5
4
R/W
3
0 Must be set to 0.
2
AZSEL
1
0
0 Must be set to 0.
0 0 Must be Sample set to 0. Hold time 1: 6 clocks 0: 12 clocks
15
Bit Symbol Read/Write Reset Value Function 0 Must be set to 0.
14
0 Must be set to 0.
13
0 Must be set to 0.
12
R/W 1 Must be set to 1.
11
0 Must be set to 0.
10
0 Must be set to 0.
9
0 Must be set to 0.
8
0 Must be set to 0.
Note: The time taken for the conversion of ADC is derived from the equation, (the number of clocks selected in 27 clocks)/ADCLK.
TMP19A71
13-7
TMP19A71
Highest-Priority Conversion Control Register (ADC0) 7
Bit Symbol ADCHPC0 (0xFFFF_C930) Read/Write Reset Value Function 0
6
R 0
5
0
4
HBSY 0
HighestPriority AD conversion busy flag 0: Completed 1: Busy
3
HPRQ
2
R/W
1
HPCH
0
0
HighestPriority conversion request 0: Don't care 1: Start highestpriority conversion
0
0
0
Highest-priority channel select
Highest-Priority Analog Input Channel Select SCAN ADCH [2:0] 000 001 010 011 100 101 110 111 0 Fixed-Channel Mode AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 In ADC1, the input channels correspond as follows: AIN0AIN8 AIN1AIN9 AIN2AIN10 AIN3AIN11 AIN4AIN12 AIN5AIN13 AIN6AIN14 AIN7AIN15
Note: AIN7 pin (AIN15 pin for ADC1) may be used as ADTRG0 input pin. Therefore, when ADTRG0 is used in ADNMOD0= "10," do not set to ADNMOD0="111," and when ADTRG1 is used in ADNMOD1="11," do not set to ADNMOD1="111."
TMP19A71
13-8
TMP19A71
There are 16 conversion result registers numbered from 0 to 15, which are all identical. The following is a description of register 0. AD Normal Mode Conversion Result Register 0
7 ADNRES0 (0xFFFF_C91C) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 0 0 Conversio Overrun flag n result store flag 0: No 1: Stored overrun 1: Overrun 0 0 VAL 14 OVR 0 0 0 13 0 12 R 0 0 0 conversion result 0 Upper 2 bits of an AD 6 5 4 ADR R 0 11 0 10 0 9 ADR 0 8 Lower 8 bits of an AD conversion result 3 2 1 0
Note 1: This register must be accessed as a 16-bit or larger quantity. If it is accessed as an 8-bit quantity, operation cannot be guaranteed. Note 2: Bit 15 is an AD conversion result flag ADNRES0. 1 is set to this when AD conversion value is stored, and it is cleared to 0 when the ADNRES0 is read. Note 3: Bit 14 is an Overrun flag ADNRES0. 1 is set to this when it is overwritten before reading the conversion result register ADNRES0. This bit is cleared to 0 when a new conversion result is stored in ADNRES0 with VAL=0. Note 4: This register does not support bit manipulation instructions.
Highest-Priority Conversion Result Register (ADC0)
7 ADCHPR0 (0xFFFF_C9020) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 0 0 Conversion Overrun result store flag 0: No flag overrun 1: Stored 1: Overrun 0 0 VAL 14 OVR Lower 8 bits of an AD conversion result 13 12 R 0 0 0 conversion result 0 Upper 2 bits of an AD 11 10 9 ADR 8 0 0 0 0 6 5 4 ADR R 0 0 0 0 3 2 1 0
Note 1: This register must be accessed as a 16-bit or larger quantity. If it is accessed as an 8-bit quantity, operation cannot be guaranteed. Note 2: Bit 15 is an AD conversion result flag ADNRES0. 1 is set to this when AD conversion value is stored, and it is cleared to 0 when the ADNRES0 is read. Note 3: Bit 14 is an Overrun flag ADNRES0. 1 is set to this when it is overwritten before reading the conversion result register ADNRES0. This bit is cleared to 0 when a new conversion result is stored in ADNRES0 with VAL=0. Note 4: This register does not support bit manipulation instructions.
TMP19A71
13-9
TMP19A71
AD Normal Mode Clock Control Register 1 7
ADNCLK0 (0xFFFF_C928) Bit Symbol Read/Write Reset Value Function 0 0
6
5
R 0
4
0
3
0
2
1
ADCCK R/W
0
0 0 0 Prescaler clock output select 001: IMCLK/2 010: IMCLK/4 011: IMCLK/8 100: IMCLK/16 Other: IMCLK
Note 1: AD conversion is performed at the clock frequency selected in this register. To assure conversion accuracy, however, the conversion clock frequency must be 14 MHz or slower (which results in a conversion time of 2.36 s or longer with 6-clock sample hold). Note 2: The conversion clock must not be changed while AD conversion is in progress. Wait at least 2 ADCLK clocks after AD conversion has completed before changing the conversion clock.
ADCCK IMCLK /2 /4 /8 /16
ADCLK0 (AD Conversion Clock)
Figure 13.3.1 Clock Control Circuit
TMP19A71
13-10
TMP19A71
A/D Monitor Control Register (ADC0)
7 Bt Symbol CMPCTL0(L) (0xFFFF_C92C) Read/Write Reset Value Function R 0 0 6 5 4 CMCH0 3 R/W 0 0 0 0 0 0 AD input channel 0 to be compared A/D Monitor A/D Monitor A/D Monitor
Interrupt setting is 0. 0:Under Compare Register 1: More than Compare Register Interrupt setting is 0. 0: disable 1: enable Interrupt flag is 0. 0:Monitoring Non-generated interrupt 1:Monitoring Generated Interrupt
2 CMOP0
1 IRQEN0
0 CMCAP0
AD Input Channel To Be Compared CNCH 000 001 010 011 100 101 110 111 AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 In ADC1, the input channels correspond as follows: AIN0AIN8 AIN1AIN9 AIN2AIN10 AIN3AIN11 AIN4AIN12 AIN5AIN13 AIN6AIN14 AIN7AIN15
AD Monitor Control Register (ADC0)
15 (CMPCTL0H) (0xFFFF_C92D) Bit Symbol Read/Write Reset Value Function 0 R 0 14 13 12 CMCH1 11 R/W 0 0 0 0 0 0 AD input channel 1 to be compared A/D Monitor A/D Monitor A/D Monitor
Interrupt setting is 1. 0:Under Compare Register 1: More than Compare Register Interrupt setting is 1.
0: disable 1: enable
10 CMOP1
9 IRQEN1
8 CMCAP1
Interrupt flag is 1. 0:Monitoring Non-generated interrupt 1:Monitoring Generated Interrupt
AD Input Channel To Be Compared CNCH 000 001 010 011 100 101 110 111 AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7
In ADC1, the input channels correspond as follows: AIN0AIN8 AIN1AIN9 AIN2AIN10 AIN3AIN11 AIN4AIN12 AIN5AIN13 AIN6AIN14 AIN7AIN15
TMP19A71
13-11
TMP19A71
Note: CMCAPx is cleared to 0 by writing data in "1" or in ADCMPxx. Because interrupt requests are continuously sent until this register is cleared, it must be cleared within the Monitor Interrupt routine.
TMP19A71
13-12
TMP19A71
A/D Conversion Result Compare Register (ADC0)
7 ADCMP00 (0xFFFF_C934) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 0 0 0 14 0 0 6 5 4 ADR0 R/W 0 0 0 0 A/D conversion result compare value 0 is stored. 13 R 0 0 0 0 0 12 11 10 0 9 ADR0 0 8 3 2 1 0
A/D Conversion Result Compare Register (ADC0)
7 ADCMP01 (0xFFFF_C938) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function 0 0 0 14 0 0 6 5 4 ADR1 R/W 0 0 0 0 A/D conversion result compare value 1 is stored. 13 R 0 0 0 0 0 12 11 10 0 9 ADR1 0 8 3 2 1 0
TMP19A71
13-13
TMP19A71 13.4.1 13.4.1.1 Operation (Normal Mode) Analog Reference Voltage
Clearing the VREFON bit in the ADMODSEL0 turns off the switch between the VREFH and FREFL pins. Once the VREFON bit is cleared, the internal reference voltage requires a recovery time of 3 s to stabilize after the VREFON bit is again set to 1. Before starting an AD conversion, therefore, be sure to wait for 3 s after setting the VREFON bit to 1. If an AD conversion is started before this stabilization period has elapsed, conversion accuracy cannot be guaranteed.
13.4.1.2
Selecting an Analog Input Channel(s)
Selection of the analog input channel(s) to be used varies according to the operating mode of the AD converter. (1) Normal AD Conversion * When an analog input is used in Channel Fixed mode (ADNMOD0="0") Among the analog input from AIN0 to AIN 7, select one channel according to the ADNMOD0 setting. * When an analog input is used in Channel Scan mode (ADNMOD0="1") Select one Scan mode among the eight types Scan modes according to the ADNMOD0 setting. (2) Highest Priority AD Conversion Among the analog input from AIN0 to AIN 7, select one channel according to the A/DCHPC0 setting. After resetting, ADNMOD0 is initialized to 0, and ADNMOD0to 0000, which makes the selection be in processing, and Channel Fixed mode input of AIN0 pin is selected. Note that pins not used as analog input channels can be used as normal ports (a part of them are for input only), however, the conversion accuracy may get worse. When the highest-priority AD conversion is started during the normal AD conversion, the highest-priority one starts in a break, the normal AD conversion resumes at the end of the highest-priority one is over. Example: When the highest-priority conversion of AIN7 is started in ADCHP0=111 during the Continuous Scan conversion of the Channel from AIN0 to AIN3 in ADNMOD0=11 and ADNMOD0=00011.
Highest-priority AD Conversion Startup (Software Startup) Conversion CH Ch0 Ch1 Ch2 Ch7 Ch3 Ch0 Ch1
TMP19A71
13-14
TMP19A71
13.3.1.1
Starting of AD Conversion
AD conversion has two types; Normal AD conversion and Highest-Priority AD conversion. A Normal AD conversion starts up in software by setting 1 to ADCSTART0. Also, the Highest-Priority conversion starts up in software by setting 1 to ADCHPC0. A For Normal AD conversion, one operating mode among the four operating modes specified by ADNMOD0. An operating mode of the Highest-Priority conversion is Channel-Fixed Single conversion only. A Normal AD conversion can start up with hardware starting source selected by ADNMOD0 by setting 1 to ADNMOD0. When this bit is "10/11," a Normal AD conversion starts up at the rising edge of ADTRG0 pin, and when "01," it starts up with INTTBCOM11 of the timer from 16-bit quantity. It can start in software even if the startup in hardware becomes enabled. When a Normal AD conversion starts, 1 is set to an AD conversion Busy flag (ADCSTART0) indicating that the conversion is in progress. When the Highest-Priority AD conversion starts, 1 is set to an AD conversion Busy flag (ADCHPC0). At this time, a Busy flag for Normal AD conversion retains the value before a starting of the Highest-Priority AD conversion. A conversion end flag ADCSTART0 for Normal AD conversion, also, retains the value before a starting of the Highest-Priority AD conversion. Since ADCSTART0 is a flag showing the conversion operation, it has an interval of being 0 between the conversions such as those in the Continuous conversion mode. When palling the end of conversion, ADCSTART0 must not be used. When 1 is set to ADCHPC0 during a Normal AD conversion, the Highest-Priority AD conversion starts upon the storage of result register of the ongoing conversion, and AD conversion (Channel-Fixed Single conversion) of the cannel specified by ADCHPC0 starts. When this result is stored in the result register ADCHPR0, a Normal AD conversion resumes operation from the part suspended.
13.3.1.2
Restart
A Normal AD conversion restarts when 1 is set to ADCSTART0 during the Channel-Fixed Normal Conversion, or it is started with hardware source. At the time of restarting, a Normal AD conversion performed till then starts conversion after a lapse of conversion time, however, the result that has been converted at the moment of restarting is not stored. Restarting does clear neither the flags of nor .
Note 1: When Continuous conversion is in process, stop it first (ADNMOD0=0) and restart after all of the conversions ended. Note 2: When Channel Scan mode conversion is in process, restart after all of the conversions ended.
13.3.1.3
Stop Repeat
Changing the ADNMOD0 bit in from 1 to 0 enables the stop of repeating after the Continuous conversion made one-cycle repeat. In Channel-Fixed Continuous conversion mode (interrupts after four conversions), as an interrupt generates after conversion is performed four times, the Continuous conversion stops. In Channel Scan Continuous conversion mode, after the conversions performed as much as specified number of channels, the Continuous conversion stops as an interrupt is generated.
TMP19A71
13-15
TMP19A71
13.3.1.4
AD Conversion Mode and Interrupt in the End of AD Conversion
The normal mode has the four operating modes shown in Table 13.3.1. Normal AD Conversion can select a mode according to the ADNMOD0 setting while the Highest-Priority AD conversion can select only Channel-Fixed single conversion regardless of the ADNMOD0 setting.
Table 13.3.1 Relations of AD Conversion Mode, Interrupt Generation Timing, and Flag Behavior
Conversion Mode Interrupt Generation Timing EOS Set Timing (Note 1) BUSY (after an interrupt has generated) Fixed-Channel Single Conversion Channel Scan Single Conversion Fixed-Channel Continuous Conversion After a conversion ends After a Scan conversion ends Every time of conversion Every fur times of conversion Channel Scan Continuous Conversion Note 1: Write 0 and clear EOS. Every time of Scan conversion After a conversion ends After a Scan conversion ends After a conversion ends. After a conversion ends four times After a Scan conversion ends. 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 ITM ADNMOD0 REP SCAN
(1) Normal AD Conversion ADNMOD0 selects an operating mode. As an AD conversion starts, 1 is set to ADCSTART0. After a specified AD conversion ends, 1 is set to ADCSTART0 that indicates the AD conversion ended, and then an AD conversion end interrupt (INTAD0) generates. is cleared to 0 as is set when ="0." There are timings to be 0 at the intervals of each channel conversion when ="1." a) Fixed-Channel Single Conversion Mode This mode is selected by programming the REP and SCAN bits in the ADNMOD0 register to 00. In this mode, the ADC performs a single conversion on a single selected channel. When a conversion is completed, the ADC sets 1 to the ADCSTART0.EOS bit, clears the ADCSTART0.BUSY bit in 0 and generates the INTAD0 interrupt. The EOS bit must be cleared by writing 0. b) Channel Scan Single Conversion Mode This mode is selected by programming the REP and SCAN bits in the ADNMOD0 register to 01. In this mode, the ADC performs a single conversion on each selected group of channels. When a single conversion sequence is completed, the ADC sets 1 to the ADCSTART0.EOS bit, clears the ADCSTART0.BUSY bit in 0 and generates the INTAD0 interrupt. The EOS bit must be cleared by writing 0.
TMP19A71
13-16
TMP19A71
c) Fixed-Channel Continuous Conversion Mode This mode is selected by programming the REP and SCAN bits in the ADNMOD0 register to 10. In this mode, the ADC repeatedly converts a single selected channel. When a conversion process is completed, the ADC sets 1 to the ADCSTART0.EOS bit. A generation timing of an interrupt request is selectable according to the ADNMOD0 setting. The setting timing of EOS is associated with the timing of an interrupt. The EOS bit must be cleared by writing 0. When ITM=0, the ADC generates an interrupt request every time a conversion ends. In this case, the conversion result is stored in the corresponding conversion result register to a selected channel, which makes 1 be set to the EOS bit. When ITM=1, the ADC generates an interrupt after every four conversions completed. The conversion result is stored in the corresponding conversion result register to a selected channel. After the result of the fourth conversion is stored, 1 is set to the EOS bit. And then, a conversion starts again. The EOS bit must be cleared by writing 0. ADNMOD0 setting can make the next conversion of the conversion in Continuous conversion mode wait until the result register is read. When ITM=0, the time taken until a conversion starts after a previous conversion ends is controlled, and when ITM=1, the time taken until a conversion starts after previous conversion ends four times is controlled. d) Channel Scan Continuous Conversion Mode This mode is selected by programming the REP and SCAN bits in the ADNMOD0 register to 11. In this mode, the ADC repeatedly converts the selected group of channels. Every time a Scan conversion ends, 1 is set to ADNMOD0, and an interrupt request of INTAD0 generates. ADNMOD0 has a timing that becomes 0 at the interval of each channel conversion. The EOS bit must be cleared by writing 0. To stop the operation of conversion of Continuous conversion modes, described in c) and d), 0 shall be written to ADNMOD0. The mode ends as an ongoing conversion ends, and ADNMOD0 is cleared to 0. Stop AD conversions and set 0 to ADMODSEL0 before transferring to a Stop mode. The electricity is carried even it is in the Stop mode unless the transfer is made stopping a conversion. If the transfer is made with an AD conversion in performing, the result come out after the releasing of the Stop mode is not guaranteed. (2) The Highest-Priority AD Conversion ADNMOD0 setting has no effect on the Highest-Priority AD conversion. Its operation mode is Channel-Fixed Single conversion mode only. When the starting condition is met, the Highest-Priority AD conversion of a specified channel in ADCHPC0 is performed only one time. As the conversion ends, an interrupt of the Highest-Priority AD conversion end generates, and ADCHPC0 is cleared to 0.
TMP19A71
13-17
TMP19A71
13.3.1.5 Highest-Priority Conversion Mode The Highest-Priority AD conversion can interrupt a Normal AD conversion. The Highest-Priority AD conversion can start by setting 1 to ADCHPC0. If the Highest-Priority AD conversion starts during the Normal AD conversion, AD conversion result during the conversion process is stored in a result register, and after that, a channel specified by ADCHPC0is single-converted. That result is stored in ADCHPR0, and the Highest-Priority AD conversion interrupt generates. Then, the Normal AD conversion resumes from the part continued from the previous time. If the Highest-Priority AD conversion restarts during the Highest-Priority AD conversion process, the conversion in process is finished, and then the Highest-Priority Conversion starts newly. For example, if the Continuous conversion of the channels from AIN0 to AIN7 is active, and 1 is set to while AIN3 is converted, the channel specified by is converted as soon as the AIN3 conversion ends, and the result is stored in ADCHPR0, and then the Continuous conversion restarts from AIN4. 13.3.1.6 AD Monitoring Each AD converter has two AD monitoring functions and can compare a conversion value and two setting value simultaneously. When 1 is set to CMPCTL0, an AD monitoring is enabled. When the contents of a conversion result register specified by CMPCTL0 is more than or under the value of compare register (it is specified by ), AD monitoring interrupt (INTADM0) generates. CMPCTL0 can determine which setting condition is met. Also, this comparing operates every time a result is stored in the relevant conversion result register, and as the condition is met, an interrupt generates. Note that since a register assigned to AD monitoring is not read in software in general, the overrun flag ADNRES0 and the conversion result flag ADNRES0 are always set. Therefore, to use the AD monitoring, do not use the flag of a relevant conversion result register. 13.3.1.7 AD Conversion Time One AD conversion takes 27 clocks excluding sampling clocks. In ADCBASN0,6 or 12 clocks can be selected as sampling clocks, thus the sum of AD conversion clocks may be 33 or 39. ADNCLK0 selects an AD conversion clocks among the AD pre-scaler output; IMCLK, IMCLK/2, IMCLK/4, IMCLK/8, and IMCLK/16.To assure the accuracy, it is necessary to set the AD conversion clock less than 14MHz, i.e. under 2.36s (if Sample Hold is 6 clocks). 13.3.1.8 Storage and Read of AD Conversion Result AD conversion results are stored in the result register of a Normal AD conversion (from ADNRES0 to ADNRES7). Correspondence of result registers and analog input channels are the same in any operating mode if they are in normal mode. For example, the result of AIN0 conversion is always stored in the ADNRES0 register. Table 13.3.2 shows the correspondence of analog input channels and AD conversion result registers.
TMP19A71
13-18
TMP19A71
Table 13.3.2 Analog Input Channel and AD Conversion Register
Analog Input Channel AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 Conversion Result Register ADNRES0 ADNRES1 ADNRES2 ADNRES3 ADNRES4 ADNRES5 ADNRES6 ADNRES7
13.3.1.9
Data Polling To process an AD conversion result by polling data without using any interrupt, ADNMOD0 is to be polled. When this flag is set, a conversion result is stored in a predetermined AD conversion result register. Therefore AD conversion result register must be read after checking the set. To detect an overrun at the time, the conversion result register must be read in 16-bit system. If the result were =0 and =1, a conversion result not overwritten would be gained.
TMP19A71
13-19
TMP19A71
13.4.1
PMD Mode (MODSEL=1)
In PMD mode, the ADC performs AD conversions synchronous to a PMD trigger. The PMD trigger can be selected from three types: PMDTRG00 to PMDTRG02. The ADC0 has 8 conversion result registers while the ADC1 has 11 conversion result registers. For each of these result registers, an analog input port and a PMD trigger can be programmed separately, and AD conversions can be enabled and disabled separately for each register. Also, each of ADC unit has a counter, and the two cycles; every time and the specified number can be set to the counter. As all the programs enabled are converted completely, an ADC interrupt generates.
AD Input Timing Trigger Register (ADC0) 7
ADCSETTOO(L) Bit Symbol (0xFFFF_CD40) Read/Write Reset Value Function ADST3
6
5
ADST2
4
R/W
3
ADST1
2
1
ADST0
0
0 0 0 0 Input timing trigger for Input timing trigger for result register 2 result register 3 00: PMDTRG00 00: PMDTRG00 01: PMDTRG01 01: PMDTRG01 10: PMDTRG02 10: PMDTRG02 11: Reserved 11: Reserved
0 0 Input timing trigger for result register 1 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
0 0 Input timing trigger for result register 0 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
15
(ADCSETTOOH) Bit Symbol (0xFFFF_CD41) Read/Write Reset Value Function ADST7
14
13
ADST6
12
R/W
11
ADST5
10
9
ADST4
8
0 0 Input timing trigger for result register 7 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
0 0 Input timing trigger for result register 6 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
0 0 Input timing trigger for result register 5 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
0 0 Input timing trigger for result register 4 00: PMDTRG00 01: PMDTRG01 10: PMDTRG02 11: Reserved
TMP19A71
13-20
TMP19A71
AD Input Timing Trigger Register 0 (ADC1) 7
ADCSETT1O(L) Bit Symbol (0xFFFF_CDC0) Read/Write Reset Value Function ADST11 0 0 Input timing trigger for result register 11 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
6
5
ADST10
4
R/W
3
ADST9
2
1
ADST8
0
0 0 Input timing trigger for result register 10 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing triffer for result register 9 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing triffer for result register 8 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
15
(ADCSETT1OH) Bit Symbol (0xFFFF_CDC1) Read/Write Reset Value Function ADST15
14
13
12
ADST14 R/W
11
ADST13
10
9
ADST12
8
0 0 Input timing trigger for result register 15 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing trigger for result register 14 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing trigger for result register 13 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing triggr for result register 12 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
AD Input Timing Trigger Register 1(ADC1) 7
Bit Symbol ADCSETT11 (0xFFFF_CDC4) Read/Write Reset Value Function 0
6
0
5
ADST18
4
R/W
3
ADST17
2
1
ADST16
0
0 0 Input timing trigger for result register 10 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing trigger for result register 9 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
0 0 Input timing trigger for result register 8 00: PMDTRG10 01: PMDTRG11 10: PMDTRG12 11: Reserved
TMP19A71
13-21
TMP19A71
AD Input Port Select Register 0 (ADC0) 7
ADCSET0O(L) Bit Symbol (0xFFFF_CD48) Read/Write Reset Value Function 0 Must be written as 0.
6
5
ADSI1
4
R/W
3
0 Must be written as 0.
2
1
ADSI0
0
0 0 0 Input port for result register 1 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
0 0 0 Input port for result register 0 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
15
(ADCSET0OH) Bit Symbol (0xFFFF_CD49) Read/Write Reset Value Function 0 Must be written as 0.
14
13
ADSI3
12
R/W
11
0 Must be written as 0.
10
9
ADSI2
8
0 0 0 Input port for result register 3 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
0 0 0 Input port for result register 2 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
AD Input Port Select Register 1 (ADC0) 7
Bit Symbol ADCSET01(L) (0xFFFF_CD4C) Read/Write Reset Value Function 0 Must be written as 0.
6
5
ADSI5
4
R/W
3
0 Must be written as 0.
2
1
ADSI4
0
0 0 0 Input port for result register 5. 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
0 0 0 Input port for result register 4 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
15
Bit Symbol (ADCSET01H) (0xFFFF_CD4D) Read/Write Reset Value Function 0 Must be written as 0.
14
13
ADSI7
12
R/W
11
0 Must be written as 0.
10
9
ADSI6
8
0 0 0 Input port for result register 7 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
0 0 0 Input port for result register 6 000: AIN0 001: AIN1 010: AIN2 011: AIN3 100: AIN4 101: AIN5 110: AIN6 111: AIN7
TMP19A71
13-22
TMP19A71
AD Input Port Select Register 0(ADC1) 7
Bit Symbol ADCSET1O(L) (0xFFFF_CDC8) Read/Write Reset Value Function
6
ADSI9
5
4
R/W
3
2
ADSI8
1
0
0 0 0 Input port for result register 9 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
0 0 0 Input port for result register 8 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
(ADCSET1OH) (0xFFFF_CDC9)
15
Bit Symbol Read/Write Reset Value Function
14
ADSI11
13
12
R/W
11
10
ADSI10
9
8
0 0 0 Input port for result register 11 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
0 0 0 Input port for result register 10 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
TMP19A71
13-23
TMP19A71
AD Input Port Select Register 1 (ADC1) 7
ADCSET11(L) (0xFFFF_CDCC) Bit Symbol Read/Write Reset Value Function 0 0 0 Input port for result register 13 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved 0
6
ADSI13
5
4
R/W
3
2
ADSI12
1
0
0 0 0 Input port for result register 12 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
15
(ADCSET11H) (0xFFFF_CDCD) Bit Symbol Read/Write Reset Value Function
14
ADSI15
13
12
R/W
11
10
ADSI14
9
8
0 0 0 Input port for result register 15 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
0 0 0 Input port for result register 14 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
TMP19A71
13-24
TMP19A71
AD Input Port Select Register 2 (ADC1) 7
ADCSET12(L) (0xFFFF_CDD0) Bit Symbol Read/Write Reset Value Function 0 0 0 Input port for result register 17 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved 0
6
ADSI17
5
4
R/W
3
2
ADSI16
1
0
0 0 0 Input port for result register 16 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
15
(ADCSET12H) (0xFFFF_CDD1) Bit Symbol Read/Write Reset Value Function 0
14
0
13
0
12
R/W 0
11
10
ADSI18
9
8
0 0 0 Input port for result register 18 0000: AIN8 0001: AIN9 0010: AIN10 0011: AIN11 0100: AIN12 0101: AIN13 0110: AIN14 0111: AIN15 1000: AIN16 1001: AIN17 1010: AIN18 Other: Reserved
0
TMP19A71
13-25
TMP19A71
AD PMD Mode Control Register 0 (ADC0) 7
ADPMOD00 (0xFFFF_CD5C) Bit Symbol Read/Write Reset Value Function 0
Conversion Complete flag 0: Completed 1: In progress or not started yet
6
0
5
0
4
R 0
3
0
2
0
1
0
0
ADEN0 R/W 0
AD conversion 0: Disable 1: Enable
ADF0
(ADPMOD10 used by ADC1 also applies to these contents.)
Note 1: must be 1 as the starting condition, and it becomes 0 when all the conversions enabled are completed. Note 2: If 0 is set to =0 while the conversion is in progress, the value is set to the result register after the ongoing channel conversion ends, and the operation stops. The next conversion starts not from the part where it stopped but from a channel of the very beginning.
TMP19A71
13-26
TMP19A71
AD PMD Mode Control Register 1 (used in ADC0) 7
ADPMOD01(L) Bit Symbol (0xFFFF_CD60) Read/Write Reset Value Function ADPE7 0 Result register 7 enable 0: Disable 1: Enable
6
ADPE6 0 Result register 6 enable 0: Disable 1: Enable
5
ADPE5 0 Result register 5 enable 0: Disable 1: Enable
4
ADPE4 R/W 0 Result register 4 enable 0: Disable 1: Enable
3
ADPE3 0 Result register 3 enable 0: Disable 1: Enable
2
ADPE2 0 Result register 2 enable 0: Disable 1: Enable
1
ADPE1 0 Result register 1 enable 0: Disable 1: Enable
0
ADPE0 0 Result register 0 enable 0: Disable 1: Enable
15
(ADPMOD01H) Bit Symbol (0xFFFF_CD61) Read/Write Reset Value Function 0 Must be written as 0.
14
0 Must be written as 0.
13
0 Must be written as 0.
12
R/W 0 Must be written as 0.
11
0 Must be written as 0.
10
0 Must be written as 0.
9
0 Must be written as 0.
8
0 Must be written as 0.
AD PMD Mode Control Register 1 (used in ADC1) 7
Bit Symbol ADPMOD11(L) (0xFFFF_CDE0) Read/Write Reset Value Function ADPE15 0 Result register 15 enable 0: Disable 1: Enable
6
ADPE14 0 Result register 14 enable 0: Disable 1: Enable
5
ADPE13 0 Result register 13 enable 0: Disable 1: Enable
4
ADPE12 0 Result register 12 enable 0: Disable 1: Enable R/W
3
ADPE11 0 Result register 11 enable 0: Disable 1: Enable
2
ADPE10 0 Result register 10 enable 0: Disable 1: Enable
1
ADPE9 0 Result register 9 enable 0: Disable 1: Enable
0
ADPE8 0 Result register 8 enable 0: Disable 1: Enable
15
Bit Symbol (ADPMOD11H) (0xFFFF_CDE1) Read/Write Reset Value Function 0 Must be written as 0.
14
0 Must be written as 0.
13
0 Must be written as 0.
12
R/W 0 Must be written as 0.
11
0 Must be written as 0.
10
ADPE18 0 Result register 18 enable 0: Disable 1: Enable
9
ADPE17 0 Result register 17 enable 0: Disable 1: Enable
8
ADPE16 0 Result register 16 enable 0: Disable 1: Enable
TMP19A71
13-27
TMP19A71
AD Count Enable Register 0 7
ADCNE0(L) Bit Symbol (0xFFFF_CD64) Read/Write Reset Value Function ADCNE7 0 Convert the conversion register 7 after the count 0:Always enable 1:Enable after the count
6
ADCNE6 0 Convert the conversion register 6 after the count 0:Always enable 1:Enable after the count
5
ADCNE5 0 Convert the conversion register 5 after the count 0:Always enable 1:Enable after the count
4
ADCNE4 0 Convert the conversion register 4 after the count 0:Always enable 1:Enable after the count R/W
3
ADCNE3 0 Convert the conversion register 3 after the count 0:Always enable 1:Enable after the count
2
ADCNE2 0 Convert the conversion register 2 after the count 0:Always enable 1:Enable after the count
1
ADCNE1 0 Convert the conversion register 1 after the count 0:Always enable 1:Enable after the count
0
ADCNE0 0 Convert the conversion register 0 after the count 0:Always enable 1:Enable after the count
(ADCNE0H) (0xFFFF_CD65)
15
Bit Symbol Read/Write Reset Value Function 0
14
0
13
0
12
R/W 0
11
0
10
0
9
0
8
0
AD Count Enable Register 1 7
ADCNE1(L) (0xFFFF_CDE4) Bit Symbol Read/Write Reset Value Function 0 Convert the conversion register 15 after the count 0:Always enable 1:Enable after the count 0 Convert the conversion register 14 after the count 0:Always enable 1:Enable after the count 0 Convert the conversion register 13 after the count 0:Always enable 1:Enable after the count ADCNE15
6
ADCNE14
5
ADCNE13
4
ADCNE12 0 Convert the conversion register 12 after the count 0:Always enable 1:Enable after the count R/W
3
ADCNE11 0 Convert the conversion register 11 after the count 0:Always enable 1:Enable after the count
2
ADCNE10 0 Convert the conversion register 10 after the count 0:Always enable 1:Enable after the count
1
ADCNE9 0 Convert the conversion register 9 after the count 0:Always enable 1:Enable after the count
0
ADCNE8 0 Convert the conversion register 8 after the count 0:Always enable 1:Enable after the count
ADCNE1(H) (0xFFFF_CDE5)
15
Bit Symbol Read/Write Reset Value Function 0
14
0
13
0
12
R/W 0
11
0
10
ADCNE18 0 Convert the conversion register 18 after the count 0:Always enable 1:Enable after the count
9
ADCNE17 0 Convert the conversion register 17 after the count 0:Always enable 1:Enable after the count
8
ADCNE16 0 Convert the conversion register 16 after the count 0:Always enable 1:Enable after the count
Note 1: At least one channel must always be converted in the unit ADC1. If all the channels are converted after counting, the conversion is not skipped properly.
TMP19A71
13-28
TMP19A71
AD Conversion Count Setting Register 0 (used in ADC0) 7
Bit Symbol ADCNT0 (0xFFFF_CD68) Read/Write Reset Value Function 0 0 0 0
6
5
4
CMPCNT R/W
3
2
1
0
0
0
0
0
When the cycle value becomes the same value as the value set here, a channel set after counting is also converted.
(ADCNT1 used by ADC1 applies to these contents.) Example of Actual Operation Setting ADPMOD01="1011_0111" ADCNE0 ="1111_0000" ADCNT0 ="0000_1111"
: Conversion Enabled(CH0,1,2,4,5,7) : Always Convert (CH0,1,2,3) or after counting (CH4,5,6,7) : Count Value(16 counts)
Note 1: These are premised on that the amount of PMDTRG capable of converting all the channels within a certain cycle is available.
A channel changes from CH0 to CH1, and CH1 to CH2, then INTAD0 generates. The count value decrements by one. Goes to the step 1) if the count value is not 0, and to 4) if the value is 0 (after 16 cycles of conversion). A channel changes from CH0 to CH1, CH1 to CH2, and so on till becomes CH7, then INTAD0 generates. 5) Loads the register value set as count set value. 6) Goes back to the step 1).
1) 2) 3) 4)
AD PMD Mode Basic Setting Register (ADC0) 7
Bit Symbol ADCBASP0 (0xFFFF_CD6C) Read/Write Reset Value Function 0 Must be written as 0.
6
0 Must be written as 0.
5
0 Must be written as 0.
4
R/W 0 Must be written as 0.
3
0 Must be written as 0.
2
AZSEL 0 Sample hold time
1:6 clocks 0:12 clocks
1
0 Must be written as 0.
0
0 Must be written as 0.
15
Bit Symbol Read/Write Reset Value Function 0 Must be written as 0.
14
0 Must be written as 0.
13
0 Must be written as 0.
12
R/W 1 Must be written as 1.
11
0 Must be written as 0.
10
0 Must be written as 0.
9
0 Must be written as 0.
8
0 Must be written as 0.
(ADCBASP1 used by ADC1 applies to these contents.)
Note 1: The conversion time of ADC is derived from the equation; (the number of clocks selected in 27 clocks)/ADCLK.
TMP19A71
13-29
TMP19A71
AD PMD Mode Clock Control Register 0 (used by ADC0) 7
Bit Symbol ADPCLK0 (0xFFFF_CD58) Read/Write Reset Value Function 0
6
0
5
R 0
4
0
3
0
2
1
ADPCK R/W
0
0 0 0 Prescaler clock output select 000: IMCLK 001: IMCLK /2 010: IMCLK /4 011: IMCLK /8 100: IMCLK /16 101: fsys Other: Reserved
(ADPCLK1 used by ADC1 applies to these contents.)
Note 1: ADC conversions are executed with clocks selected by above-mentioned registers. To guarantee the accuracy, it is necessary to select a conversion clock to make the conversion time less than 36 s (less than 14 MHz in an AD clock). Note 2: A conversion clock must not be changed during an AD conversion in progress. More than two clocks of ADCLK after the conversion stops, it must be changed.
ADPCK0 IMCLK /2 /4 /8 /16
ADCLK
(Clock for AD Conversion)
fsys
Figure 13.3.2 Clock Control Circuit
TMP19A71
13-30
TMP19A71
There are the same registers from 0 to 18 as the result registers. Here the register 0 is described. AD PMD Mode Result Register 0 7
ADPRES0 Bit Symbol (0xFFFF_CD00) Read/Write Reset Value Function ADR07 0
6
ADR06 0
5
ADR05 0
4
ADR04 R 0
3
ADR03 0
2
ADR02 0
1
ADR01 0
0
ADR00 0
Lower 8 bits of an AD conversion result
15
Bit Symbol Read/Write Reset Value Function 0 Result store flag 1: Stored VAL
14
OVR 0 Overrun flag 0: No overrun 1: Overrun
13
0
12
R 0
11
0
10
0
9
ADR09 0
8
ADR08 0
Upper 2 bits of an AD conversion result
Note 1: To access this register, the system of more than 16-bit is to be used. When accessed by 8-bit system, the operation shall not be guaranteed. Note 2: Bit 15 is an AD conversion result flag . When an AD conversion value is stored, 1 is set to it. When this register (ADPRES) is read, it is cleared to 0. Note 3: Bit 14 is an overrun flag. 1 is set to this flag when a conversion result is overwritten before reading the conversion result register (ADPRES). It is cleared to 0 with a flag reading. Note 4: This register is not accessible with any bit operation instruction.
TMP19A71
13-31
TMP19A71 13.4.2 13.4.2.1 Operation (PMD Mode) Analog Reference Voltage
By writing 0 to the ADMODSEL0 bit, a switch between VREFH and VREFL can be turned off. To start an AD conversion, 1 must be written to the bit, and then it must be waited for more than 3 s until an internal reference voltage is stabilized. The conversion accuracy when the conversion is started waiting for less than 3s shall not be guaranteed.
13.4.2.2
Basic Operation
In PMD mode, a conversion result register becomes the reference of AD conversions. Each conversion result register sets Conversion Enabled (ADPMOD01), Conversion Trigger (ADCSETT00), and Input Ports (ADCSET0x). Setting 1 to ADPMOD00 causes the wait state of a conversion trigger. As a conversion trigger from PMD is accepted, AD conversion is executed in ascending order from the conversion result register of the smallest number set in the conversion enabled. An accepted conversion trigger is retained inside until the conversions of a whole unit are completed. When a conversion result register to be executed next is set to the trigger already accepted, a conversion starts immediately.
13.4.2.3
AD Conversion Counting
In PMD mode, there is an AD conversion count function that enables a skip a conversion trigger (PMDTRG) of a specific result register for the set number of times. By using this function, both a result register whose conversion is desired in every cycle and a result register whose conversion cycle may delay can be controlled in the same unit. The skip, however, is not possible for all the result registers whose conversions are enabled in the unit. Figure 13.3.3 shows an AD conversion operation in PMD mode.
TMP19A71
13-32
TMP19A71
Set 1 to ADPMOD00.
YES Set a certain value to ADCNT0
ADCNT="0" NO
A skip of this conversion register is invalid? (ADCNEx=0?)
NO
YES Any setting input trigger YES AD Conversion starts NO
The last conversion register? YES an interrupt generation conversion register number=0 circuit retaining trigger is cleared ADCNT0 is changed to -1
NO
Figure 13.3.3 PMD Mode Operation
TMP19A71
13-33
TMP19A71
13.4.2.4
AD Conversion Time
The number of clocks of AD conversion for one cycle is 27 excluding sampling clocks. Since the ADCBASP0 bit can select a sampling clock from 6 or 12 clocks, the sum of AD conversion clocks becomes 33 or 39. ADPCLK0 selects an AD conversion clock among an AD prescaler output fsys, IMCLK, IMCLK/2, IMCLK/4, IMCLK/8, and IMCLK/16. To ensure its accuracy, AD conversion clock must be set less than14MHz, i.e. more than 2.36 s of AD conversion time (when Sample Hold is 6 clocks).
13.4.2.5
Data Polling
To process an AD conversion result by polling data without using any interrupt, ADPMOD00 should be polled. When this flag is cleared to 0, a conversion result is stored in a prescribed AD conversion result register. Therefore the result resister must be read after checking the set. To detect any overrun at this time, a conversion result register must be read in 16-bit system. If the result came out as =0 and =1, a conversion result that was not overwritten would be gained.
TMP19A71
13-34
TMP19A71
13.5 Operating Timing
In PMD trigger mode, setting ADPMOD00 enables the acceptance of a PMD trigger, and inputting PMDTRG00/01 starts a converting operation. After all the program conversions end, ADF is cleared as an interrupt request is output, and then the next input of PMDTRG00/01 is waited. When ADEN is cleared, ADF is cleared without waiting for the end of all the program conversions. Inputting of the same PMD trigger whose conversion is in process is ignored, while a different input is retained. A program conversion of a different PMD trigger is processed continuously immediately after the one of the previous trigger.
ADEN ADF INTAD PMDTRG00 PMDTRG01
1 2 3 1 2 3 1
Figure 13.5.1 Timing Chart 1 in PMD Mode
ADEN ADF INTAD PMDTRG00 PMDTRG01
1 2 3 1 2 3 1
Figure 13.5.2
Timing Chart 2 in PMD Mode
TMP19A71
13-35
TMP19A71
13.6 Example of Use
13.6.1 PWM Peak Synchronization (Read once)
Example of Use: Connect a U-phase current CT output to AIN0, and V-phase current CT output to AIN1. A conversion is processed at the PWM carrier peaks (PWM counter=MDPRD). A result of AIN0 is stored in ADPRES0, and a result of AIN1 to ADPRES1.
PWM Counter=max(MDPRD)
Triangular Wave PWM Counter=1 PWM U-phase V-phase W-phase Conversion Timing ADF Result Processing
Figure 13.6.1
AD Converter
Example of Use 1
Timing
Setting ADMODSEL0 = **** **** **** ***1: PMD mode ADPMOD00 = **** **** **** ***1 : ADC enabled ADPMOD01 = 0000 0000 0000 0011:Select result register 1 or 2 ADCSET00= **** **** 0001 0000 : Select AIN ADCSETT00= **** **** **** 0000 : Select PMDTRG0 TRGCR0 = **** **** **** *100 : PMD trigger setting Operation At the first PWM carrier peak after 1 is set to ADEN, a conversion starts. ADF becomes 1. It, however, does not start when a triangular wave (PWM counter) is in idle state. A conversion is processed in ascending order from the smallest program number (conversion register number). Program 0 converts with AIN0 as an input and put the result in ADPRES0. Program 1 converts with AIN1 as an input and put the result in ADPRES1. As ADF becomes 0, an interrupt INTAD0 generates. Result Processing Read ADPRES0 and ADPRES1 after checking if ADF is 0 or in the interrupt processing of finishing all AD conversions, use them as a U-phase and V-phase currents.
TMP19A71
13-36
TMP19A71 13.6.2 PWM Peak Synchronization (Read once)
Example of Use: Connect U-phase current to AIN1, V-phase current to AIN2, and W-phase current to IN3. The conversion is supposed to be performed at the peak of a triangular wave (PWM counter=max). The result of AIN1 is store in ADPRES0 and 3, the result of AIN2 in ADPRES1 and 4, and the result of AIN3 in ADPRES2 and 5.
PWM Counter=max(MDPRD)
Triangular Wave
PWM Counter=1
PWM U-phase V-phase W-phase
i)Setting
Setting Timing Conversion Timing ADF Result Processing
ii)Setting
Figure 13.6.2
AD Converter
Example of Use 2 Timing
i) Setting ADMODSEL0 = **** **** **** ***1: PMD mode ADPMOD00 = **** **** **** ***1 : ADC enabled ADPMOD01 = 0000 0000 0011 1111: Select result register 0,1,2,3,4,or 5 ADCSET00= 0001 0011 0010 0001 : Select AIN ADCSET01= **** **** 0011 0010 : Select AIN ADCSETT00= **** 0000 0000 0000: Select PMDTRG0 TRGCR0 = **** **** **** *100 : PMD trigger setting i) Operation A conversion starts at the first peak of triangular wave after 1 is set to ADEN. ADF becomes 1. Program 0 converts with AIN1 as an input and put the result in ADPRES0. Program 1 converts with AIN2 as an input and put the result in ADPRES1. Program 2 converts with AIN3 as an input and put the result in ADPRES2. Program 3 converts with AIN1 as an input and put the result in ADPRES3. Program 4 converts with AIN2 as an input and put the result in ADPRES4. Program 5 converts with AIN3 as an input and put the result in ADPRES5. Since the settings of ADPE7 and 6 are off, all programs end. ADF becomes 0.
TMP19A71
13-37
TMP19A71
13.6.3
Synchronization to an Optional Timing of PWM Cycle (Read twice)
Example of Use: Connect the DC-shunt output to AIN1. A single shunt system executes conversions at the timing where all U, V, W are other than H or L. Output data is to be updated every PWM cycle, and a current is to be detected every PWM cycle.
PWM Counter=max(MDPRD)
U
W U V
V U
Triangular Wave PWM U-phase V-phase W-phase Setting Timing
V W
W
PWM Counter=1
Conversion Timing ADF Result Processing
Figure 13.6.3
AD Converter
Example of Use 3 Timing
i) Setting ADMODSEL0 = **** **** **** ***1: PMD mode ADPMOD00 = **** **** **** ***1: ADC enabled ADPMOD01 = 0000 0000 0000 1111: Select a conversion register0, 1, 2, or 3 ADCSET00= 0001 0001 0001 0001 : Select AIN ADCSETT00= **** **** 0101 0000 : Select PMDTRG0 or 1 TRGCR0 = **** **** **00 1001 : PMD trigger setting TRGCMP00 = Any of CMPU-CMPV: PMD trigger timing setting TRGCMP01 = Any of CMPV-CMPW: PMD trigger timing setting i) Operation TRG0MD and TRG1MD are 001 after 1 is set to ADEN, and TRGCMP00 and 01 have effect at the max of a PWM counter. A conversion starts when PWM counter= TRGCMP00. ADF becomes 1. Program 0 and 1 with PMDTRG0 selected convert with AIN1 as an input and put the results in ADPRES0 and 1 each. A conversion starts when PWM counter=TRGCMP01. Program 2 and 3 with PMDTRG1 selected convert with AIN1 as an input and put the results in ADPRES2 and 3 each. Since the settings of AD7-4 are off, the program ends here. ADF becomes 0. i) Result Processing Iu=(ADPRES0+ADPRES1)/2
Iw=(ADPRES2+ADPRES3)/2
ii) Setting ADMODSEL0 = **** **** **** ***1: PMD mode ADPMOD00 = **** **** **** ***1: ADC enabled ADPMOD01 = 0000 0000 0000 1111:Program 0, 1, 2, and 3 enabled ADCSET00= 0001 0001 0001 0001 : Select AIN ADCSETT00= **** **** 0101 0000 : Select PMDTRG0 or 1
TMP19A71
13-38
TMP19A71
TRGCR0 = **** **** **00 1001 : PMD trigger setting TRGCMP00 = Any of CMPW - CMPU: PMD trigger timing setting TRGCMP01 = Any of CMPU - CMPV: PMD trigger timing setting ii) Operation Since TRG0MD/TRG1MD=001 TRGCMP00 and 01 have effect where PWM counter is the max. A conversion starts when PWM counter=TRGCMP00. ADF becomes 1. Program 0 and 1 with PMDTRG0 selected converts with AIN1 as an input and put the result in ADPRES0 and 1 each. A conversion starts when PWM counter=TRGCMP01. Program 2 and 3 with PMDTRG1 selected convert with AIN1 as an input and put the results in ADPRES2 and 3 each. Since the settings of AD7-4 are off, the program ends here. ADF becomes 0. ii) Result Processing Iw=(ADPRES0+ADPRES1)/2 Iv=(ADPRES2+ADPRES3)/2
TMP19A71
13-39
TMP19A71
14. Motor Control Circuit (PMD: Programmable Motor Driver)
The TMP19A71 contains a two-channel programmable motor driver (PMD). In addition to a 3-phase waveform generation circuit, the PMD also has a sync sampling signal generation circuit for sampling operations of the AD converter. By implementing these functions by hardware, the load on software can be reduced, and vector control of brushless DC motors can easily be implemented.
14.1 Functional Block Diagram Port
PMD
3-phase Waveform Generation Circuit
U to Z
IM Bus
TX19A Core Processor
EMG
Sync Sampling Signal Generation Circuit
Port EMG
TRG AD Converter AIN
Figure 14.1.1
PMD Functional Block Diagram
TMP19A71
14-1
TMP19A71
14.2 PMD Registers
Table 14.2.1
Address 0xFFFF_C300 0xFFFF_C304 0xFFFF_C308 0xFFFF_C30C 0xFFFF_C310 0xFFFF_C314 0xFFFF_C318 0xFFFF_C31C 0xFFFF_C320 0xFFFF_C324 0xFFFF_C328 0xFFFF_C32C 0xFFFF_C330 0xFFFF_C340 0xFFFF_C344 0xFFFF_C348 0xFFFF_C34C 0xFFFF_C350 0xFFFF_C354 0xFFFF_C358 0xFFFF_C35C 0xFFFF_C360 0xFFFF_C364 0xFFFF_C368 0xFFFF_C36C 0xFFFF_C370 Bits 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 MDCR0 MDCNT0 MDPRD0 CMPU0 CMPV0 CMPW0 MDOUT0 EMGREL0 EMGCR0 TRGCR0 TRGCMP00 TRGCMP01 TRGCMP02 MDCR1 MDCNT1 MDPRD1 CMPU1 CMPV1 CMPW1 MDOUT1 EMGREL1 EMGCR1 TRGCR1 TRGCMP10 TRGCMP11 TRGCMP12
PMD Register Map
Register Name PMD0 Control Register PMD0 Count Register PMD0 Period Register PMD0 Compare Register U PMD0 Compare Register V PMD0 Compare Register PMD0 Output Register EMG0 Release Register EMG0 Control Register Trigger Control Register (PMD0) Trigger Compare 0 Register (PMD0) Trigger Compare 1 Register (PMD0) Trigger Compare 2 Register (PMD0) PMD1 Control Register PMD1 Count Register PMD1 Period Register PMD1 Compare Register U PMD1 Compare Register V PMD1 Compare Register W PMD1 Output Register EMG1 Release Register EMG1 Control Register Trigger Control Register (PMD1) Trigger Compare 0 Register (PMD1) Trigger Compare 1 Register (PMD1) Trigger Compare 2 Register (PMD1)
Mnemonic
Note: These registers must be accessed as a 16-bit quantity, unless otherwise noted. These registers do not support bit manipulation instructions.
TMP19A71
14-2
TMP19A71
14.3 PMD Components
The two PMD channels are, essentially, functionally equivalent so that only PMD0 is explained here.
14.3.1
Three-Phase Waveform Generation Circuit
MDCR0
MDOUT0
EMGCR0
MDCR0
EMGREL0
MDPRD0 CMPU0 CMPV0 CMPW0 INTPMD0
PWM
PWMU PWMV PWMW
Conduction Control
u x v y w z
Protection Control
u' x' v' y' w' z'
Dead Time Control
Port Control
U X V Y W Z
EMG0
PWMsync
MDCNT0
INTEMG0
Figure 14.3.1 Three-Phase Waveform Generation Circuit
The 3-phase waveform generation circuit consists of a pulse width modulation (PWM) circuit, a conduction control circuit, an EMG protection (emergency stop) circuit and a dead time control circuit. The pulse width modulation circuit generates independent 3-phase PWM waveforms with the same PWM carrier wave. The conduction control circuit determines the output pattern for each of the upper and lower sides of the U, V and W phases. The EMG protection circuit enables emergency output stop by EMG0 input. The dead time control circuit prevents a short circuit which may occur when the upper side and lower side are switched.
TMP19A71
14-3
TMP19A71 14.3.2 Pulse Width Modulation Circuit (PWM Waveform Generation Unit)
PMD Control Register MDCR0
15-8 |7|6|-|-|3,2,1|0
3
PWM Counter Register MDCNT0
15-0
PWM Control
PWM Sync Clock
PWM Interrupt INTPWM0
PWMsync IMCLK
Up/Down
PWM Counter
Selector 0x0001 PWM Period Register MDPRD0
15-0
Selector/ Latch
PWM Compare Register CMPU0
15-0
BufferU

PWMU0
CMPV0
15-0
PWMV0 BufferV
Figure 14.3.5
CMPW0
15-0
PWMW BufferW
To Sync Sampling Signal Generation Circuit
Figure 14.3.2 Pulse Width Modulation Circuit
The pulse width modulation circuit has a 16-bit up-/down-counter (PWM counter) and generates PWM carrier waves with a resolution of 35.7 ns (IMCLK = 28 MHz). The PWM carrier wave mode can be selected from the following two modes: PWM Mode 0 : Edge PWM (Sawtooth wave modulation) PWM Mode 1 : Center PWM (Triangular wave modulation) The MDPRD0 register is used to specify the PWM period. The MDPRD0 is double-buffered and the comparator input is updated at every PWM period or at every half PWM period. Sawtooth wave PWM IMCLK [Hz] : MDPRD0 register value = PWM frequency [Hz] IMCLK [Hz] : MDPRD0 register value = PWM frequency x 2 [Hz]
Triangular wave PWM
TMP19A71
14-4
TMP19A71
The pulse width modulation circuit compares the PWM compare registers of the 3 phases (CMPU0, CMPV0, CMPW0) and the carrier wave generated by the PWM counter (MDCNT0) to determine which is larger to generate PWM waveforms with the desired duty. The PWM compare register of each phase has a compare register (double-buffer structure). The PWM compare register value is loaded into the corresponding compare register at every PWM period (when the internal counter value matches the MDPRD0 value). It is also possible to update the compare register at every half PWM period.
[Sawtooth wave] MDCNT0
[MDPRD0] [CMPU0]
MDCNT0 counts up to the MDPRD0 value and it is then cleared to 0 in the next cycle.
Time on
PWMU waveform
off
When down-counting switches to up-counting, the value 1 continues for two cycles. When up-counting switches to down-counting, the peak value (MDPRD0) continues for two cycles.
[Triangular
wave]
MDCNT0
[MDPRD0] [CMPU0]
Time
PWMU waveform
on off
Figure 14.3.3 PWM Waveforms Three-phase PWM waveforms can be generated in the following two modes: (1) 3-phase independent mode: Each of the PWM compare registers for the three phases is set independently to generate independent PWM waveforms for each phase. This mode is used to generate drive waveforms such as sinusoidal waves. (2) 3-phase common mode: Only the U-phase PWM compare register is set to generate identical PWM waveforms for all the three phases. This mode is used for rectangular wave drive of brushless DC motors.
TMP19A71
14-5
TMP19A71
The pulse width modulation circuit generates PWM interrupt requests in synchronization with PWM waveforms. The PWM interrupt period can be set to half a PWM period, one PWM period, two PWM periods, or four PWM periods. When the PWM interrupt period is set to two or four PWM periods, the first interrupt after the counter is started occurs at any timing in the specified period. For example, if an interrupt is to be generated at every four PWM periods, the first interrupt will be generated any time during the first to fourth PWM periods with the second and subsequent interrupts generated at every fourth PWM period.
MDCNT0 MDPRD0=0x105 MDPRD0=0x100
If the MDPRD0 is reloaded during this period, the counter counts up to the value previously set in the MDPRD0 and then starts counting down from the new value.
Time PWM period MDPRD0 PWM counter MDCNT0 INTPMD0 INTPRD0=0x0 (0.5 period)
0x100 0x105
0x003 0x002 0x001 0x001 0x002 0x097 0x098 0x099 0x100 0x105 0x104 0x103 0x102
Figure 14.3.4 MDPRD0 Reload Timing (Triangular Wave, Interrupt at Every 0.5 PWM Period)
TMP19A71
14-6
TMP19A71
PMD0 Control Register 7 MDCR0 (0xFFFF_C300) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value 14 13 12 DTR R/W 0x00 11 10 9 8 UPDWN R 0 6 SYNCEN R/W 0 5 DTYMD R/W 0 4 PINT R/W 0 3 INTPRD R/W 0 2 1 PWMMD R/W 0 0 PWMEN R/W 0
Symbol UPDWN SYNCEN DTYMD
Name PWM counter flag PMD synchronized start Duty mode 0: Up-counting 1: Down-counting 0: Disable synchronized start 1: Enable synchronized start 0: 3-phase common mode 1: 3-phase independent mode
Function
0: Interrupt request when PWM counter = 1 1: Interrupt request when PWM counter = MDPRD PINT PWM interrupt timing [PWM counter = MDPRD when edge mode is selected (PWMMD=0). PWM counter = 1 or MDPRD when 0.5 PWM period is selected (INTPRD=00).] 00: Interrupt request at every 0.5 PWM period (PWM mode1: triangular waves only) INTPRD PWM interrupt period 01: Interrupt request at every PWM period 10: Interrupt request at every 2 PWM periods 11: Interrupt request at every 4 PWM periods PWMMD PWMEN PWM mode PWM counter start 0: PWM Mode 0: edge PWM (sawtooth waves) 1: PWM Mode 1: center PWM (triangular waves) 0: Stop & clear 1: Start
Note: The settings in the MDCR0 register must be changed while the PWMEN bit is 0. It is also not allowed to change the MDCR0 settings at the same time as writing to the PWMEN bit to start or stop the PWM counter.
TMP19A71
14-7
TMP19A71
PMD0 Count Register 15 Bit Symbol MDCNT0 (0xFFFF_C304) Read/Write Reset Value Function 14 13 12 11 10 9 8 R 0x0000 PWM counter value: 0x0001 to 0xFFFF 7 6 5 4 3 2 1 0 MDCNT
PMD0 Period Register 15 Bit Symbol MDPRD0 (0xFFFF_C308) Read/Write Reset Value Function
MDPRD0.
14
13
12
11
10
9
8 R/W
7
6
5
4
3
2
1
0
MDPRD 0x0000 PWM carrier wave period (Must be within 0x0010 to 0xFFFF.)
Note: This register is double-buffered; the value written to this register takes effect when MDCNT0 =
PMD0 Compare Registers (U, V, W) 15 CMPU0 (0xFFFF_C30C) CMPV0 (0xFFFF_C310) CMPW0 (0xFFFF_C314) CMPU0 CMPV0 CMPW0 PWM Compare U Register PWM Compare V Register PWM Compare W Register
cycle waveform is generated. Note 2 : These registers are double-buffered; the values written to these registers take effect when MDCNT0 = MDPRD0.
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Bit Symbol
CMPU CMPV CMPW
Read/Write Reset Value
R/W 0x0000
0x0000 to 0xFFFF: U-phase pulse width duty 0x0000 to 0xFFFF: V-phase pulse width duty 0x0000 to 0xFFF: W-phase pulse width duty
Note 1 : When CMPx0=0, a 0%-duty cycle waveform is generated. When CMPx0 MDPRD0, a 100%-duty
TMP19A71
14-8
TMP19A71
Detailed Description of the PMD0 Registers
Symbol UPDWN SYNCEN DTYMD PINT INTPRD Name PWM counter flag PMD synchronized start Duty mode PWM interrupt timing PWM interrupt period Function Indicates whether the PWM counter is up-counting or down-counting. When edge PWM is selected, this bit is always read as 0. Enables the PMD synchronized start function. Selects whether to make duty setting independently for each phase or to use the CMPU register setting for all three phases. Selects whether to generate an interrupt when PWM counter equals 1 or the MDPRD value. Selects the PWM interrupt period from 0.5 PWM period, one PWM period, two PWM periods and four PWM periods. If this bit is changed during operation, an interrupt may occur at that time. PWMMD PWMEN PWM mode Waveform generation circuit enable/disable Selects PWM Mode 0 (edge PWM, sawtooth wave) or PMW Mode 1 (center PWM, triangular wave). When this bit is cleared to stop and clear the PWM counter, output ports become high-impedance. Before setting this bit to 1 to start the PWM counter, it is necessary to set all the other bits in the MDCR0 register. While this bit is set to 1, do not change the MDCR0 settings other than the PWMEN bit. MDCNT MDPRD PWM counter PWM period A 16-bit counter for reading the PWM period count value. A 16-bit register for specifying the PWM period. This register is double-buffered and can be changed even when the PWM counter is counting. The buffer is loaded at every PWM period. (That is, when the PWM counter matches the MDPRD value. When 0.5 PWM period is selected, loading is performed when the PWM counter matches 1 or MDPRD0.) See Figure 14.3.4. CMPU CMPV CMPW PWM pulse width 16-bit compare registers for determining the output pulse width of U, V and W phases. These registers are double-buffered. Pulse width is determined by comparing the buffer and the PWM counter to evaluate which is larger. When CMPx0 = 0, a 0% duty-cycle waveform is generated. When CMPx0 >= MDPRD0, a 100% duty-cycle waveform is generated. (To be loaded when the PWM counter matches the MDPRD value. When 0.5 period is selected, loading is performed when the PWM counter matches 1 or MDPRD.)
Setting the SYNCEN bit of the MDCR0 register to 1 enables the PMD synchronized start function. When the PWMEN bit of the MDCR0 is set to 1 with the PMD synchronized start function enabled, PMD0 is put on standby for starting as soon as the PWMEN bit of the MDCR1 is set to 1 to start PMD1. By setting the SYNCEN and PWMEN bits simultaneously, PMD0 can be put on standby for synchronized start. When the synchronized start function is enabled for both PMD0 and PMD1 (MDCR0.SYNCEN=1, MDCR1.SYNCEN=1), the channel that is enabled first (MDCRx.PWMEN bit=1) is put on standby and starts operating as soon as the other channel is enabled. Even when the synchronized start function is enabled, registers are set independently for each channel. To operate PMD0 and PMD1 with the same conditions, it is necessary to set the PMD0 and PMD1 registers identically.
Example: To start PMD0 in synchronization with PMD1 MDCR0 = 0y********_*1*****1 MDCR1 = 0y********_*******1 ; SYNCEN=1 (Enable the synchronized start function.) ; PWMEN=1 (Put PMD0 on standby.) ; PWMEN=1 (Start PMD1.)
TMP19A71
14-9
TMP19A71 14.3.3 Conduction Control Circuit
PMD Output Register MDOUT0
-- 12, 11 10, 9, 8 7, 6 5, 4, 3, 2, 1, 0
2
2
Fig.12.3.7
S
3
6
PWM sync IMCLK
Selector
Latch
u PWMU x
Continued from Fig.12.3.2
v PWMV y
Continue to Fig. 14.3.6
w PWMW z
Figure 14.3.5 Conduction Control Circuit
The conduction control circuit performs output port control according to the settings made in the PMD output register (MDOUT0). The MDOUT0 register bits are divided into two parts: settings for the synchronization signal for port output and settings for port output. The latter part is double-buffered and update timing can be set as synchronous or asynchronous to PWM. The output settings for six port lines are made independently for each of the upper and lower phases through the POLH and POLL bits of the MDOUT0 register. In addition, the UOC, VOC and WOC bits of the MDOUT0 register are used to select PWM or H/L output for each of the U, V, and W phases. When PWM output is selected, PWM waveforms are output. When H/L output is selected, output is fixed to either a high or low level. Table 14.3.1 shows a summary of U-phase port outputs according to port output and polarity settings in the MDOUT0.
TMP19A71
14-10
TMP19A71
PMD0 Output Register 7 MDOUT0 (0xFFFF_C318) Bit Symbol Read/Write Reset Value 15 Bit Symbol Read/Write Reset Value R 0 PSYNS R/W 0 14 R 0 13 R 0 6 5 WOC R/W 0 12 POLH R/W 0 11 POLL R/W 0 4 3 VOC R/W 0 10 WPWM R/W 0 9 VPWM R/W 0 2 1 UOC R/W 0 8 UPWM R/W 0 0
Symbol POLH POLL WPWM VPWM UPWM
Name Upper phase port polarity Lower phase port polarity W-phase PWM output V-phase PWM output U-phase PWM output 0: Low active 1: High active 0: Low active 1: High active 0: H/L output 1: PWM waveform output 0: H/L output 1: PWM waveform output 0: H/L output 1: PWM waveform output 00: Async to PWM
Function
PSYNCS
MDOUT transfer timing
01: Load when PWM counter 1 10: Load when PWM counter = MDPRD 11: Load when PWM counter = 1 or MDPRD
WOC VOC UOC
Note 1:
-phase output control -phase output control -phase output control
Before changing the POLH, POLL and PSYNCS bits of the MDOUT0 register, make sure that the MDCR0.PWMEN bit is cleared to 0.
See Table 14.3.1.
Note 2:
The xPWM and xOC bits of the MDOUT0 register are double-buffered; the values written to these bits take effect according to the timing selected in the MDOUT0.PSYNCS field.
TMP19A71
14-11
TMP19A71
Table 14.3.1
Summary of U-Phase Port Outputs according to the UOC and UPWM Settings
Polarity: Active low (POLH, POLL=0)
MDOUT Bit 1 0 Bit 0 0 MDOUT0 0: H/L output 1: PWM output U output X output U output X output H H PWM
Polarity: Active high (POLH, POLL=1
MDOUT Bit 1 0 Bit 0 0 MDOUT0 0: H/L output 1: PWM output U output X output U output X output L L
PWM
L
PWM
PWM PWM
H
0
1
L
H
PWM
0
1
H
L
H
1
0
H
L
PWM
L
1
0
L
H
PWM PWM
1
1
H
H
PWM
PWM
1
1
L
L
PWM
The VOC and VPWM bits and the WOC and WPWM bits should be set for the V phase and the W phase, respectively, as shown in the above table. Name Output port polarity Port output sync setting U-, V-, W-phase output control POLL, POLH PSYNCS UOC, VOC, WOC, UPWM, VPWM, WPWM Symbol when MDCR0.PWMEN=0. Select port output timing for the U, V and W phases. Select either MDCNT0 (PMD0 compare register) peak/bottom sync or async. Specify port output settings for the U, V and W phases (see Table 14.3.1). Function Select the output port polarity for the upper and lower phases. Set these bits
TMP19A71
14-12
TMP19A71
14.3.4
EMG Protection Circuit
EMG Control Register EMG Release Register
PWM
-
EMGCR0
-|2|1|0
3
EMGREL0
7,6,5,4,3,2,1,0
8
EMG Protection Control
PEMG0 EMG Signal from EMG
Port
INTEMG0 EMG Interrupt Request
u
u'
x
x' v'
Continued from Figure 12.3.5
v y
To continue to
y'
Figure 12.3.7
w
w'
z
z'
Figure 14.3.6 EMG Protection Circuit
The EMG protection circuit is activated when the EMG input from the EMG0 (PA6) pin becomes the active state specified in the port A EMG control register (PAECR). When the PA6 pin is not configured as an EMG input pin, the EMG protection circuit does not function. The EMG protection circuit offers an emergency stop mechanism: when the EMG input is asserted, an EMG interrupt request (INTEMG0) is generated and the PMDTRG0 output to the AD converter is disabled. When only the PMD is protected with the EMG input pin enabled, all six port output lines output inactive signals. EMG protection is set through the EMG control register (EMGCR0). A read value of 1 in the EMGST bit of the EMGCR0 indicates that the EMG protection circuit is active. In this state, EMG protection can be released by setting all the port output lines inactive (MDOUT[10:0]= 00000000000) and then setting the EMGRS bit of the EMGCR0 to 1. To disable the EMG protection function, the following sequence of operations must be performed consecutively. This sequence becomes invalid if it is interrupted by any operation on the EMGCR0 or EMGREL0 register before it is completed. 1) Write 0x5A in the EMGREL0 register. 2) Write 0xA5 in the EMGREL0 register. 3) Clear the EMGEN bit of the EMGCR0 register to 0. If protection is released in the EMG protection circuit while the EMG input pin is asserted, protection is applied again. For details about the port settings related to the EMG protection function, see section 8.12 Notes on Using the EMG Input Pins (PA6, PA8).
TMP19A71
14-13
TMP19A71
EMG0 Release Register 7 Bit Symbol EMGREL0 (0xFFFF_C31C) Read/Write Reset Value Function 6 5 4 EMGREL W 0x00 The EMG protection circuit can be disabled by writing 0x5A and 0xA5 in this order to this register and then clearing EMGCR0.EMGEN bit to 0. 3 2 1 0
EMG0 Control Register Bit Symbol EMGCR0 (0xFFFF_C320) Read/Write Reset Value 7 R 0 6 R 0 5 R 0 4 R 0 3 R 0 2 EMGST R 0 1 EMGRS W 0 0 EMGEN R/W 1
Symbol EMGST EMGRS EMGEN
Name EMG protection state EMG protection release EMG protection circuit enable/disable 0: 1: Protected 0: 1: Release protection 0: Disable 1: Enable
Function
Detailed Description of the EMG Control Register
Name EMG protection state EMG protection release Symbol EMGST EMGRS Function The EMG protection state can be known by reading this bit. EMG protection can be released by setting MDOUT[10:0] to 00000000000 and then setting the EMGRS bit to 1. EMG protection circuit enable/disable EMGEN The EMG protection circuit is enabled by setting this bit to 1. In the initial state, the EMG protection circuit is enabled. To disable this circuit, write 0x5A and 0xA5 in this order to the EMGREL0 register and then clear the EMGEN bit to 0.
TMP19A71
14-14
TMP19A71 14.3.5 Dead Time Control Circuit
PMD Control Register MDCR0
158|-|-|-|-|-|-|-|-
PMD Output Register MDOUT0
- - - 12,11 -,-,- -,- -,-,-,-,-,-
IMCLK
1/2
ON Delay Circuit
U X
u' x'
ON Delay Circuit
V Y
Continued from Figure 14.3.6
v' y'
ON Delay Circuit w' z'
W
Z
Dead Time Unit
Output Polarity Switching Unit
Figure 14.3.7 Dead Time Control Circuit
The dead time control circuit consists of a dead time unit and an output polarity switching unit. For each of the U, V, and W phases, the ON delay circuit introduces a delay (dead time) when the upper and lower phases are switched to prevent a short circuit. The dead time is set to the DTR field in the MDCR0 register as an 8-bit value with a resolution of 71.4 ns (at IMCLK = 28 MHz). No delay time is inserted when DTR=0x00. The output polarity switching unit allows the polarity (active high or active low) of the upper and lower phases to be independently set through the POLH and POLL bits of the MDOUT0 register.
PMD0 Control Register
7 MDCR0 (0xFFFF_C300) Bit Symbol Read/Write Reset Value Function 15 Bit Symbol Read/Write Reset Value Function UPDWN R 0 to 0. 14 13 12 DTR R/W 0x00 Dead time: 71.4 ns x 8 bits (max. 18.2 sIMCLK = 28 MHz 11 10 9 8 6 R/W 0 Must be set 5 DTYMD R/W 0 4 PINT R/W 0 3 INTPRD R/W 0 2 1 PWMMD R/W 0 0 PWMEN R/W 0
TMP19A71
14-15
TMP19A71
14.3.6
Sync Sampling Signal Generation Circuit
3-Phase Waveform Generation Circuit MDCNT0 PWM Sync Signal
TRGCR0
TRGCMP00 PWM Sync
TBUF00
Slope Selection
PMDTRG00
AD Converter Control Circuit
TRGCMP01 PWM Sync
TBUF01
PMDTRG01
TRGCMP02 PWM Sync
TBUF02
PMDTRG02
Figure 14.3.8 Sync Sampling Signal Generation Circuit
The sync sampling signal generation circuit generates trigger signals for starting ADC sampling in synchronization with PWM. The ADC trigger signal (PMDTRG0) is generated by a match between the MDCNT0 and TRGCMP0. The signal generation timing can be selected from up-count match, down-count match, and up-/down-count match. When the edge PWM mode is selected, the ADC trigger signal is generated on an up-count match. When PWM output is disabled (MDCR0.PWMEN=0) or EMG protection is applied, trigger output is also disabled.
TMP19A71
14-16
TMP19A71
Trigger Control Register (PMD0) 15 Bit Symbol TRGCR0 (0xFFFF_C324) Read/Write Reset Value R 0 14 R 0 13 R 0 12 R 0 11 R 0 10 R 0 9 R 0 8 7 TRG2MD R/W 000 6 5 4 TRG1MD R/W 000 3 2 1 TRG0MD R/W 000 0
Symbol TRG2MD
Name PMDTRG2 mode setting
Function
000: Trigger output disabled 001: Trigger output on down-count match 010: Trigger output on up-count match
TRG1MD
PMDTRG1 mode setting
011: Trigger output on up-/down-count match 100: Trigger output at PWM carrier peak 101: Trigger output at PWM carrier bottom 110: Trigger output at PWM carrier peak/bottom
TRG0MD
PMDTRG0 mode setting
111:
Note: The TRG0MD, TRG1MD and TRG2MD fields must be set while MDCR0.PWMEN=0.
Trigger Compare Registers (PMD0) 15 TRGCMP02 (0xFFFF_C330) TRGCMP01 (0xFFFF_C32C) TRGCMP00 (0xFFFF_C328)
Note1: The trigger compare registers must be set to satisfy the following conditions: 1 RGCMP00, TRGCMP01, TRGCMP02 MDPRD0 Note 2: These registers are double-buffered; the values written to these registers take effect at the following timings: TRGxMD=001: The register values take effect when MDCNT0=MDPRD0. TRGxMD=010: The register values take effect when MDCNT0=0. TRGxMD=011: The register values take effect when MDCNT0=MDPRD0 or 0.
14
13
12
11
10
9
8
7 R/W
6
5
4
3
2
1
0
Bit Symbol Read/Write Reset Value Function
0x0000 PMDTRG0 is output on a match between this register and MDCNT0.
TMP19A71
14-17
TMP19A71
15. Encoder Input Circuit
15.1 Functional Overview
(1) (2) (3) (4) (5) Allows direct input of the incremental encoder signal. Contains a x4 multiplier circuit and a rotation direction control circuit. Contains an absolute position detection counter. Generates an interrupt on a match with the encoder pulse position set value. Incorporates noise filters in the signal input part.
ENCA ENCB ENCZ
Noise Filter Noise Filter Noise Filter Select Decoder Interrupt Request Control
Interrupt Request INTENC
Figure 15.1.1 Block Diagram of the Encoder Input Circuit
Note: Unless otherwise specified, the registers for the encoder input circuit must be accessed as a 16-bit quantity. Bit manipulation instructions cannot be used on these registers.
TMP19A71
15-1
TMP19A71
15.2 Register Description
Encoder Input Control Register
7 ENTNCR Bit Symbol (0xFFFF_C400) Read/Write Reset Value Bit Symbol Read/Write Reset Value ZEN 0 15 ENCLR W 0 0 0 0 6 CUNEN 0 14 U/D 13 ZDET 5 NR1 00 12 4 NR0 R/W 0 11 R 0 0 0 0 0 10 0 9 0 8 3 ENCAP 2 1 0
Symbol ENCLR U/D ZDET ZEN CUNEN
Name Encoder pulse counter clear Encoder rotation direction Phase Z detection state Counter clear by phase Z Encoder pulse counter enable 1: CW 0: CCW 1: Phase Z is detected.
Function Writing a 1 and then a 0 to this bit clears the encoder counter.
0: The CUNEN bit is set to 1 or a reset is applied. 1: Enable 0: Disable 1: Enable 0: Disable 00: No filter 01: Eliminate pulses of less than 31/IMCLK as noise 10: Eliminate pulses of less than 63/IMCLK as noise 11: Eliminate pulses of les than 127/IMCLK as noise 1: Enable 0: Disable
NR[1:0]
Noise filter
ENCAP
Encoder interrupt request enable
Note 1: The ENTNCR register must be set after all the other relevant registers have been set. Note 2: Do not change the settings in this register other the ENCLR and CUNEN bits while the encoder counter is operating. Note 3: If the CUNEN bit is cleared to 0 when ENCNT=ENINT, the INTENC interrupt is generated. Note 4: To re-enable the encoder counter after disabling it by CUNEN=0, clear the counter value by using the ENCLR bit.
TMP19A71
15-2
TMP19A71
Table 15.2.1 Detailed Description of the Encoder Input Control Register
Name Encoder pulse counter clear Encoder rotation direction Symbol ENCLR U/D starts counting again. When the motor is rotating in CW direction (phase A of the incremental encoder signal is 90 degrees ahead of phase B), this bit is set to 1. When the motor is rotating in CCW direction (phase A is 90 degrees behind phase B), this bit is cleared to 0. Z phase detection state ZDET This bit is cleared to 0 when a 1 is written to the CUNEN bit and at reset. It is set to 1 on the next ZDETECT--the signal to be output on the rising edge (CW direction) or falling edge (CCW direction) of the incremental encoder signal phase Z. (This bit is independent of the ZEN value.) Counter clear by phase Z ZEN When the motor is rotating in CW direction, this bit is cleared to 0 on the rising edge of phase Z (ZDETECT). When the motor is rotating in CCW direction, this bit is cleared to 0 on the falling edge of phase Z (ZDETECT). If ENCLK (a clock obtained by multiplying the phase A and phase B signals by 4) and ZDETECT coincide with each other, the counter is cleared to 0 without counting. Encoder pulse counter enable Noise filter CUNEN NR1,0 When CUNEN=1, the ZDET bit is cleared to 0 and the encoder counter (ENCNT) is enabled. When CUNEN=0, the encoder counter is disabled. 00: No filter 01: Eliminate pulses of less than 31/IMCLK as noise (1.11 s IMCLK = 28 MHz) 10: Eliminate pulses of less than 63/IMCLK as noise (2.25 s IMCLK = 28 MHz) 11: Eliminate pulses of less than 127/IMCLK as noise (4.54 s IMCLK = 28 MHz) Encoder interrupt request ENCAP ENCAP=1 enables interrupt request signal generation. ENCAP=0 disables interrupt request signal generation. Function Writing a 1 and then a 0 to this bit clears the encoder counter to 0. Then, the counter
TMP19A71
15-3
TMP19A71
Encoder Counter Reload Register 15 ENRELOAD Bit Symbol Reset Value Function (0xFFFF_C404) Read/Write 14 13 12 11 10 9 8 R/W 0x0000 Encoder counter target value: 0x0000 to 0xFFFF (input pulse count multiplied by 4) When phase Z is used: Set the number of pulses required for one rotation When phase Z is not used: Set the number of pulses required for one rotation minus one 7 6 5 4 3 2 1 0
When the encoder counter (ENCNT) is up-counting, the counter is zero-cleared on the next ENCLK timing after the count value reaches the ENRELOAD value. When the encoder counter (ENCNT) is down-counting, it is re-loaded with the ENRELOAD value on the next ENCLK timing after the counter value reaches 0.
Encoder Compare Register 15 ENINT Bit Symbol Reset Value Function (0xFFFF_C408) Read/Write 14 13 12 11 10 9 8 R/W 0x0000 Interrupt request generation position: 0x0000 to 0xFFFF When the encoder counter matches the value set in this register, an interrupt request is generated. 7 6 5 4 3 2 1 0
When the encoder counter (ENCNT) value reaches the ENINT value, an interrupt request (INTENC ) is generated. When ZEN=1, however, an interrupt request is not generated until the ZDET bit is set to 1.
Encoder Counter 15 ENCNT Bit Symbol Reset Value Function (0xFFFF_C40C) Read/Write 14 13 12 11 10 9 8 R 0x0000 0x0000 to 0xFFFF: Up-/down counter that counts encoder pulses 7 6 5 4 3 2 1 0
When the motor is rotating in CW direction, the encoder counter is an up-counter to be zero-cleared on the next ENCLK timing after the count value reaches the ENRELOAD value. When the motor is rotating in CCW direction, the encoder counter is a down-counter to be re-loaded with the ENRELOAD value on the next ENCLK timing after the count value reaches 0.
TMP19A71
15-4
TMP19A71
15.3 Operation
Phase A Input ENCA
Phase B Input ENCB
Phase Z Input ENCZ
Motor Rotation Direction
CW
CCW
Rotation Direction State U/D Encoder Pulse ENCLK Phase Z Detection ZDETECT
Encoder Counter ENCNT
0x100 0x101 0x0
0x1
0x2
0x3
0x4
0x1
0x2
0x1
0x0 0x0 0x5DB 0x5DA
Initial rotation (ZDET=0)
INTENC ENINT=0x2
Figure 15.3.1 Encoder Input Circuit Timing Chart (1) (ZEN=1, ENRELOAD=0x05DB)
Phase A Input ENCA
Phase B Input ENCB Motor Rotation Direction Rotation Direction State U/D Encoder Pulse ENCLK
CW
CCW
Counter Clear
Encoder Counter ENCNT
Set ENCLR
Set ENCLR
0x100 0x101 0x102 0x103 0x0
0x1
0x2
0x1
0x2
0x1
0x0 0x0 0x5DB 0x5DA
INTENC ENINT=0x2
Figure 15.3.2 Encoder Input Circuit Timing Chart (2) (ZEN=0, ENRELOAD=0x5DB)
TMP19A71
15-5
TMP19A71
(1) Each incremental encoder signal is connected to phase A, phase B, and phase Z, respectively. This signal is multiplied by four for being counted. (2) When the motor is rotating in CW direction (phase A is 90 degrees ahead of phase B), the encoder counter operates as an up-counter. When the count value reaches the ENERELOAD value, the counter is zero-cleared on the next ENCLK timing for counting up. (3) When the motor is rotating in CCW direction (phase A is 90 degrees behind phase B), the encoder counter operates as a down-counter. When the count value reaches 0, the counter is re-loaded with the ENRELOAD value on the next ENCLK timing for counting down. (4) When ZEN=1, the encoder counter is zero-cleared on the rising edge of phase Z (ZDETECT) while the motor is rotating in CW direction and on the falling edge of phase Z (ZDETECT) in the case of CCW direction. When ENCK and ZDETECT coincide with each other, no count operation is performed and the counter is zero-cleared. (5) When a 0 is written to the ENCLR bit, the counter is zero-cleared. (6) An interrupt request can be generated when the counter value reaches the ENINT value. When ZEN=1, however, an interrupt request cannot be generated until the ZDET bit is set to 1. (7) The ZDET bit is zero-cleared when a 1 is written to the CUNEN bit and at reset, and it is set to 1 on the next ZDETECT timing (regardless of the ZEN value). (8) The U/D bit is set to 1 when CW rotation is detected and to 0 when CCW rotation is detected.
TMP19A71
15-6
TMP19A71
15.4 How to Use the Encoder Input Circuit
15.4.1 Using the Encoder Interrupt Request
(1) Set the encoder pulse count. Assuming that the encoder requires 1200 pulses for one rotation, the pulse count (after being multiplied by 4) is set as follows:
ENRELOAD=1200x4=0x12C0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1
(2) Set the encoder compare register value. For generating an interrupt request at counter value = 1000 (03E8H), the encoder compare register is set as follows:
ENINT=0x03E8 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0
(3) Enable the encoder counter, interrupt request, and Z-phase detection.
15 ENTNCR 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -
(4) Operation 1. As the encoder rotates, the encoder decoder outputs x4 pulses (ENCLK) and rotation direction (U/D). 2. The encoder counter counts ENCLK pulses. Whether to count up or down is determined by rotation direction. 3. When phase Z is detected, the encoder counter is cleared. In the case of up-counting, when the count value matches the ENRELOAD register value, the counter is zero-cleared on the next ENCLK timing. In the case of down-counting, when the count value reaches 0, the counter is re-loaded with the ENRELOAD register value on the next ENCLK timing. 4. Up to the first Z-phase detection, the encoder counter value indicates not the absolute position of the actual encoder but the relative position from count start time. When phase Z is detected, the ZDET is set to 1 and the counter value now indicates the absolute position. 5. When a match occurs between the encoder compare register (ENINT) value and the encoder count value and the ZDET is set to 1, an ENINT interrupt request is generated. This interrupt request is generated regardless whether the counter is counting up or down.
TMP19A71
15-7
Under Development
TMP19A71
16. ROM Correction
This chapter describes the ROM correction function supported by the TMP19A71.
Note: The registers for the ROM correction function must be accessed as a 32-bit quantity. Bit manipulation instructions cannot be used on these registers.
16.1 Features
* * Up to eight 8-word sequences of data can be replaced. When the physical address stored in an address register (ADDREGn) matches the program counter (PC) value or the address generated by the DMAC (the lower five bits of the address are "don't care"), the data at the specified address in the on-chip ROM is replaced with the data from the RAM area corresponding to the address register. Writing an address to an address register causes ROM correction for the address to be enabled automatically. A reset is required to disable the ROM correction function. A correction requiring the replacement of more than eight words can be performed by replacing the ROM data with an instruction code which makes a branch to a specified location in the RAM area which contains substitution data.
* *
16.2 Operation
To correct data in a ROM area (or a projected ROM area), store the physical address of the area in an address register (ADDREGn). Store the substitution data in the RAM area corresponding to the address register. Writing an address to an address register causes ROM correction for the address to be enabled automatically. Upon reset, the ROM correction function is disabled. If the initial routine executed upon reset is used to correct ROM data, write a physical address to the relevant address register after a reset is released. The address registers to which addresses are written are enabled for ROM correction. When the stored address matches the PC value (if the TX19A core processor owns the bus) or the source or destination address issued by the DMAC (if the DMAC owns the bus), the data at the specified address in the ROM is replaced with the data stored in the corresponding RAM area. For example, storing addresses in the ADDREG0 and ADDREG3 enables correction for the respective ROM areas, so that the ROM correction circuit block constantly monitors the PC and DMAC-issued addresses for a match with a specified address and, if a match is detected, replaces data, while ignoring the ADDREG2 and ADDREG4 to ADDREG7. Each address register has bits 31:5 although only bits 17:5 are used for address comparison, in order to simplify the circuit. A match detected in the ROM correction circuit is internally ANDed with the ROMCS signal, which indicates a specified ROM address block, to determine an exact match. ROM addresses specified for correction must be located on eight-word boundaries, i.e., the lower five bits are 0. In other words, ROM data is always replaced in 32-byte units. If only part of 32 bytes needs to be replaced, substitution RAM data corresponding to the other bytes must be the same as the current data in the corresponding ROM addresses.
TXMP9A70
16-1
TMP19A71
The following table shows the relationship between the address registers and RAM areas. Table 16.2.1 Relationship between the ADDREGn Registers and RAM Areas
Address Register ADDREG0 ADDREG1 ADDREG2 ADDREG3 ADDREG4 ADDREG5 ADDREG6 ADDREG7 RAM Area 0xFFFF_BF00 to 0xFFFF_BF1F 0xFFFF_BF20 to 0xFFFF_BF3F 0xFFFF_BF40 to 0xFFFF_BF5F 0xFFFF_BF60 to 0xFFFF_BF7F 0xFFFF_BF80 to 0xFFFF_BF9F 0xFFFF_BFA0 to 0xFFFF_BFBF 0xFFFF_BFC0 to 0xFFFF_BFDF 0xFFFF_BFE0 to 0xFFFF_BFFF
G-BUS
Address Registers ADDREGx Compare Enable Compare Address [17:5] Compare Circuit
TX19A Core Processor
Load/Fetch Address [17:5]
Conversion Enable Converter Conversion Address Address
RAM
ROM
RAM Data
RAMCS Signal
ROMCS Signal
ROM Data
Figure 16.2.1 ROM Correction Block Diagram
TMP19A71
16-2
Under Development
TMP19A71
16.3 Registers
(1) ADDREG0 (0xFFFF_E540) Address Registers 7 Bit Symbol Read/Write Reset Value Function ADD07 0 6 ADD06 0 5 ADD05 0 4 R/W 1 1 1 1 1 3 2 1 0
15 Bit Symbol Read/Write Reset Value Function ADD015 0
14 ADD014 0
13 ADD013 0
12
11
10 ADD010 0
9 ADD09 0
8 ADD08 0
ADD012 ADD011 R/W 0 0
23 Bit Symbol Read/Write Reset Value Function ADD023 0
22 ADD022 0
21 ADD021 0
20 Add020 0
19 ADD019 R/W 0
18 ADD018 0
17 ADD017 0
16 ADD016 0
31 Bit Symbol Read/Write Reset Value Function ADD031 0
30 ADD030 0
29 ADD029 0
28
27
26 ADD026 0
25 ADD025 0
24 ADD024 0
ADD028 ADD027 R/W 0 0
7 ADDREG1 (0xFFFF_E544) Bit Symbol Read/Write Reset Value Function ADD17 0
6 ADD16 0
5 ADD15 0
4 R/W 1
3 1
2 1
1 1
0 1
15 Bit Symbol Read/Write Reset Value Function ADD115 0
14 ADD114 0
13 ADD113 0
12 ADD112 0
11 ADD111 R/W 0
10 ADD110 0
9 ADD19 0
8 ADD18 0
23 Bit Symbol Read/Write Reset Value Function ADD123 0
22 ADD122 0
21 ADD121 0
20 ADD120 0
19 ADD119 R/W 0
18 ADD118 0
17 ADD117 0
16 ADD116 0
31 Bit Symbol Read/Write Reset Value Function ADD131 0
30 ADD130 0
29 ADD129 0
28 ADD128 0
27 ADD127 R/W 0
26 ADD126 0
25 ADD125 0
24 ADD124 0
TXMP9A70
16-3
TMP19A71
7 ADDREG2 (0xFFFF_E548) Bit Symbol Read/Write Reset Value Function ADD27 0
6 ADD26 0
5 ADD25 0
4 R/W 1
3 1
2 1
1 1
0 1
15 Bit Symbol Read/Write Reset Value Function ADD215 0
14 ADD214 0
13 ADD213 0
12 ADD212 0
11 ADD211 R/W 0
10 ADD210 0
9 ADD29 0
8 ADD28 0
23 Bit Symbol Read/Write Reset Value Function ADD223 0
22 ADD222 0
21 ADD221 0
20 ADD220 0
19 ADD219 R/W 0
18 ADD218 0
17 ADD217 0
16 ADD216 0
31 Bit Symbol Read/Write Reset Value Function ADD231 0
30 ADD230 0
29 ADD229 0
28 ADD228 0
27 ADD227 R/W 0
26 ADD226 0
25 ADD225 0
24 ADD224 0
7 ADDREG3 (0xFFFF_E54C) Bit Symbol Read/Write Reset Value Function ADD37 0
6 ADD36 0
5 ADD35 0
4 R/W 1
3 1
2 1
1 1
0 1
15 Bit Symbol Read/Write Reset Value Function ADD315 0
14 ADD314 0
13 ADD313 0
12 ADD312 0
11 ADD311 R/W 0
10 ADD310 0
9 ADD39 0
8 ADD38 0
23 Bit Symbol Read/Write Reset Value Function ADD323 0
22 ADD322 0
21 ADD321 0
20 Add320 0
19 ADD319 R/W 0
18 ADD318 0
17 ADD317 0
16 ADD316 0
31 Bit Symbol Read/Write Reset Value Function ADD331 0
30 ADD330 0
29 ADD329 0
28 ADD328 0
27 ADD327 R/W 0
26 ADD326 0
25 ADD325 0
24 ADD324 0
TMP19A71
16-4
Under Development
TMP19A71
7 ADDREG4 (0xFFFF_E550) Bit Symbol Read/Write Reset Value Function ADD47 0
6 ADD46 0
5 ADD45 0
4 R/W 1
3 1
2 1
1 1
0 1
15 Bit Symbol Read/Write Reset Value Function ADD415 0
14 ADD414 0
13 ADD413 0
12 ADD412 0
11 ADD411 R/W 0
10 ADD410 0
9 ADD49 0
8 ADD48 0
23 Bit Symbol Read/Write Reset Value Function ADD423 0
22 ADD422 0
21 ADD421 0
20 ADD420 0
19 ADD419 R/W 0
18 ADD418 0
17 ADD417 0
16 ADD416 0
31 Bit Symbol Read/Write Reset Value Function ADD431 0
30 ADD430 0
29 ADD429 0
28 ADD428 0
27 ADD427 R/W 0
26 ADD426 0
25 ADD425 0
24 ADD424 0
7 ADDREG5 (0xFFFF_E554) Bit Symbol Read/Write Reset Value Function ADD57 0
6 ADD56 0
5 ADD55 0
4 R/W 1
3 1
2 1
1 1
0 1
15 Bit Symbol Read/Write Reset Value Function ADD515 0
14 ADD514 0
13 ADD513 0
12 ADD512 0
11 ADD511 R/W 0
10 ADD510 0
9 ADD59 0
8 ADD58 0
23 Bit Symbol Read/Write Reset Value Function ADD523 0
22 ADD522 0
21 ADD521 0
20 ADD520 0
19 ADD519 R/W 0
18 ADD518 0
17 ADD517 0
16 ADD516 0
31 Bit Symbol Read/Write Reset Value Function ADD531 0
30 ADD530 0
29 ADD529 0
28 ADD528 0
27 ADD527 R/W 0
26 ADD526 0
25 ADD525 0
24 ADD524 0
TXMP9A70
16-5
TMP19A71
7
ADDREG6 (0xFFFF_E558) Bit Symbol Read/Write Reset Value Function ADD67 0
6
ADD66 0
5
ADD65 0
4
R/W 1
3
1
2
1
1
1
0
1
15
Bit Symbol Read/Write Reset Value Function ADD615 0
14
ADD614 0
13
ADD613 0
12
ADD612 0
11
ADD611 R/W 0
10
ADD610 0
9
ADD69 0
8
ADD68 0
23
Bit Symbol Read/Write Reset Value Function ADD623 0
22
ADD622 0
21
ADD621 0
20
ADD620 0
19
ADD619 R/W 0
18
ADD618 0
17
ADD617 0
16
ADD616 0
31
Bit Symbol Read/Write Reset Value Function ADD631 0
30
ADD630 0
29
ADD629 0
28
ADD628 0
27
ADD627 R/W 0
26
ADD626 0
25
ADD625 0
24
ADD624 0
7
ADDREG7 Bit Symbol (0xFFFF_E55C) Read/Write Reset Value Function ADD77 0
6
ADD76 0
5
ADD75 0
4
R/W 1
3
1
2
1
1
1
0
1
15
Bit Symbol Read/Write Reset Value Function ADD71 5 0
14
ADD714
13
ADD713
12
ADD712
11
ADD711 R/W
10
ADD710
9
ADD79
8
ADD78
0
0
0
0
0
0
0
23
Bit Symbol Read/Write Reset Value Function ADD72 3 0
22
ADD722
21
ADD721
20
ADD720
19
ADD719 R/W
18
ADD718
17
ADD717
16
ADD716
0
0
0
0
0
0
0
31
Bit Symbol Read/Write Reset Value Function ADD73 1 0
30
ADD730
29
ADD729
28
ADD728
27
ADD727 R/W
26
ADD726
25
ADD725
24
ADD724
0
0
0
0
0
0
0
Note: DMA transfer cannot be performed to an address register. DMA transfer can be performed to a data area in the RAM which contains substitution data. The ROM correction function can be used when either the TX19A core processor or DMAC owns the bus.
TMP19A71
16-6
TMP19A71
17. Flash Memory
This chapter describes the hardware configuration and operation of the flash memory contained in the TMP19A71.
17.1
Overview
Features
1) Memory capacity The TMP19A71 contains 2 Mbits (256 Kbytes) of flash memory, which is divided into two 128-Kbyte blocks. Each block can be independently protected from program and erase operations. While the TX19A core processor can access the flash memory through a full 32-bit data bus, an external flash programmer can only access the flash memory through a 16-bit data bus. Program and erase times Chip program time (including verify): 5 seconds (typ.) Chip erase time (including verify): 20 seconds (typ.)
Note: These program and erase times are typical values not including data transfer overhead. The actual chip program and erase times depend on the programming method used.
17.1.1
2)
3)
Programming modes The TMP19A71 flash memory can be programmed while mounted on a user board (On-Board Programming mode) or by using an EPROM programmer (Programmer mode).
* On-Board Programming modes
1) User Boot mode A user-created programming algorithm can be used. 2) Single Boot mode A Toshiba-defined serial interface protocol is used. * Programmer mode A general-purpose programmer can be used. (T. B. D)
5) Programming method Programming operations of the TMP19A71 flash memory are controlled by commands except for a few functions. The TMP19A71 contains a command sequencer which recognizes programming commands and automatically executes corresponding sequences of operation. This feature eliminates the need for the user to code complex program and erase sequences. The TMP19A71 provides an anti-programmer security feature for protecting the on-chip flash memory from being read by programming equipment. The TMP19A71 also allows the user to protect individual blocks of the flash memory from program or erase operations. This block protection feature is implemented by software; the hardware method (high voltage application) is not supported. The anti-programmer security feature is automatically enabled when both of the two blocks are placed under protection. When the Unprotect command is executed, the flash memory is automatically erased before block protection is lifted to ensure data security.
TMP19A71
17-1
TMP19A71
Table 17.1.1 Modified/Deleted Auto Programming Features
Available Auto Programming Features * Auto Program * Auto Chip Erase * Auto Block Erase * Auto Multi-Block Erase * Data Polling Modified/Deleted Features Modified: Block protection is available only under software control. Deleted: Erase Resume/Suspend mode
17.1.2
Block Diagram
Internal Address Bus Internal Data Bus Internal Control Bus
Mode Setting Internal Signal
Mode Control Control
ROM Controller Address Data Flash Memory
Control Logic Command Sequencer RDY/BSY Output
Address Latch
Data Latch
Column Decoder/Sense Amp Row Decoder
Flash Memory Array 256 KB
Erase Block Decoder
Figure 17.1.1
Flash Memory Block Diagram
TMP19A71
17-2
TMP19A71
17.2
Operating Modes
The TMP19A71 offers a total of four operating modes as shown in the table below. Table 17.2.1 Operating Modes Operating Mode Description
After a reset, the TX19A core processor executes out of the on-chip flash memory.
Single-Chip Mode
Normal Mode
Single-Chip mode is further divided into Normal mode in which the user application executes and User Boot mode which allows for re-programming of the flash memory while the TMP19A71 is installed on a printed circuit board. The user can freely define how to switch between Normal mode and User Boot mode. For example, the logic state on Port 00 can be used to determine whether to put the flash memory in Normal mode or User Boot mode. In this case, the user must include a routine in the application program to test the state of that port. After a reset, the TX19A core processor executes out of the on-chip boot ROM (which is a mask ROM). The boot ROM contains a routine to aid users in performing on-board programming of the flash memory via a serial port of the TMP19A71. The serial port is connected to an external host which transfers new data according to a prescribed protocol. This mode allows for re-programming of the flash memory with a general-purpose EPROM programmer. Use the programmer and programming adaptor recommended by Toshiba.
User Boot Mode
Single Boot Mode
Programmer Mode
The on-chip flash memory can be programmed in one of the following three modes: User Boot mode, Single Boot mode and Programmer mode. Of these modes, User Boot mode and Single Boot mode allow the flash memory to be programmed while the TMP19A71 is mounted on a printed circuit board. These two modes are collectively referred to as on-board programming modes.
TMP19A71
17-3
TMP19A71
The logic states on the TEST0, P90 to P93 and P94 (BOOT) pins during a reset sequence determine the mode of operation for the flash memory, as shown in Table 17.2.2. After the reset state is released, P94 (BOOT) and P90 to P93 can be configured as general-purpose I/O pins. After a reset, the TX19A core processor operates in compliance with the selected mode. When Programmer mode is selected, however, the RESET pin must be held at logic 0. The input pins listed in Table 17.2.2 must remain stable once the flash memory is put in a given mode of operation. Table 17.2.2 Modes of Operation
Operating Mode (1) Single-Chip Mode (2) Single Boot Mode (3) Programmer Mode Input Pins RESET 01 01 0 P90
(Note ) (Note )
P91
(Note ) (Note )
P92
(Note ) (Note )
P93
(Note ) (Note )
BOOT 1 0
(Note )
1
1
0
0
TEST0 0 0 1
TEST1 0 0 0
Note: Don't care. The pins must be held at 0 or 1.
(3) Programmer Mode Any condition other than (3) RESET = 0 (1) RESET = 0 (2)
Reset
RESET = 0 Single-Chip Mode Single Boot Mode
Normal Mode
User Boot Mode
User-defined condition
On-Board Programming Mode
Parenthesized numbers indicate that the relevant pins are at the logic states shown in Table 17.2.2.
Figure 17.2.1 Mode Transitions
17.2.1
Reset Operation
To reset the TMP19A71, the RESET input must be kept at logic 0 at least for 10 ms after power-up.
TMP19A71
17-4
TMP19A71 17.2.2 Memory Maps
The memory map for the TMP19A71 varies according to the mode of operation selected for the on-chip flash memory, as shown below.
Single-Chip Mode On-Chip Peripherals
On-Chip RAM (10KB)
Single Boot Mode 0xFFFF_FFFF On-Chip Peripherals On-Chip RAM (Reserved) Used for debugging (Reserved) (Reserved) (Reserved) On-Chip Flash ROM Inaccessible 0x2000_0000 0x1FC3_FFFF (512 MB) 0x2000_0000 0xFFFF_FFFF
Programmer Mode Inaccessible 0xFFFF_FFFF
0xFFFF_BFFF 0xFFFF_9800 0xFF3F_FFFF 0xFF20_0000 0xFF00_0000 0xC000_0000 0xBF00_0000 0x4003_FFFF 0x4000_0000
0xFFFF_BFFF 0xFFFF_9800 0xFF3F_FFFF 0xFF20_0000 0xFF00_0000 0xC000_0000 0xBF00_0000 0x4003_FFFF 0x4000_0000 Inaccessible (512 MB) Inaccessible 0x2000_0000 0x4000_0000 Inaccessible 0xC000_0000
(Reserved) Used for debugging (Reserved) (Reserved) (Reserved) On-Chip ROM Shadow Inaccessible (512 MB)
User Program Area Maskable Interrupt Area Exception Vector Area
Boot MROM (KB) 0x1FC0_0000 0x0000_0000
0x1FC0_1FFF 0x1FC0_0000 0x0000_0000 On-Chip Flash ROM 0x0003_FFFF
0x0000_0000
Note: The addresses shown above are physical addresses.
Figure 17.2.2 TMP19A71 Memory Maps
When the TMP19A71 is started in Single Boot mode, the boot ROM (mask ROM) is mapped to an 8-Kbyte area starting from the reset vector (0x1FC0_0000), and the flash memory is mapped from 0x4000_0000. When the TMP19A71 is started in Single-Chip mode, the flash memory is mapped from the reset vector, and the flash memory shadow is mapped from 0x4000_0000. The following descriptions use virtual addresses, unless otherwise noted.
TMP19A71
17-5
TMP19A71
As shown in Figure 17.2.3, the TMP19A71 flash memory is comprised of two 128-Kbyte blocks.
256KB 128KB 128KB Block 0 Block 1
Figure 17.2.3 Flash Memory Block Architecture Table 17.2.3
Single-Chip mode Block 0 Block 1 0xBFC0_0000 to 0xBFC_FFFF (Shadow: 0x0000_0000 to 0x0001_FFFF) 0xBFC2_0000 to 0xBFC3_FFFF (Shadow: 0x0002_0000 to 0x0003_FFFF)
Block Addresses Based on Mode Setting
Single Boot mode 0x0000_0000 to 0x000_FFFF 0x0002_0000 to 0x0003_FFFF Programmer mode 0x0000_0000 to 0x0001_FFFF 0x0002_0000 to 0x0003_FFFF
17.2.3
Block Protection
The TMP19A71 flash memory is comprised of two 128-Kbyte blocks. To protect stored data from any program and erase operations, each block has a protect bit, which can be set by executing the Block Protect command sequence. Blocks in protection mode are protected from even the Chip Erase and Multi-Block Erase commands; these commands erase only unprotected blocks. Since protection status is stored in flash memory cells, it is retained if the chip is powered off. When both blocks are protected, the data stored in them cannot be read in Programmer mode, which provides a security feature (hereinafter referred to as the anti-programmer security feature).
17.2.4
Security Features When the TX19A Core Processor Is Active
Table 17.2.4 shows the security features available when the TX19A core processor is active. BLKA indicates Block 0 (at addresses 0xBFC0_0000 to 0xBFC1_FFFF), and BLKB indicates Block 1 (at addresses 0xBFC2_0000 to 0xBFC3_FFFF). In Programmer mode in which a general-purpose EPROM programmer is used, the security features available differ from those shown in the table below.
Table 17.2.4 Security Features of the TX19A Core Processor
DSU Function BLKA Write Protect BLKB Write Protect Use of DSU BLKA Read BLKB Read BLKA Program (Write) BLKB Program (Write) BLKA Erase BLKB Erase Chip Erase BLK Protect BLK Protect Unprotect (All Blocks) ID Read/Protect Verify Enabled Disabled OFF ON OFF ON OFF ON OFF ON OFF ON OFF ON Yes Yes Yes ----No Yes Yes Yes ----Yes Yes Yes Yes ----Yes Yes Yes No ----No Yes No Yes ----No Yes Yes x ----No Yes No Yes ----No Yes Yes*1Yes*1 ----No Yes Yes Yes ----Yes Yes Yes Yes ---Yes Yes Yes Yes ----Yes Yes Yes Yes ----Yes
Yes: Can be used No: Cannot be used --: Not supported *1: The Chip Erase command erases only unprotected blocks.
TMP19A71
17-6
TMP19A71 DSU (EJTAG)-Probe Interface
The DSU-probe interface is used solely for software debugging using an external DSU-probe unit. Consult the DUS-probe operation manual for the details on debugging using the DSU-probe. When the TMP19A71 is in DUS (EJTAG) mode, the on-chip flash memory provides a security feature. (1) Permitting and prohibiting the use of a DSU-probe The TMP19A71 supports on-board debugging while it is installed on a printed circuit board. The TMP19A71 provides a feature to prohibit the use of a DSU-probe to prevent intrusive access to the flash memory. In DSU Prohibit mode, a DSU-probe is denied access to the entirety of the flash memory. (2) DSU Prohibit mode (Disabling debugging with a DSU-probe) Once program debugging is completed, write the Protect command to both blocks. This turns on the anti-programmer security feature. While the flash memory is in the secure state, a DSU-probe cannot read its contents. When the chip is powered off and powered on again, the flash memory is put in DSU Prohibit mode, which disables debugging using a DSU-probe until the flash memory exits DSU Prohibit mode. (3) DSU Permit mode (Enabling debugging with a DSU-probe) The flash memory can only be brought out of DSU Prohibit mode by clearing the DSUOFF bit in the SEQMOD to 0 and then writing a special code (0x0000_00C5) to the DSU Security Control (SEQCNT) register. This prevents runaway software from inadvertently turning off the DSU Prohibit feature. When the flash memory exits DSU Prohibit mode, the DSU interface is enabled. The flash memory can be secured again by setting the DSUOFF bit in the SEQMOD to 1 and writing 0x0000_00C5 to the SEQCNT while the chip is powered. DSU Security Mode Register
7 SEQMOD (0xFFFF_E510) 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 Note 1: The setting of the DSUOFF bit takes effect after the SEQCNT register is set. Note 2: This register must be accessed as a 32-bit quantity. Bits 1 to 31 are read as 0. Note 3: In the flash-version device, this register is initialized by a power-on reset. Note 4: This register does not support bit manipulation instructions. R 0 30 R 0 29 R 0 28 R 0 27 R 0 26 R 0 25 R 0 24 R 0 R 0 22 R 0 21 R 0 20 R 0 19 R 0 18 R 0 17 R 0 16 R 0 R 0 14 R 0 13 R 0 12 R 0 11 R 0 10 R 0 9 R 0 R 0 6 R 0 5 R 0 4 R 0 3 R 0 2 R 0 1 R 0 0 DSUOFF R/W 1 1: DSU disabled 0: DSU enabled 8 R 0
TMP19A71
17-7
TMP19A71
DSU Security Control Register
7 SEQCNT (0xFFFF_E514) 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 30 29 22 21 14 13 6 5 4 3 2 1 0 W Must be written as 0x0000_00C5. 12 11 10 9 8 W Must be written as 0x0000_00C5. 20 19 18 17 16 W Must be written as 0x0000_00C5. 28 27 26 25 24 W Must be written as 0x0000_00C5.
Note 1: This register must be accessed as a 32-bit quantity. Note 2: This register does not support bit manipulation instructions.
(4) Application example The following flowchart shows an example of how to use the security feature with a DSU-probe.
TMP19A71
DUS prohibited at power-up
(In mask ROM version, DSU is prohibited by reset.)
External port data, etc.
DSU permission judgment routine (user-created)
N
Exit DUS Prohibit mode? Y Program SEQMOD and SEQCNT to exit DSU Prohibit mode
[DSU Prohibit mode] The DSU-probe cannot be used.
[DSU Permit mode] The DSU -probe can be used until the chip is powered off.
Figure 17.2.4 Using the DSU Prohibit Feature
TMP19A71
17-8
TMP19A71
17.3
On-Board Programming Mode
On-board programming allows re-programming of the flash memory while the TMP19A71 is soldered on a printed circuit board. The TMP19A71 provides two types of on-programming mode. In Single Boot mode, new data comes from a serial port under control of a Toshiba-provided routine in the boot ROM. User Boot mode allows you to create an algorithm of your own for flash memory erase and program operations. The TMP19A71 flash memory provides an anti-programmer security feature to prevent intrusive access to the flash memory while in Programmer mode. This security feature can be enabled upon completion of on-board programming to protect ROM data from being read by third parties.
17.3.1
User Boot Mode (Single-Chip Mode)
User Boot mode allows you to create a programming algorithm of your own. User Boot mode is one of the two submodes in Single-Chip mode; the other submode is Normal mode in which the TX19A core processor executes the user application. To re-program the flash memory, the mode of operation must be switched from Normal mode to User Boot mode. The user application code must include a mode judgment routine. The user must define the conditions for mode switching, based on the logic states on I/O ports of the TMP19A71. Additionally, the user must incorporate a programming algorithm into the user application code. After User Boot mode is entered, this programming algorithm is copied into the on-chip RAM to re-program the flash memory. The flash memory cannot be read while it is being erased or programmed. While the flash memory is being erased or programmed, all interrupts including nonmaskable interrupts must be disabled. Once re-programming is complete, it is recommended to protect flash memory blocks as required from accidental corruption. The pages that follow describe the general procedures for two cases where the programming routine is: a) stored within the TMP19A71 flash memory, and b) loaded from an external controller. For a detailed description of program and erase operations, see Section 17.4 On-Board Programming and Erasure.
TMP19A71
17-9
TMP19A71
User Boot Mode (1-A) Method 1: Storing a programming routine in the flash memory (1) Determine the conditions (e.g., pin states) required for the flash memory to enter User Boot mode and the I/O bus to be used to transfer new program code. Create hardware and software accordingly. Before installing the TMP19A71 on a printed circuit board, write the following program routines into a flash block using programming equipment. (a) Mode judgment routine: Code to determine whether or not to switch to User Boot mode (b) Programming routine: Code to download new program code from a host controller and (c) Copy routine: re-program the flash memory Code to copy the flash programming routine from the TMP19A71 flash memory to the TMP19A71 on-chip RAM
Routines (a), (b) and (c) are collectively called the programming procedure.
Host Controller
New Application Program Code
TMP19A71
Flash Memory Old Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
I/O
(b) Programming Routine (c) Copy Routine
RAM
(2) The mode judgment routine written in one of the blocks in the flash memory determines whether to put the TMP19A71 flash memory in User Boot mode. If the specified conditions are met, the flash memory enters User Boot mode.
Host Controller
New Application Program Code
TMP19A71
Flash Memory Old Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
I/O 0 1 RESET
(b) Programming Routine (c) Copy Routine
Conditions for entering User Boot mode (defined by the user) RAM
TMP19A71
17-10
TMP19A71
(3) Once User Boot mode is entered, execute the copy routine to copy the flash programming routine to the TMP19A71 on-chip RAM.
Host Controller
New Application Program Code
TMP19A71
Flash Memory Old Application Program Code
I/O
(b) Programming Routine
[Programming Procedure]
(a) Mode Judgment Routine
(b) Programming Routine (c) Copy Routine
RAM
(4) Jump program execution to the flash programming routine in the on-chip RAM to erase the flash block containing the old application program code. All interrupts including RESET and NMI must be disabled until new application program code has been written to the flash memory.
Host Controller I/O
New Application Program Code
TMP19A71
Flash Memory (Erased)
(b) (b) Programming Routine
[Programming Procedure]
(a) Mode Judgment Routine
(b) Programming Routine (c) Copy Routine
RAM
TMP19A71
17-11
TMP19A71
(5) Continue executing the flash programming routine to download new application program code from the host controller and program it into the erased flash block. Once programming is complete, turn on the protection of that flash block.
Host Controller
New Application Program Code
TMP19A71
Flash Memory New Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
I/O
(b) (b) Programming Routine
(b) Programming Routine (c) Copy Routine
RAM
(6) Drive the RESET pin low to reset the TMP19A71 and enter Normal mode or jump to an arbitrary address to execute the new user application program.
Host Controller
TMP19A71
Flash Memory New Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
I/O 0 1 RESET
Set to Normal mode
(b) Programming Routine (c) Copy Routine
RAM
TMP19A71
17-12
TMP19A71
(1-B) Method 2: Transferring a programming routine from an external host (1) Determine the conditions (e.g., pin states) required for the flash memory to enter User Boot mode and the I/O bus to be used to transfer new program code. Create hardware and software accordingly. Before installing the TMP19A71 on a printed circuit board, write the following program routines into a flash block using programming equipment. (a) Mode judgment routine: (b) Transfer routine: Code to determine whether or not to switch to User Boot mode Code to download new program code from a host controller
Routines (a) and (b) are collectively called the programming procedure. Also, prepare the following routine on the host controller. (c) Programming routine: Code to re-program the flash memory
Host Controller I/O
New Application Program Code
(c) Programming Routine
TMP19A71
Flash Memory Old Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
RAM
(b) Transfer Routine
(2) The mode judgment routine written in one of the blocks in the flash memory determines whether to put the TMP19A71 flash memory in User Boot mode. If the specified conditions are met, the flash memory enters User Boot mode.
Host Controller I/O
New Application Program Code
(c) Programming Routine
TMP19A71
Flash Memory Old Application Program Code [Programming Procedure]
(a) Mode Judgment Routine
0 1 RESET
RAM
Conditions for entering User Boot mode (defined by the user)
(b) Transfer Routine
TMP19A71
17-13
TMP19A71
(3) Once User Boot mode is entered, execute the transfer routine to download the flash programming routine from the host controller to the TMP19A71 on-chip RAM.
Host Controller I/O
New Application Program Code
(c) Programming Routine
TMP19A71
Flash Memory Old Application Program Code
(c) Programming Routine
[Programming Procedure]
(a) Mode Judgment Routine
RAM
(b) Transfer Routine
(4) Jump program execution to the flash programming routine in the on-chip RAM to erase a flash block containing the old application program code. All interrupts including RESET and NMI must be disabled until new application program code has been written to the flash memory.
Host Controller I/O
New Application Program Code
(c) Programming Routine
TMP19A71
Flash Memory (Erased) (c) Programming Routine [Programming Procedure]
(a) Mode Judgment Routine
RAM
(b) Transfer Routine
TMP19A71
17-14
TMP19A71
(5)
Continue executing the flash programming routine to download new application program code and program it into the erased flash block. Once programming is complete, turn on the protection on that flash block.
Host Controller I/O
New Application Program Code
(c) Programming Routine
TMP19A71
Flash Memory New Application Program Code
(c) Programming Routine
[Programming Procedure]
(a) Mode Judgment Routine
RAM
(b) Transfer Routine
(6) Drive the RESET pin low to reset the TMP19A71 and enter Normal mode or jump to an arbitrary address to execute the new user application program.
Host Controller I/O
TMP19A71
Flash Memory New Application Program Code
0 1 RESET
Set to Normal mode [Programming Procedure]
(a) Mode Judgment Routine
RAM
(b) Transfer Routine
TMP19A71
17-15
TMP19A71 17.3.2 Single Boot Mode
In Single Boot mode, the flash memory can be re-programmed by using a program contained in the TMP19A71 on-chip boot ROM. This boot ROM is a masked ROM. When Single Boot mode is selected upon reset, the boot ROM is mapped to the address region including the interrupt vector table while the flash memory is mapped to an address region different from it (see Figure 17.2.2). Single Boot mode allows for serial programming of the flash memory. The SIO (SIO2) of the TMP19A71 is connected to an external host controller. Via this serial link, a programming routine is downloaded from the host controller to the TMP19A71 on-chip RAM. Then, the flash memory is re-programmed by executing the programming routine. The host sends out both commands and programming data to re-program the flash memory. Communications between the SIO2 and the host must follow the prescribed protocol described later. To secure the contents of the flash memory, password verification is performed before a programming routine is downloaded into the on-chip RAM. If password verification fails, the transfer of a programming routine itself is aborted. All interrupts including nonmaskable interrupts must be disabled while the boot program is executed. Once re-programming is complete, it is recommended to protect flash memory blocks as required from accidental corruption during subsequent operation in Single-Chip (Normal) mode. For a detailed description of erase and program operations, see section 17.4 On-Board Programming and Erasure.
TMP19A71
17-16
TMP19A71
Single Boot Mode (2-A) General procedure: Using a programming algorithm in the on-chip boot ROM (1) The flash block containing the older version of the program code need not be erased before executing the programming routine. Since a programming routine and programming data are transferred via the UART2 or SIO2, the UART 2 or SIO2 pins must be connected to a host controller. Prepare a programming routine on the host controller. (The SIO2 is used here.)
Host Controller I/O
New Application Program Code
(a) Programming Routine
TMP19A71
Boot ROM Flash Memory SIO2
Old Application Program Code (or Erased State)
RAM
(2)
Reset the TMP19A71 with the mode setting pins held at appropriate logic values for re-booting from the on-chip boot ROM. In Single Boot mode, the 12-byte password transferred from the host controller is first compared to the password stored in the user application program in the flash memory. (If the flash memory has already been erased, password verification is performed using the erased data.)
Host Controller I/O New Application Program Code
(a) Programming Routine
TMP19A71
Boot ROM Flash Memory SIO2
0 1 RESET
Old Application Program Code (or Erased State)
RAM
TMP19A71
17-17
TMP19A71
(3)
If password verification is successful, the boot program loads the programming routine from the host controller into the on-chip RAM. The programming routine must be stored in the address range of 0xFFFF_9800 to 0xFFFF_AFFF.
Host Controller I/O
New Application Program Code
(a) Programming Routine
TMP19A71
Boot ROM Flash Memory SIO2
Old Application Program Code (or Erased State)
(a) Programming Routine
RAM
(4) The TX19A core processor jumps to the programming routine in the on-chip RAM to erase the flash block containing the old application program code. (The Block Erase or Chip Erase command may be used.)
Host Controller I/O
New Application Program Code
(a) Programming Routine
TMP19A71
Boot ROM Flash Memory SIO2
(a) Programming Routine
Erased RAM
TMP19A71
17-18
TMP19A71
(5) Next, the programming routine loads new application program code from the host controller into the erased flash block. Once programming is complete, the flash block is placed under protection. In the example below, new program code comes from the same host controller via the same SIO channel as for the programming routine. However, once the programming routine has begun to execute, the transfer path and the source of the transfer can be changed as desired. Create board hardware and a programming routine to suit your particular needs.
Note: The boot ROM provides no vector area for all maskable interrupts and NMI. While the programming routine is executed, no exception should be allowed to occur.
Host Controller I/O
New Application Program Code
(a) Programming Routine
TMP19A71
Boot ROM Flash Memory SIO2
New Application Program Code
(a) Programming Routine
RAM
(6)
When the flash memory has been programmed, power off the board and disconnect the cable connecting the host controller. Then, turn on the power again and re-boot the TMP19A71 in Single-Chip mode (Normal mode) to execute the new application program.
Host Controller
TMP19A71
Boot ROM Flash Memory SIO2
0 1 RESET
New Application Program Code RAM
Set to Single-Chip mode (Normal mode)
TMP19A71
17-19
TMP19A71
(1) Connection examples in Single Boot mode In Single Boot mode, serial transfer is used to re-program the flash memory while the TMP19A71 is installed on a printed circuit board. In this mode, the SIO (channel 2) of the TMP19A71 is connected to a host controller (programming tool). The host controller issues commands to the target board to perform programming operations. Figure 17.3.1 and Figure 17.3.2 show examples of host-to-target connection.
Host Controller AC 100V VCC Target Board
Reg.
VCC Mode Control
VCC
Reg. TMP19A71
MCU
DVCC2
NMI RESET Boot Mode Selection Logic
RESET
Mode Control
TMODE
BOOT
ROM
RAM
RX
RX2 (P85)
RS232C
TX
TX2 (P86)
VSS
DVSS
PC
Figure 17.3.1
Example of Connection between a Host Controller and a Target Board in Single Boot Mode (when the SIO2 is configured for UART mode)
TMP19A71
17-20
TMP19A71
Host Controller AC 100V VCC
Target Board
Reg.
VCC Mode Control
VCC
Reg. TMP19A71
DVCC2
MCU
NMI
RESET
RESET Boot Mode Selection Logic
Mode Control
TMODE
BOOT
ROM
RAM TCK
RX
SCLK2 (P87)
RX2 (P85)
RS232C
TX
TX2 (P86)
TBUSY
VSS
P80
DVSS
PC
Figure 17.3.2
Example of Connection between a Host Controller and a Target Board in Single Boot Mode (when the SIO2 is configured for I/O Interface mode)
TMP19A71
17-21
TMP19A71
(2) Configuring for Single Boot mode To perform on-board programming, boot up the TMP19A71 in Single Boot mode, as shown below. TEST0 BOOT RESET =0 =0 =01
While the RESET pin is held at logic 0, set the TEST0 and BOOT (P94) pins at the logic values shown above. Then, driving the RESET pin high boots up the TMP19A71 in Single Boot mode. (3) Memory map Figure 17.3.3 shows a comparison of the memory maps in Single-Chip (Normal) mode and Single Boot mode. In Single Boot mode, the on-chip flash memory is mapped to physical addresses 0x4000_0000 through 0x400F_FFFF and virtual addresses 0x0000_0000 through 0x000F_FFFF. The on-chip boot ROM (mask ROM) is mapped to physical addresses 0x1FC0_0000 through 0x1FC0_1FFF.
Normal Mode
On-Chip Peripherals
On-Chip RAM (10KB)
Single Boot Mode
0xFFFF_FFFF On-Chip Peripherals
On-Chip RAM (10KB)
0xFFFF_FFFF
0xFFFF_BFFF 0xFFFF_9800 0xFF3F_FFFF 0xFF20_0000 0xFF00_0000 0xC000_0000 0xBF00_0000 0x400F_FFFF 0x4000_0000
0xFFFF_BFFF 0xFFFF_9800 0xFF3F_FFFF 0xFF20_0000 0xFF00_0000 0xC000_0000 0xBF00_0000 0x4003_FFFF 0x4000_0000
(Reserved) Used for debugging (Reserved) (Reserved) (Reserved) On-Chip ROM Shadow Inaccessible (512 MB)
(Reserved) Used for debugging (Reserved) (Reserved) (Reserved) On-Chip Flash ROM Inaccesible
0x2000_0000 0x1FC3_FFFF 0x1FC0_0400
(512 MB)
0x2000_0000
User Program Area Internal ROM Maskable Interrupt Area Exception Vector Area
Boot MROM (6 KB) 0x1FC0_0000 0x0000_0000
0x1FC0_1FFF 0x1FC0_0000 0x0000_0000
Note: The addresses shown above are physical addresses.
Figure 17.3.3 Memory Maps for Normal and Single Boot Modes
TMP19A71
17-22
TMP19A71
(4) Interface Specifications In Single Boot mode, an SIO channel is used for communications with a programming controller. Both UART (asynchronous) and I/O Interface (synchronous) modes are supported. To perform on-board programming, the interface specifications shown below must also be set on the controller side. * UART mode Communications channel Transfer mode Data length Parity bit STOP bit Baud rate Others * I/O Interface mode Communications channel Transfer mode Synchronization signal (SCLK2) Handshaking signal Baud rate Others : UART2 : UART (asynchronous) mode, full-duplex : 8 bits : None : 1 bit : Up to 437.5 kbps (at 56 Hz) Up to 312.5 kbps (at 40 Hz) : LSB first, SC2MOD2.WBUF=0
: SIO2 : I/O Interface mode, half-duplex SCLK input mode (SC2CR = 0x01) : P80 configured as an output : Up to 3 Mbps (at 56 Hz) Up to 2.5 Mbps (at 40 MHz) : LSB first, SC2MOD2.WBUF = 0
Table 17.3.1 Required Pin Connections
Pin UART Mode Power Supply Pins Mode Setting Pin
Reset Pin Communications Pins
Interface I/O Interface Mode Required Required Required
Required Required Required Required (Input Mode) Required (Output Mode)
DVCC3 DVSS
BOOT
RESET
Required Required Required
Required Required Required Not Required Not Required
TX2 RX2 SCLK2 P80
(5) Data Transfer Format Table 17.3.2 lists the commands to be issued from the host controller to the target board in Single Boot mode. Tables 17.3.3 to 17.3.5 illustrate the sequence of two-way communications that should occur in response to each command.
Table 17.3.2
Code 0x10 0x20 0x30
Single Boot Mode Commands
Command RAM Transfer Show Flash Memory Sum Show Product Information
TMP19A71
17-23
TMP19A71
Table 17.3.3 Transfer Format for the RAM Transfer Command
Byte Boot ROM 1st byte Data Transferred from the Controller to the TMP19A71 Serial operation mode and baud rate For UART mode 0x86 For I/O Interface mode (Note 2) 0x30 Baud Rate Specified baud rate (Note 1) Data Transferred from the TMP19A71 to the Controller
2nd byte
3rd byte 4th byte
Command code
(0x10)
5th byte to 16th byte 17th byte 18th byte
Password sequence (12 bytes) (0x0000_0474 to 0x0000_047F) Checksum value for 5th to 16th bytes (Note 4)
ACK for the serial operation mode byte For UART mode Normal acknowledge 0x86 (The boot program aborts if the baud rate cannot be set correctly.) For I/O Interface mode Normal acknowledge 0x30 ACK for the command code byte (Note 3) Normal acknowledge 0x30 Negative acknowledge 0x11 Communication error 0x18
19th byte 20th byte 21st byte 22nd byte 23rd byte 24th byte 25th byte 26th byte
RAM storage start address 31 to 24 (Note 5) RAM storage start address 23 to 16 (Note 5) RAM storage start address 15 to 8 (Note 5) RAM storage start address 7 to 0 (Note 5) RAM storage byte count 15 to 8 (Note 5) RAM storage byte count 7 to 0 (Note 5) Checksum value for 19th to 24th bytes (Note 4)
27th byte RAM storage data to mth byte (m + 1)th byte Checksum value for 27th to mth bytes (Note 4) (m + 2)th byte
ACK for the checksum byte (Note 3) Normal acknowledge 0x10 Negative acknowledge 0x11 Communication error 0x18 ACK for the checksum byte (Note 3) Normal acknowledge 0x10 Negative acknowledge 0x11 Communication error 0x18
RAM
(m + 3)th byte
ACK for the checksum byte (Note 3) Normal acknowledge 0x10 Negative acknowledge 0x11 Communication error 0x18 Jump to RAM storage start address
Note 1: Note 2:
In I/O Interface mode, the baud rate for transferring the 1st and 2nd bytes must be 1/16 of the specified baud rate. In I/O interface mode, a waveform that allows the serial operation mode to be determined should be generated.
Note 3: In case of any negative acknowledgment, the boot program returns to a state in which it waits for a command code (3rd byte). In I/O Interface mode, no acknowledgment is returned for a communicaion error. Note 4: The checksum value is obtained by adding all the bytes of transmitted data together, dropping the carries, and taking the two's complement of the total sum. Note 5: The 19th to 24th bytes must be within the RAM address range 0xFFFF_9800 to 0xFFFF_AFFF.
TMP19A71
17-24
TMP19A71
Table 17.3.4 Transfer Format for the Show Flash Memory SUM Command
Byte Boot ROM 1st byte Data Transferred from the Controller to the TMP19A71 Serial operation mode and baud rate For UART mode 0x86 For I/O Interface mode (Note 2) 0x30 Baud Rate Specified baud rate (Note 1) Data Transferred from the TMP19A71 to the Controller
2nd byte
3rd byte 4th byte
Command code
(0x20)
5th byte 6th byte 7th byte 8th byte
(Wait for the next command code.)
ACK for the serial operation mode byte For UART mode Normal acknowledge 0x86 (The boot program aborts if the baud rate cannot be set correctly.) For I/O Interface mode Normal acknowledge 0x30 ACK for the command code byte (Note 3) Normal acknowledge 0x20 Negative acknowledge 0x21 Communication error 0x28 SUM (upper byte) SUM (lower byte) Checksum value for 5th and 6th bytes (Note 4)
Note 1: Note 2: Note 3:
In I/O Interface mode, the baud rate for transferring the 1st and 2nd bytes must be 1/16 of the specified baud rate. In I/O Interface mode, a waveform that allows the serial operation mode to be determined should be generated. In case of any negative acknowledgment, the boot program returns to a state in which it waits for a command code (3rd byte). In I/O Interface mode, no acknowledgment is returned for a communication error.
Note 4: The checksum value is obtained by adding all the bytes of transmitted data together, dropping the carries, and taking the two's complement of the total sum. Note 5: The SUM value is the lower 16 bits of a value obtained by adding all the bytes in the flash memory together. SUM (high) = SUM[ 15 : 8 ], SUM (low) = SUM[ 7 : 0 ]
TMP19A71
17-25
TMP19A71
Table Byte Boot ROM 1st byte
17.3.5
Transfer Format for the Show Product Information Command (1/2)
Baud Rate Specified baud rate (Note 1) Data Transferred from the TMP19A71 to the Controller
Data Transferred from the Controller to the TMP19A71 Serial operation mode and baud rate For UART mode 0x86 For I/O Interface mode (Note 2) 0x30
2nd byte
3rd byte 4th byte
Command code
(0x30)
5th byte 6th byte 7th byte 8th byte 9th byte to 20th byte 21st byte to 24th byte 25th byte to 28th byte 29th byte to 32nd byte 33rd byte to 36th byte 37th byte to 40th byte 41st byte to 44th byte 45th byte to 46th byte 47th byte to 50th byte 51st byte to 54th byte 55th byte to 56th byte 57th byte to 60th byte

ACK for the serial operation mode byte For UART mode Normal acknowledge 0x86 (The boot program aborts if the baud rate cannot be set correctly.) For I/O Interface mode Normal acknowledge 0x30 ACK for the command code byte (Note 3) Normal acknowledge 0x30 Negative acknowledge 0x31 Communication error 0x38 Flash memory data (at address 0x0000_0470) Flash memory data (at address 0x0000_0471) Flash memory data (at address 0x0000_0472) Flash memory data (at address 0x0000_0473) Product name (12-byte ASCII code) `TX19A71FY' + 0x20, 0x20, 0x20 from the 9th byte Password comparison start address (4 bytes) 0x74, 0x04, 0x00, 0x00 from the 21st byte RAM start address (4 bytes) 0x00,0x98, 0xFF, 0xFF from the 25th byte Dummy data (4 bytes) 0xFF, 0xA7, 0xFF, 0xFF from the 29th byte RAM end address (4 bytes) 0xFF, 0xBF, 0xFF, 0xFF from the 33rd byte Dummy data (4 bytes) 0x00, 0xA8, 0xFF, 0xFF from the 37th byte Dummy data (4 bytes) 0xFF, 0xAF, 0xFF, 0xFF from the 41st byte Fuse information (2 bytes) 0x00, 0x00 from the 45th byte Flash memory start address (4 bytes) 0x00, 0x00, 0x00, 0x00 from the 47th byte Flash memory end address (4 bytes) 0xFF, 0xFF, 0x03, 0x00 from the 51st byte Flash memory block count (2 bytes) 0x02, 0x00 from the 55th byte Start address of a group of the same-size flash blocks (4 bytes) 0x00, 0x00, 0x00, 0x00 from the 57th byte


TMP19A71
17-26
TMP19A71
Table 17.3.5 Transfer Format for the Show Device Information Command (2/2)
Byte Root ROM 61st byte to 64th byte 65th byte 66th byte 67th byte Data Transferred from the Controller to the TMP19A71
Baud Rate
Data Transferred from the TMP19A71 to the Controller Size (in half words) of the same-size flash blocks (4 bytes) 0x00, 0x00, 0x01, 0x00 from the 61st byte Number of flash blocks of the same size (1 byte) 0x02 Checksum value for the 5th to 65th bytes (Note 4)
(Wait for the next command code.)
Note 1: Note 2: Note 3:
In I/O Interface mode, the baud rate for transferring the 1st and 2nd bytes must be 1/16 of the specified baud rate. In I/O Interface mode, a waveform that allows the serial operation mode to be determined should be generated. In case of any negative acknowledgment, the boot program returns to a state in which it waits for a command code (3rd byte). In I/O Interface mode, no acknowledgment is returned for a communication error.
Note 4:
The checksum value is obtained by adding all the bytes of transmitted data together, dropping the carries, and taking the two's complement of the total sum.
TMP19A71
17-27
TMP19A71
(6) Overview of the boot program commands When Single Boot mode is selected, the boot program is automatically executed on startup. The boot program offers the following three commands (each command is explained in detail in the subsections that follow): 1. RAM Transfer command The RAM Transfer command stores program code transferred from a host controller to the on-chip RAM and executes the program once the transfer is successfully completed. The maximum program size is 6 Kbytes (0xFFFF_9800 to 0xFFFF_AFFF). The RAM Transfer command enables the user to control on-board programming of the flash memory in a unique manner by providing the means for downloading a user-created programming routine. The programming routine must use the flash memory command sequences described in section 17.4 On-Board Programming and Erasure. Before initiating a transfer, the RAM Transfer command checks a password sequence coming from the controller against the password stored in the flash memory. If they do not match, the RAM Transfer command aborts. 2. Show Flash Memory Sum command The Show Flash Memory Sum command adds the contents of the flash memory and returns the lower 16 bits of the result. The boot program does not provide a command to read out the contents of the flash memory. Instead, the Show Flash Memory Sum command can be used for software revision management. 3. Show Product Information command The Show Product Information command provides product information, such as the product name and on-chip memory configuration, stored at addresses 0x0000_0470 to 0x0000_0473 in the flash memory. In addition to the Show Flash Memory Sum command, this command can be used for software revision management.
TMP19A71
17-28
TMP19A71
1) RAM Transfer command (see Table 17.3.3) 1. The 1st byte specifies which one of the two serial operation modes is used. For a detailed description of how the serial operation mode is determined, see subsection 5) Determination of a serial operation mode. If it is determined as UART mode, the boot program then checks if the SIO2 is programmable to the baud rate at which the 1st byte was transferred. The 1st byte is transferred with receive operation disabled (SC2MOD.RXE = 0). * To communicate in UART mode The controller sends 86H to the target board in UART data format at the desired baud rate. If the serial operation mode is determined as UART, then the boot program checks if the SIO2 can be programmed to the baud rate at which the 1st byte was received. The time (number of instruction execution cycles) required for this operation varies with the operating frequency and baud rate used. If the desired baud rate cannot be used, the boot program aborts, disabling any subsequent communication. In this case, a reset is required. If necessary, the controller should set a time limit for transferring the 2nd byte as appropriate to the baud rate used. * To communicate in I/O Interface mode The controller sends the 1st byte to the target board to generate a waveform that allows the serial operation mode to be determined as I/O Interface mode. (For details, see subsection 5) Determination of a serial operation mode.) When the boot program determines that communications can be performed in I/O Interface mode at the desired baud rate, the handshake pin is driven high. If the high level is not detected on the handshake pin within the expected time period, this indicates that the boot program has aborted after determining that the SIO2 is not programmable to the desired baud rate. In this case, a reset is required. The command sequence must be started again from the 1st byte at another baud rate. In I/O Interface mode, the TX19A core processor sees the serial receive pin as if it were a general-purpose input port and monitors its logic transitions. If the baud rate of incoming data is high or the chip's operating frequency is high, the TX19A core processor may not be able to keep up with the speed of logic transitions. To prevent such situations, the 1st and 2nd bytes must be transferred at 1/16 of the desired baud rate; then the boot program calculates 16 times that as the desired baud rate. At this time, the transmission of one byte should be completed before an overflow occurs in the TMRB0 (see Figure 17.3.6). When the serial operation mode is determined as I/O Interface mode, the SIO2 is configured for SCLK Input mode. Beginning with the 3rd byte, the controller must ensure that the AC timing restrictions are satisfied at the selected baud rate. In I/O Interface mode, the boot program does not check the receive error flag; thus there is no such thing as error acknowledge (bit 3) (18H). 2. The 2nd byte, transmitted from the target board to the controller, is an acknowledge response to the 1st byte. The boot program echoes back the first byte: 86H for UART mode and 30H for I/O Interface mode. * UART mode If the SIO2 can be programmed to the baud rate at which the 1st byte was
TMP19A71
17-29
TMP19A71
transferred, the boot program programs the BR2CR and BR2ADD registers and sends back 86H to the controller as an acknowledge. If the SIO2 is not programmable at that baud rate, the boot program simply aborts with no error indication. Following the 1st byte, the controller should allow for a time-out period. If it does not receive 86H within the allotted time-out period, the controller should give up the communication. The boot program sets the RXE bit in the SC2MOD to 1 to enable reception before loading the transmit buffer with 86H. * I/O Interface mode The boot program programs the SC2MOD and SC2CR registers to configure the SIO2 in I/O Interface mode and writes 30H to the SC2BUF. Then, the SIO2 waits for the SCLK2 signal to come from the controller. Following the transmission of the 1st byte, the controller must wait for the rising edge of the handshaking pin before sending the SCLK clock. This must be done at 1/16 of the desired baud rate. If the controller receives 30H as the 2nd byte, this should be taken as the go-ahead. The controller must then deliver the 3rd byte to the target board at a rate equal to the desired baud rate. The boot program sets the SC2MOD.RXE bit to 1 before 30H is written to the transmit buffer. In I/O Interface mode, receive errors are not checked. 3. The 3rd byte, which the target board receives from the controller, is a command. The code for the RAM Transfer command is 10H. The 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. Before sending back the acknowledge response, the boot program checks for a receive error. If there was a receive error, the boot program transmits x8H and returns to the state in which it waits for a command again. In this case, the upper four bits of the acknowledge response are undefined--they hold the same values as the upper four bits of the preceding command. If the 3rd byte is equal to any of the command codes listed in Table 17.3.2, the boot program echoes it back to the controller. When the RAM Transfer command was received, the boot program echoes back a value of 10H and then branches to the RAM Transfer routine. Once this branch is taken, a password check is done. Password checking is detailed later in this subsection. If the 3rd byte is not a valid command, the boot program sends back 11H to the controller to indicate a command error and returns to the state in which it waits for a command. In this case, the upper four bits of the response are undefined--they hold the same values as the upper four bits of the preceding command. 5. The 5th to 16th bytes, which the target board receives from the controller, are a 12-byte password. The 5th byte is compared to the contents of address 0x0000_0474 in the flash memory; the 6th byte is compared to the contents of address 0x0000_0475 in the flash memory; likewise, the 16th byte is compared to the contents of address 0x0000_047F in the flash memory. The 17th byte is a checksum value for the password sequence (5th to 16th bytes). To calculate the checksum value for the 12-byte password, add the 12 bytes together, drop the carries and take the two's complement of the total sum. Transmit this
4.
6.
TMP19A71
17-30
TMP19A71
checksum value from the controller to the target board. The checksum calculation is described in detail later in this section. 7. The 18th byte, transmitted from the target board to the controller, is an acknowledge response to the 5th to 17th bytes. First, the RAM Transfer routine checks for a receive error in the 5th to 17th bytes. If there was a receive error, the boot program sends back 18H and returns to the state in which it waits for a command (i.e., 3rd byte) again. In this case, the upper four bits of the acknowledge response are the same as those of the preceding command (i.e., all 1s). Next, the RAM Transfer routine performs the checksum operation to ensure data integrity. Adding the 5th to 17th bytes together must result in zero (with the carries dropped). If it is not zero, the RAM Transfer routine sends back 11H to the controller to indicate a checksum error and returns to the state in which it waits for a command (i.e., the 3rd byte) again. Finally, the RAM Transfer routine examines the result of the password check. If a password error is determined, the RAM Transfer routine sends back 11H to the controller and returns to the state in which it waits for a command (i.e., the 3rd byte) again. For data sequences that can be used as a password, see subsection 6) Password. When all the above checks have been successful, the RAM transfer routine returns a normal acknowledge response (10H) to the controller. 8. The 19th to 22nd bytes, which the target board receives from the controller, indicate the start address of the RAM region where subsequent data should be stored. The 19th byte corresponds to bits 31 to 24 of the address, and the 22nd byte corresponds to bits 7 to 0 of the address. The 23rd and 24th bytes, which the target board receives from the controller, indicate the number of bytes that will be transferred from the controller to be stored in the RAM. The 23rd byte corresponds to bits 15 to 8 of the transfer byte count, and the 24th byte corresponds to bits 7 to 0 of the transfer byte count.
9.
10. The 25th byte is a checksum value for the 19th to 24th bytes. To calculate the checksum value, add all these bytes together, drop the carries and take the two's complement of the total sum. Transmit this checksum value from the controller to the target board. The checksum calculation is described later in this section. 11. The 26th byte, transmitted from the target board from the controller, is an acknowledge response to the 19th to 25th bytes. First, the RAM Transfer routine checks for a receive error in the 19th to 25th bytes. If there was a receive error, the RAM Transfer routine sends back 18H and returns to the state in which it waits for a command (i.e., the 3rd byte). In this case, the upper four bits of the acknowledge response are the same as those of the preceding command (i.e., all 1s). Next, the RAM Transfer routine performs the checksum operation to ensure data integrity. Adding the 19th to 25th bytes together must result in zero (with the
TMP19A71
17-31
TMP19A71
carries dropped). If it is not zero, the RAM transfer routine sends back 11H to the controller to indicate a checksum error and returns to the state in which it waits for a command (i.e., the 3rd byte). * The RAM storage addresses must be within the range of 0xFFFF_9800 to 0xFFFF_AFFF. Although the boot program does not perform address checks, RAM transfer may not be performed properly if other RAM address locations are specified as they are used in the program. When the above checks have been successful, the RAM Transfer routine returns a normal acknowledge response (10H) to the controller. 12. The 27th to m'th bytes from the controller are stored in the on-chip RAM of the TMP19A71. Storage begins at the address specified by the 19th to 22nd bytes and continues for the number of bytes specified by the 23rd and 24th bytes. 13. The (m + 1)th byte is a checksum value. To calculate the checksum value, add the 27th to m'th bytes together, drop the carries and take the two's complement of the total sum. Transmit this checksum value from the controller to the target board. The checksum calculation is described in detail later in this section. 14. The (m + 2)th byte is an acknowledge response to the 27th to (m+1)th bytes. First, the RAM Transfer routine checks for a receive error in the 27th to (m+1)th bytes. If there was a receive error, the RAM Transfer routine sends back 18H and returns to the state in which it waits for a command (i.e., the 3rd byte) again. In this case, the upper four bits of the acknowledge response are the same as those of the preceding command (i.e., all 1s). Next, the RAM Transfer routine performs the checksum operation to ensure data integrity. Adding the 27th to (m+1)th bytes together must result in zero (with carries dropped). If it is not zero, the RAM Transfer routine sends back 11H to the controller to indicate a checksum error and returns to the state in which it waits for a command (i.e., the 3rd byte) again. If all the above checks are successful, the RAM Transfer routine returns a normal acknowledge response (10H) to the controller.
15. If the (m + 2)th byte was a normal acknowledge response, a branch is made to the address specified by the 19th to 22nd bytes in 32-bit ISA mode.
TMP19A71
17-32
TMP19A71
2) Show Flash Memory Sum command (see Table 17.3.4) 1. The processing of the 1st and 2nd bytes are the same as for the RAM Transfer command. The 3rd byte, which the target board receives from the controller, is a command. The code for the Show Flash Memory Sum command is 20H. The 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. The processing of the 4th byte is the same as for the RAM Transfer command except that the command code is 20H. The Show Flash Memory Sum routine adds all the bytes of the flash memory together. The 5th to 6th bytes, transmitted from the target board to the controller, indicate the upper and lower bytes of this total sum, respectively. The sum calculation is described in detail later in this section. The 7th byte is a checksum value for the 5th and 6th bytes. To calculate the checksum value, add the 5th and 6th bytes together, drop the carry and take the two's complement of the sum. Transmit this checksum value from the controller to the target board. The 8th byte is the next command code.
2.
3.
4.
5.
6.
TMP19A71
17-33
TMP19A71
3) Show Product Information Command (see Table 17.3.5) 1. The processing of the 1st and 2nd bytes are the same as for the RAM Transfer command. The 3rd byte, which the target board receives from the controller, is a command. The code for the Show Product Information command is 30H. The 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. The processing of the 4th byte is the same as for the RAM Transfer command except that the command data is 30H. The 5th to 8th bytes, transmitted from the target board to the controller, are the data read from addresses 0x0000_0470 to 0x0000_0473 in the flash memory. Software revision management is possible by storing software information such as an ID in these locations. The 9th to 20th bytes, transmitted from the target board to the controller, indicate the product name, which is `TX19A71FY' in ASCII code followed by 20H, 20H, and 20H (12 bytes). The 21st to 24th bytes, transmitted from the target board to the controller, indicate the start address of the flash memory area containing the password (74H, 04H, 00H , 00H ). The 25th to 28th bytes, transmitted from the target board to the controller, indicate the start address of the on-chip RAM (00H, 98H, FFH, FFH). The 29th to 32nd bytes, transmitted from the target board to the controller, are dummy data (FFH, A7H, FFH, FFH). The 33rd to 36th bytes, transmitted from the target board to the controller, indicate the end address of the on-chip RAM (FFH, FFH, BFH, FFH).
2.
3.
4.
5.
6.
7.
8.
9.
10. The 37th to 40th bytes, transmitted from the target board to the controller, are 00H, A8, FFH and FFH. The 41st to 44th bytes, transmitted from the target board to the controller, are FFH, AFH, FFH and FFH. 11. The 45th and 46th bytes, transmitted from the target board to the controller, indicate whether the security and protect bits are available and whether the flash memory is divided into blocks. Bit 0 indicates the presence or absence of the security bit; it is 0 if the security bit is available. Bit 1 indicates the presence or absence of the protect bits; it is 0 if the protect bits are available. If bit 2 is 0, it indicates that the flash memory is divided into blocks. The remaining bits are undefined. The 45th and 46th bytes are 00H, 00H. 12. The 47th to 50th bytes, transmitted from the target board to the controller, indicate the start address of the on-chip flash memory (00H, 00H, 00H, 00H).
TMP19A71
17-34
TMP19A71
13. The 51st to 54th bytes, transmitted from the target board to the controller, indicate the end address of the on-chip flash memory (FFH, FFH, 03H, 00H). 14. The 55th and 56th bytes, transmitted from the target board to the controller, indicate the number of flash blocks available (02H, 00H). 15. The 57th to 92nd bytes, transmitted from the target board to the controller, contain information about the flash blocks. Flash blocks of the same size are treated as a group. Information about the flash blocks indicate the start address of a group, the size of the blocks in that group (in half words) and the number of the blocks in that group. The 57th to 65th bytes are the information about 128-Kbyte blocks (Block 0 and Block 1). See Table 17.3.5 for the values of bytes transmitted. 16. The 66th byte, transmitted from the target board to the controller, is a checksum value for the 5th to 65th bytes. The checksum value is calculated by adding all these bytes together, dropping the carries and taking the two's complement of the total sum. 17. The 67th byte is the next command code.
TMP19A71
17-35
TMP19A71
4) Acknowledge responses
The boot program returns to the controller specific codes to notify processing states. Table 17.3.6 to Table 17.3.8 show the values of possible acknowledge responses to the received data. The upper four bits of the acknowledge response are equal to those of the command being executed. Bit 3 of the code indicates a receive error. Bit 0 indicates an invalid command error, a checksum error or a password error. Bit 1 and bit 2 are always 0. Receive error checking is not performed in I/O Interface mode. Table 17.3.6
Return Value 0x86 0x30
ACK Response to the Serial Operation Mode Bytes
Meaning
The SIO can be configured to operate in UART mode. (Note) The SIO can be configured to operate in I/O Interface mode.
Note: If the serial operation mode is determined as UART, the boot program checks if the SIO can be programmed to the baud rate at which the operation mode byte was transferred. If the baud rate is not possible, the boot program aborts without sendig back any response.
Table 17.3.7
Return Value 0xN8 (Note) 0xN1 (Note) 0x10 0x20 0x30
ACK Response to the Command Byte
Meaning
A receive error occurred while a command code was being received. An undefined command code was received. (Reception was completed normally.) The RAM Transfer command was received. The Show Flash Memory Sum command was received. The Show Product Information command was received.
Note: The four high-order bits of the ACK response are the same as those of the preceding command code.
Table 17.3.8
Return Value 0xN8 (Note) 0xN1 (Note) 0xN0 (Note)
ACK Response to the Checksum Byte
Meaning
A receive error occurred. A checksum or password error occurred. The checksum was correct.
Note: The four high-order bits of the ACK response are the four high-order bits of the preceding command code. They are 1 if a password error occurred.
TMP19A71
17-36
TMP19A71
5) Determination of a serial operation mode
The first byte from the controller determines the serial operation mode. To use UART mode for communications between the controller and the target board, the controller must first send a value of 86H at a desired baud rate to the target board. To use I/O Interface mode, the controller must send the first byte with a waveform satisfying tAB > tCD (30H is sent here) at 1/16 of the desired baud rate. Figure 17.3.4 shows the waveforms for the first byte.
Start Point A
UART (0x86)
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
Stop
Point B
Point C
Point D
tAB
tCD
bit 0 Point A I/O Interface
(0x30)
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7 Point D
Point B
Point C
tAB
tCD
Figure 17.3.4
Serial Operation Mode Byte
After the reset state is released, the boot program monitors the first serial byte from the controller with the SIO reception disabled, and calculates the intervals of tAB, tAC and tAD shown in Figure 17.3.4. Figure 17.3.5 shows a flowchart describing the steps to determine the intervals of tAB, tAC and tAD. As shown in the flowchart, the boot program captures timer counts each time a logic transition occurs in the first serial byte. Consequently, the calculated tAB, tAC and tAD intervals are bound to have slight errors. If the transfer goes at a high baud rate, the TX19A core processor might not be able to keep up with the speed of logic transitions at the serial receive pin. In particular, I/O Interface mode is more prone to this problem since its baud rate is generally much higher than that for UART mode. To avoid such a situation, the controller should send the first serial byte at 1/16 of the desired baud rate. The flowchart in Figure 17.3.6 shows how the boot program distinguishes between UART and I/O Interface modes. If the length of tAB is equal to or less than the length of tCD, the serial operation mode is determined as UART mode. If the length of tAB is greater than tCD, the serial operation mode is determined as I/O Interface mode. Bear in mind that if the baud rate is too high or the timer operating frequency is too low, the timer resolution will be coarse, relative to the intervals between logic transitions. This becomes a problem due to inherent errors caused by the way in which timer counts are captured by software; consequently the boot program might not be able to determine the serial operation mode correctly. (Serial operation mode settings must be made again in the programming routine.) For example, the serial operation mode may be determined to be I/O Interface mode when the intended mode is UART mode. To avoid such a situation, when UART mode is utilized, the controller should allow for a time-out period within which it expects to receive an echo-back (86H) from the target board. The controller should give up the communication if it fails to get that echo-back within the allotted time. When I/O Interface mode is utilized, once the first
TMP19A71
17-37
TMP19A71
serial byte has been transmitted, the controller should send the SCLK clock after a certain idle time to get an acknowledge response. If the received acknowledge response is not 30H, the controller should give up further communications. To select I/O Interface mode, the data in the 1st byte need not be 30H so long as tAB > tCD is satisfied. The 1st byte may be 91H, A1H, or B1H; these values generate a falling edge at point A and point C and a rising edge at point B and point D. When tAB > tCD is satisfied and I/O Interface mode is determined, 30H is transmitted as the 2nd byte (even if the first byte is not 30H). (Here it is assumed that 30H is transmitted as the 1st byte to select I/O Interface mode.)
TMP19A71
17-38
TMP19A71
Start
Initialize TMRB0 Start prescaler (source clock: IMCLK/4)
Point A
High-to-low transition on serial receive pin? YES TMRB0 starts counting up
Point B
Low-to-high transition on serial receive pin? YES Software-capture and save timer value (tAB)
Point C
High-to-low transition on serial receive pin? YES Software-capture and save timer value (tAC)
Point D
Low-to-high transition on serial receive pin? YES Software-capture and save timer value (tAD) TMRB0 stops counting
tAC tAD?
YES
Make backup copy of tAD value Stop operation (infinite loop until RESET input)
End
Figure 17.3.5
Serial Operation Mode Byte Reception Flow
TMP19A71
17-39
TMP19A71
Start
tCD tAD - tAC
tAB > tCD?
YES
UART mode
I/O Interface mode
Figure 17.3.6
Serial Operation Mode Determination Flow
6)
Password
The RAM Transfer command (10H) causes the boot program to perform a password check. Following an echo-back of the command, the boot program checks the contents of the 12-byte password area (0x0000_0474 to 0x0000_047F) within the flash memory. As shown in Figure 17.3.7, if all these address locations contain the same bytes of data other than FFH, a password area error occurs. In this case, the boot program returns an error acknowledge (11H) in response to the checksum byte (the 17th byte) regardless the result of password check. The only exception is when the password area is all 00H and the data at the first flash memory address (0x0000_0000 in Single Boot mode) is 0x0000_0000. In this case, 12 bytes of 00H in the password area do not cause a password area error. The password sequence received from the controller (5th to 16th bytes) is compared to the password stored in the flash memory. Table 17.3.9 shows how they are compared byte by byte. All of the 12 bytes must match to pass the password check. Otherwise, a password error occurs, which causes the boot program to return an error acknowledge in response to the checksum byte (the 17th byte).
TMP19A71
17-40
TMP19A71
Start
Are all bytes the same?
YES
Are all bytes equal to FFH?
YES
Are all bytes equal to 00H and 0x0000_0000 = 0?
YES
Password area error
Password area is normal.
Figure 17.3.7
Password Area Check Flow
Table 17.3.9 Relationship between Received Bytes and Flash Memory Locations
Received Byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte 11th byte 12th byte 13th byte 14th byte 15th byte 16th byte Compared Flash Memory Data Address 0x0000_0474 Address 0x0000_0475 Address 0x0000_0476 Address 0x0000_0477 Address 0x0000_0478 Address 0x0000_0479 Address 0x0000_047A Address 0x0000_047B Address 0x0000_047C Address 0x0000_047D Address 0x0000_047E Address 0x0000_047F
Note: We recommend setting data other than 0 at address 0x0000_0000 for security reasons.
TMP19A71
17-41
TMP19A71
7) Calculation of the Show Flash Memory Sum command
The Show Flash Memory Sum command adds all 256 Kbytes of the flash memory together and provides the total sum as a word quantity. The sum is sent to the controller with the upper 8 bits first, followed by the lower 8 bits. Example:
A1H B2H C3H D4H
In the interests of simplicity, assume the depth of the flash memory is four locations. Then the sum of the four bytes is calculated as: A1H + B2H + C3H + D4H = 02EAH Hence, 02H is first sent to the controller, followed by EAH.
8)
Checksum calculation
The checksum byte for a series of bytes of data is calculated by adding the bytes together, dropping the carries, and taking the two's complement of the total sum. The Show Flash Memory Sum command and the Show Product Information command perform the checksum calculation. The controller must perform the same checksum operation in transmitting checksum bytes. Example: Assume the Show Flash Memory Sum command provides the high- and low-order bytes of the sum as E5H and F6H. To calculate the checksum for a series of E5H and F6H: Add the bytes together. E5H + F6H = 1DBH Drop the carry, and then take the two's complement of the sum. The result is the checksum byte. 0 - DBH = 25H
TMP19A71
17-42
TMP19A71
(7) General boot program flowchart Figure 17.3.8 shows an overall flowchart of the boot program.
Boot Program Start
Initialize
Get SIO operation mode data
SIO operation mode?
UART
Baud rate setting? Can be set
Set UART mode and baud rate ACK data Received data (Send 86H) Normal response
Cannot be set
I/O Interface
Set I/O Interface mode ACK data Received data (30H) (Send 30H) Normal response Prepare to get a command
Stop operation (wait for reset input)
Prepare ACK data
Receive routine Get a command
Receive error? No RAM Transfer? Yes
ACK data Received data (10H) Transmit routine
(Send 0x10:normal response)
Yes
ACK data ACK data (08H)
Transmit routine (Send x8H: Receive error)
Show Flash Memory Sum? Yes
ACK data Received data (20H) Transmit routine
(Send 20H: Normal response)
Show Product Information? Yes
ACK data Received data (30H) Transmit routine
(Send 30H: Normal response)
Command error
ACK data ACK data (01H) Transmit routine
(Send x1H: Command error)
RAM Transfer processing
Show Flash Memory Sum processing
Show Product Information processing
Processed normally? Yes Jump to RAM
Figure 17.3.8
Overall Boot Program Flow
TMP19A71
17-43
TMP19A71
(8) Handshake operation in I/O Interface mode 1) After setting SC2MOD0.RXE=1, the TMP19A71 drives the P80 pin high and waits for the SCLK2 signal for receiving data. 2) After receiving one byte and generating a receive-done interrupt request, the TMP19A71 performs the following sequence of operations: * Drives the P80 pin low to notify the controller that new data transfer cannot be performed. * Processes the received data (RAM storage, checksum verification, sum verification, etc.) and then clears the receive-done interrupt request. * Then, drives the P80 pin high to notify the controller that it is ready to receive new data and waits for the SCLK2 signal for the next receive operation. In Figure 17.3.9, the receive wait time is defined as the period between the rising edge of bit 7 of SCLK2 and the next rising edge of the P80 pin. 3) The next transfer operation should be initiated after a low-to-high transition is confirmed on the P80 pin. (The controller must optimize the transmit wait time for each transfer format.)
Note: The receive wait time to be inserted after each receive operation varies depending on the operating frequency and baud rate used and the processing to be performed on received data (checksum verification, RAM storage, password area check, password data check, etc.) .
Controller (Transmit) TMP19A71 (Receive)
Controller (Receive) TMP19A71 (Transmit)
SCLK
TXD
RXD
IVR [ 8: 0 ]
0
INTR
0
INTR
0
RXE
HS Receive Wait Time
SCLK = SCLK2, TXD = TX2, RXD = RX2, INTT = INTRX2, RXE = SC2MOD0.RXE, HS = P80
Figure 17.3.9 Handshake Waveform and Receive Wait Time
TMP19A71
17-44
TMP19A71
1) After setting SC2MOD0.RXE=0 and setting transmit data in the SC2BUF, the TMP19A71 drives the P80 pin high and waits for the SCLK2 signal for transmitting data. 2) After transmitting one byte and generating a transmit-done interrupt request, the TMP19A71 performs the following sequence of operations: * Drives the P80 pin low to notify the controller that new data transfer cannot be performed. * Performs required processing on the transmitted data (checksum verification, sum verification, etc.) and then clears the transmit-done interrupt request. * Then, sets SC2MOD0.RXE to 1 and drives the P80 pin high to notify the controller that it is ready to receive new data. In Figure 17.3.10, the transmit wait time is defined as the period between the rising edge of bit 7 of SCLK2 and the next rising edge of the P80 pin. The next transfer operation should be initiated after a low-to-high transition is confirmed on the P80 pin. (The controller must optimize the transmit wait time for each transfer format.)
Note: The transmit wait time to be inserted after each transmit operation varies depending on the operating frequency and baud rate used and the processing to be performed on transfer data (SC2MOD0.RXE setting, checksum verification, RAM storage, password verification, etc.).
SCLK = SCLK2, TXD = TX2, RXD = RX2, INTR = INTTX2, INTT = INTRX2, RXE = SC2MOD0.RXE, HS = P80
Figure 17.3.10
Handshake Waveform and Transmit Wait Time
TMP19A71
17-45
TMP19A71
(9)Supplementary explanation on determination of a serial operation mode (Transmit waveforms and handshaking in I/O Interface mode) As explained in subsection 5) Determination of a serial operation mode, each operation command must send a waveform satisfying tAB>tCD to select I/O Interface mode. At this time, point A and point C should be programmed to be falling edges and point B and point D to be rising edges. If 30H is transmitted as the 1st byte, the boot program must create at least 1 bit of high level after sending 30H so that a rising edge occurs at point D (see Figure 17.3.11 below). This measure is not needed if the data to be sent as the 1st byte includes a rising edge at point D (e.g. 91H, D9H). In either case, the serial receive pin must be driven high before entering the procedure for determining a serial operation mode. (We recommend setting the serial receive pin to high upon reset.) In I/O Interface mode, the serial receive pin functions as a general-purpose input port for receiving the 1st byte. The timing at which I/O Interface mode is determined is after a rising edge at point D, at which point the port pin used for handshaking goes high even if this occurs before bit 7 is transmitted. (If UART mode is determined, no output is made on the handshake pin.) As shown in Figure 17.3.11 below, the position of point D varies with the data transmitted as the 1st byte. After the 1st byte has been transferred, the controller can initiate the transfer of the 2nd byte after the handshake pin goes high, which indicates that the serial operation mode has been determined.
Transmit data in 1st byte = 30H
Point A Point B
bit 1 bit 2 bit 3 bit 4
Point C
bit 5 bit 6
Point D
bit 7 extra bit
RXD
bit 0
HS
Transmit data in 1st byte = 91H
Point A Point B
bit 2 bit 3 bit 4
Point C
bit 5 bit 6
Point D
bit 7
RXD
bit 0
bit 1
HS
Transmit data in 1st byte = D9H
Point A Point B
bit 2 bit 3
Point C
bit 4 bit 5
Point D
bit 6 bit 7
RXD
bit 0
bit 1
HS
Handshake (HS) pin I/O setting = After reset state
RXD = RX2, HS = P80
Figure 17.3.11
Supplementary Explanation on Determination of a Serial Operation Mode
TMP19A71
17-46
TMP19A71
(10) Recommended baud rates for the boot program Table 17.3.10 Recommended Baud Rates in Single Boot Mode (UART Mode)
PRSC = BR2CR[5:4], N = BR2CR [3:0], K = BR2ADD[3:0]
Note 1: While the serial operation mode is being determined, the baud rate is determined by measuring the waveform with a timer. Capture value errors generated by the prescaler source clock and division errors that occur in the serial mode determination flow may make it impossible to set the baud rate. The above table shows expected combinations of frequency and baud rate settings, and other combinations may be used. Due to the specifications of the boot program, the fastest baud rate setting allowed is BR2CR=02H. The controller must communicate at a baud rate equal to or slower than this setting.
Note 2: Note 3:
Table 17.3.11 Recommended Baud Rate Values in Single Boot Mode (I/O Interface Mode)
Operating Frequency (MHz) 56 40
Note:
Baud Rate in I/O Interface Mode (bps) 3M 2M 2.5M 1.25M 1.25M 1M 1M 500K 500K 250K 250K 125K
When I/O Interface mode is selected, a wait time is generated after transmitting/receiving every single byte.
TMP19A71
17-47
TMP19A71
(11) Other considerations for using the boot program * The on-chip boot ROM inserts one wait state in executing each instruction. In Single Boot mode, the pipeline operation for executing each instruction takes twice as long as in the case of Single-Chip mode. * No wait states are inserted while the programming routine transferred to the on-chip RAM is executed on the on-chip RAM. * The boot program updates the values of general-purpose registers upon reset. * The boot program executes all instructions in 32-bit ISA mode. The instruction to be placed at the first address of the programming routine (i.e., RAM storage start address) must be a 32-bit ISA instruction. * All special-purpose registers must be set in the programming routine. * The boot program uses the general-purpose register r29 (shadow = 0) as the stack pointer. The r29 is set to 0xFFFF_BFF0 immediately after the RAM Transfer command is executed. * Locations other than those to which the programming routine can be transferred with the RAM Transfer commend (0xFFFF_9800 to 0xFFFF_AFFF) are used in the boot program after reset. * There are no limitations on RAM locations that can be used by the programming routine stored in the on-chip RAM. * While the boot program is being executed, all maskable interrupts are disabled. * If maskable interrupts are enabled during execution of the programming routine, the maskable interrupt vector of the boot program reads the Interrupt Vector Register (IVR) to obtain the vector address corresponding to the interrupt source, and then transfers control to this vector address. The value of the general-purpose register r4/r29 (SP) is updated by executing the routine shown on the following page. The boot program area does not provide vector addresses for interrupt sources and control for clearing interrupt requests. These should be provided in the programming routine including the setting of the IVR value.
TMP19A71
17-48
TMP19A71

interrupts: addi sw mfc0 nop nop srl andi bne nop lw lw addi jr nop the_other: addi the_other_lp: nop j nop the_other_lp ; Operation stop loop sp, sp, 4 sp, sp, -4 r4, 0( sp ) r4, r13 ; Maskable interrupt vector start address
r4, r4, r4,
r4, r4, r0,
2 0x1F the_other
;
If not a maskable interrupt, operation stops
r4, r4, sp, r4
IVR 0( r4 ) sp, 4
; ;
Read IVR Read maskable interrupt vector address
;
Jump to vector address
Note:
After an interrupt is generated, one wait state is inserted for executing each instruction until control jumps to the vector address.
* Nonmaskable interrupts must not be used as they will cause an endless loop in the boot program. If an endless loop occurs, a reset must be applied. * Once control jumps to the programming routine, it should not be returned to the boot program area except by the above maskable interrupt vector. * Initial settings should be made before the procedure for determining a serial operation mode. After the reset state is released, an interval of approximately 200 instructions should be inserted before the transfer of the 1st byte. Note that the 1st byte is not transferred via a serial channel. To detect a falling edge on the serial receive pin, the serial receive pin must be set to high well in advance of the completion of the above wait interval. (We recommend setting the serial receive pin to high upon reset.)
TMP19A71
17-49
TMP19A71
17.4
On-Board Programming and Erasure
The TMP19A71 flash memory is controlled by commands. In User Boot mode and Single Boot mode (the RAM Transfer command), the flash memory can be programmed and erased by the TX19A core processor executing software commands. It is the user's responsibility to create a program/erase routine. Because the flash memory cannot be read while it is being programmed or erased, the program/erase routine must be executed from the on-chip RAM.
17.4.1
Key Features
Program and erase operations on the TMP19A71 flash memory are in principle controlled by commands. This feature enables program and erase commands to be executed by accessing particular addresses in the flash memory. The TX19A core processor issues a command sequence to the flash memory by using the 32-bit SW instruction. Once a command sequence is written, the flash memory does not require the TX19A core processor to provide further controls or timings. The flash memory initiates the embedded program or erase algorithm automatically. The entire flash memory or one or two flash blocks can be erased at a time. Table 17.4.1 Feature Description
Programs and verifies the desired addresses word by word automatically. Erases and verifies the entire memory array automatically. Erases and verifies all memory locations in the selected block automatically. Erases and verifies all memory locations in multiple selected blocks automatically. Provides several status bits such as the Data Polling bit and Toggle bit, which can be used to determine whether a program or erase operation is complete or in progress. Prevents intrusive access to the flash memory while in Programmer mode. Protecting both of the two flash blocks turns on the anti-programmer security feature. Unprotecting both the blocks turns off the anti-programmer security feature. This automatically causes the entire flash memory to be erased. Disables program and erase operations in a flash block. Block-protecting both of the two flash blocks automatically turns on the anti-programmer security feature.
Auto Program Auto Chip Erase Auto Block Erase Auto Multi-Block Erase Write Status Flags Anti-Programmer Security Feature
Block Protect
Bear in mind that, due to the on-chip TX19A core processor interface, the TMP19A71 uses addresses different from those of the standard flash command sequences. Programming is done word by word; thus the word (32 bits) load instruction should be used to write to the flash memory. Unless otherwise noted, the addresses in the flash memory are represented as virtual addresses.
TMP19A71
17-50
TMP19A71
(1) Block architecture
0x0_0000 to 0x1_FFFF 0x2_0000 to 0x3_FFFF 128 Kbytes 128 Kbytes
Address bits [31:18] vary with the operation mode.
Figure 17.4.1 Flash Memory Block Architecture (2) Interface between the TX19A core processor and the flash memory Figure 17.4.2 illustrates the internal interface between the TX19A core processor and the flash memory in on-board programming modes. The diagram does not show the actual logic network; instead it is only a conceptual depiction of the interface between the TX19A core processor and the flash memory.
Single-Chip mode: 0xBFC0_0000 - 0xBFCF_FFFF Single Boot mode: 0x0000_0000 - 0x000F_FFFF Operation Mode Decoder CE (256 KB) A16 - A2 D31- D0 WR RD CPU RESET Register AD14 - AD0 DQ31 - DQ0 WE OE RESET RDY/BSY Flash Memory
TX19A Core Processor A31 - A16
Figure 17.4.2 Internal Interface between TX19A Core Processor and Flash Memory
TMP19A71
17-51
TMP19A71
(3) Basic operations The TMP19A71 flash memory has the following two modes of operation: * Read mode in which array data is read * Embedded Operation mode in which the flash array is programmed or erased. The flash memory enters Embedded Operation mode when a valid command sequence is executed in Read mode. In Embedded Operation mode, array data cannot be read. 1) Reading Array Data To read array data, the flash memory must be set to Read mode. The flash memory is automatically set to Read mode upon device power-up, upon reset of the TX19A core processor, and after an embedded operation is successfully completed. If an embedded operation terminated abnormally or the flash memory is required to return to Read mode, software reset or hardware reset is used. Writing Commands The TMP19A71 flash memory is controlled by commands. A write to the command sequencer is effected by issuing a command sequence to the flash memory. The flash memory latches the provided address and data in the command sequencer and executes the required instructions (see Table 17.4.4 and Table 17.4.5). The command sequence being written can be canceled by issuing the Read/Reset command or the Reset command (software reset). The Reset command clears the command sequencer and resets the flash memory to Read mode. Invalid command sequences also cause the flash memory to clear the command sequencer and return to Read mode. 3) Reset
2)
* Read/Reset command, Reset command (software reset) The flash memory does not return to Read mode automatically if an embedded operation terminated abnormally. In this case, the Read/Reset or Reset command must be issued to put the flash memory back in Read mode. The Read/Reset or Reset command may also be written between sequence cycles of the command being written to clear the contents of the command sequencer. * Hardware reset As shown in Figure 17.4.2, the flash memory has a reset pin, which is connected to the RESET signal of the TX19A core processor. When the system drives the RESET pin low or when certain events such as a watchdog timer time-out causes a reset of the TX19A core processor, the flash memory immediately terminates any operation in progress and is reset to Read mode. The Read/Reset and Reset commands are also tied to the RESET pin to reset the flash memory to Read mode. The embedded operation that was interrupted should be re-initiated once the flash memory is ready to accept another command sequence because data may be corrupted. For a description of the hardware reset operation, see section 3.1 Reset Operation. When a valid reset is achieved, the TX19A core processor reads the Reset exception vector from the flash memory and services the Reset exception.
TMP19A71
17-52
TMP19A71
4)
Auto Program command A bit must be programmed to change its state from 1 to 0. A bit cannot be programmed from 0 back to 1. Only an erase operation can change 0 back to 1. In User Boot mode and the RAM Transfer command of Single Boot mode, the Auto Program command programs the desired addresses in units of 32 bits (words). The Auto Program command requires four bus cycles; the program address and data are written in the fourth cycle, upon completion of which the program operation will commence. As programming is performed on a word-by-word basis, the program address must satisfy A1=A0=0. It is not possible to program a 32-bit word if some bits have already been written. (This also applies when 1 is written in some bits. These bits must be erased before new data can be programmed.) The Auto Program command executes a sequence of internally timed events to program the desired bits of the addressed memory word and verify that the desired bits are sufficiently programmed. The system can determine the status of the programming operation by using write status flags (see Table 17.4.3). Any commands written during the programming operation are ignored. A hardware reset immediately terminates the programming operation. The programming operation that was interrupted should be reinitiated once the flash memory is ready to accept another command sequence because data may be corrupted. The block protection feature disables programming operation in any block. If an attempt is made to program a protected block, the Auto Program command does nothing; the flash memory returns to Read mode in approximately 3 s after the completion of the fourth bus cycle of the command sequence. When the embedded Auto Program algorithm is complete, the flash memory returns to Read mode. If any failure occurs during the programming operation, the flash memory remains locked in Embedded Operation mode. The system can determine this status by using write status flags. To put the flash memory back in Read mode, use a software reset to reset the flash memory or a hardware reset to reset the whole chip. In case of a programming failure, it is recommended to replace the chip or to discontinue the use of the failing flash block.
TMP19A71
17-53
TMP19A71
5) Auto Chip Erase command The Auto Chip Erase command requires six bus cycles. The flash area is partitioned into two blocks, Block 0 and Block 1. The chip erase operation is performed for each individual block. After completion of the sixth bus cycle, the Auto Chip Erase operation will commence immediately. The embedded Auto Erase algorithm automatically preprograms the entire memory for an all-0 data pattern prior to the erase; then it automatically erases and verifies the entire memory for an all-1 data pattern. The system can determine the status of the chip erase operation by using write status flags (see Table 17.4.3). Any commands written during the chip erase operation are ignored. A hardware reset immediately terminates the chip erase operation. The chip erase operation that was interrupted should be re-initiated once the flash memory is ready to accept another command sequence because data may be corrupted. The block protection feature disables erase operations in any block. The Auto Chip Erase algorithm erases the unprotected blocks and ignores the protected blocks. If both blocks are protected, the Auto Chip Erase command does nothing; the flash memory returns to Read mode in approximately 100 s after the completion of the sixth bus cycle of the command sequence. When the embedded Auto Chip Erase algorithm is complete, the flash memory returns to Read mode. If any failure occurs during the erase operation, the flash memory remains locked in Embedded Operation mode. The system can determine this status by using write status flags. To put the flash memory back in Read mode, use a software reset or a hardware reset to reset the flash memory or the device. In case of an erase failure, it is recommended to replace the chip or discontinue the use of the failing flash block. The failing block can be identified by the Block Erase command. 6) Auto Block Erase and Auto Multi-Block Erase Commands The Auto Block Erase command requires six bus cycles. A time-out begins from the completion of the command sequence. After a time-out, the erase operation will commence. The embedded Auto Block Erase algorithm automatically preprograms the selected block for an all-0 data pattern, and then erases and verifies that block for an all-1 data pattern. To erase the next block, the sixth bus cycle must be repeated; the next block address and the Auto Block Erase command must be provided within the time-out period. Any command other than Auto Block Erase during the time-out period resets the flash memory to Read mode. The block erase time-out period is 50 s. The system may read DQ3 to determine whether the time-out period has expired. The block erase timer begins counting upon completion of the sixth bus cycle of the Auto Block Erase command sequence. The system can determine the status of the erase operation by using write status flags (see Table 17.4.3). Any commands written during the block erase operation are ignored. A hardware reset immediately terminates the block erase operation. The block erase operation that was interrupted should be re-initiated once the flash memory is ready to accept another command sequence because data may be corrupted. The block protection feature disables erase operations in any block. The Auto Block Erase algorithm erases the unprotected blocks and ignores the protected blocks. If all the selected blocks are protected, the Auto Block Erase algorithm does nothing; the flash memory returns to Read mode in approximately 100 s after the final bus cycle of the command sequence. If any failure occurs during the erase operation, the flash memory remains locked in Embedded Operation mode. The system can determine this status by using the write status flags. To put the flash memory back in Read mode, use a software or hardware reset to reset the flash memory or the whole chip. In case of an erase failure, it is recommended to replace the chip or discontinue the use of the failing flash block. If any failure occurred during the
TMP19A71
17-54
TMP19A71
multi-block erase operation, the failing block can be identified by running Auto Block Erase on each of the blocks selected for multi-block erasure. 7) Block Protect command The block protection feature disables both program and erase operations in any block. After completion of the seventh bus write cycle, the RDY/BSY bit in the FLCS register is cleared to 0 during the block protect operation. Once the block protect operation is complete, this bit is set again and the flash memory automatically returns to Read mode. If any failure occurred during the Block Protect operation, the flash memory remains locked in Embedded Operation mode with FLCS.RDY/BSY = 0. To put the flash memory back in Read mode, a software or hardware reset must be executed.
Table 17.4.2
Effects of the Program and Erase Commands on the Protected Blocks
Command Operation No programming operation is performed, and the flash memory automatically returns to Read mode. No erase operation is performed, and the flash memory automatically returns to Read mode. No erase operation is performed, and the flash memory automatically returns to Read mode. Only the unprotected blocks are erased. Upon completion, the flash memory automatically returns to Read mode. Only the unprotected blocks are erased. Upon completion, the flash memory automatically returns to Read mode.
Program command on a protected block Block Erase command on a protected block Chip Erase command when all the blocks are protected Chip Erase command when any blocks are protected Multi-Block Erase command when any blocks are protected
Any commands written during the Block Protect algorithm are ignored. A hardware reset immediately terminates the block protect operation. The Block Protect command that was interrupted should be re-initiated once the flash memory is ready to accept another command sequence. 8) Block Unprotect command The Block Unprotect command requires seven bus cycles. After completion of the seventh bus write cycle, the RDY/BSY bit in the FLCS register is cleared to 0 during the block unprotect operation. Once the block unprotect operation is complete, this bit is set again and the flash memory automatically returns to Read mode. If any failure occurred during the block unprotect operation, the flash memory remains locked in Embedded Operation mode with FLCS.RDY/BSY = 0. To put the flash memory back in Read mode, a software or hardware reset must be executed. Any commands written during the Block Unprotect algorithm are ignored. A hardware reset immeidately terminates the block unprotect operation. In this case, the block unprotect operation must be performed again by starting with protecting all the blocks again. Use the Verify Block Protect command to verify the protect status of a block.
9) Verify Block Protect command The Verify Block Protect command is used to verify the protect status of a block. Verify Block Protect is a four-bus-cycle operation. The address of the block to be verified is given in the fourth cycle. Any address within the block range will suffice, provided A[3:0] = 0, A4 = 1 and A6 = 0. To get correct data, a 32-bit read must be performed at least twice. Use the last read as valid data. If the selected block is protected, a value of 0x0000_0001 is returned. If the selected block is not protected, a value of 0x0000_0000 is returned. Following the fourth bus cycle, an
TMP19A71
17-55
TMP19A71
additional block address may be read. The Verify Block Protect command does not return the flash memory to Read mode. Either the Read/Reset command or a hardware reset is required to reset the flash memory to Read mode or to write the next command. 10) ID-READ command The ID-READ command reads 0x0098 (fixed) as Toshiba's manufacturer's code. The flash memory address to be read is specified in the fourth bus read cycle. This address must satisfy A[4:0] = 0 and A6 = 0. To get correct data, a 32-bit read must be performed at least twice. Use the last read as valid data. By specifying an address where data other than 0x0098 is stored, the ID-READ command can be used to distinguish between the flash-version device (read value: 0x0098) and the mask-version device (read value: other than 0x0098).
TMP19A71
17-56
TMP19A71
11) Write Operation Status As shown in Table 17.4.3, the flash memory provides flag bits to determine the status of an embedded operation: DQ7, DQ5 and DQ3. These status bits can be read during an embedded operation in the same timing as for Read mode. The flash memory automatically returns to Read mode when an embedded operation completes. The status of an embedded operation can be checked by reading the DQ7 flag. Once an embedded operation completes, the cell data can be read from the DQ7. The DQ7 must be read after checking that an embedded operation has started (FLCS.RDY/BSY=0). During the embedded program operation, the system must provide the program address (with A[1:0] = 0) to read valid status information. During the embedded erase operation, the system must provide an address (with A[1:0] = 0) within any of the blocks selected for erasure to read valid status information. While an embedded operation is in progress, D[31:16] are read as 0. These bits, therefore, can be used in place of the FLCS.RDY/BSY bit in a system where D[31:16] are not normally 0. Although the FLCS register is read as undefined in the mask-version device, use of D[31:16] allows the same program to be used in the flash-version and mask-version devices.
Table 17.4.3 Write Status Flags
Status Auto Program Auto Erase Embedded operation (during the time-out window) in progress Auto Erase Time-out in Auto Program embedded operation Auto Erase D7 (DQ7) DQ7 inverted 0 0 DQ7 inverted 0 D5 (DQ5) 0 0 0 1 1 D3 (DQ3) 0 0 1 1 1
Note 1: While an embedded operation is in progress, D[31:16]=0, D[15:8]=undefined, and DQ4, DQ2, DQ1, DQ0=undefined. Note 2: While an embedded operation is in progress, DQ7 outputs the inverted value of the programmed cell data. During the auto erase operation, DQ7 outputs 0 (erased state = 1).
TMP19A71
17-57
TMP19A71
* DQ7 (Data Polling) The Data Polling bit, DQ7, indicates the status of an embedded operation. Data polling is valid after the final bus write cycle of an embedded command sequence. When the embedded Program algorithm is in progress, an attempt to read the flash memory will produce the complement of the data written to DQ7. Upon completion of the Program algorithm, an attempt to read the flash memory will produce the true data written to DQ7. When the embedded Erase algorithm is in progress, an attempt to read the flash memory will produce a 0 at the DQ7 output. Upon completion of the Erase algorithm, the flash memory will produce a 1 at the DQ7 output. If any failure occurs during an embedded operation, DQ7 continues to output the same value. Thus, DQ7 must always be polled in conjunction with the Exceeded Timing Limits (DQ5) flag. (see Table 17.4.3). The flash memory disables address latching when an embedded operation is complete. Data polling must be performed with a valid programmed address or an address within any of the unprotected blocks selected for erasure. * DQ5 (Exceeded Timing Limits) DQ5 produces a 0 while the program or erase operation is in progress normally. DQ5 produces a 1 to indicate that the program or erase time has exceeded the specified internal limit. This is a failure condition that indicates the program or erase cycle was not successfully completed. The DQ5 failure condition also appears if the system tries to program a 1 to a location that was previously programmed to a 0. Only an erase operation can change a 0 back to a 1. In this case, the embedded Program algorithm halts the operation. Once the operation has exceeded the timing limits, DQ5 will indicate a 1. Note that this is not a device failure condition since the flash memory was used incorrectly. Under both these conditions, the flash memory remains locked in Embedded Operation mode. A software reset is needed to return the flash memory to Read mode. * DQ3 (Block Erase Timer) After the completion of the sixth bus cycle of the Auto Block Erase command sequence, the block erase time-out window of 50 s begins. The erase operation will begin after the time-out has expired. When the time-out is complete and the erase operation has begun, DQ3 switches from 0 to 1. If DQ3 is 0, the flash memory will accept additional Auto Block Erase commands. Each time an Auto Block Erase command is written, the time-out window is reset. DQ3 produces a 1 if an embedded operation is not successfully completed.
TMP19A71
17-58
TMP19A71
12)
Flash Control/Status Register This is a 32-bit register for monitoring the status of the flash memory. In Programmer mode, the RDY/BSY output is provided for the host system to monitor the status of an embedded algorithm. The TX19A core processor can poll the RDY/BSY bit in the FLCS register for the same purpose. The RDY/BSY bit is cleared to 0 when the flash memory is performing an embedded operation. The RDY/BSY bit is set to 1 when an embedded operation has completed and the flash memory is ready to accept the next command. If any failure occurs during an embedded operation, this bit remains 0. A hardware reset sets this bit to 1. The RDY/BSY bit is cleared to 0 upon completion of the final bus write cycle of an embedded operation command, with one exception. In the case of the Auto Block Erase command, this bit is cleared after the time-out has expired. Any command is ignored while the RDY/BSY bit is cleared.
7 6 R 0 5 R 0 4 R/W 0 Must be set to 0. 14 R 0 22 R 0 30 R 0 13 R 0 21 R 0 29 R 0 12 R 0 20 R 0 28 R 0 3 MROM R 0 0:Flash 1:Mask 11 R 0 19 R 0 27 R 0 2 RDY/BSY R 1 Ready/Busy 0: Busy 1: Ready 10 R 0 18 R 0 26 R 0 1 W 0 Must be set to 0. 9 R 0 17 R 0 25 R 0 8 R 0 16 R 0 24 R 0 0 R 0
FLCS (0xFFFF_E520)
Bit Symbol Read/Write Reset Value Function
W 0 Must be set to 0. 15
Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Bit Symbol Read/Write Reset Value Note 1: Note 2: Note 3:
R 0 23 R 0 31 W
This register must be accessed as a 32-bit quantity. This register does not support bit manipulation instructions. In the mask-version device, the MROM bit is set to 1 and any other bits are read-only with the same initial values.
TMP19A71
17-59
TMP19A71
13) Flash Security The TMP19A71 flash memory supports not only on-board programming but also programming using a general-purpose programmer. Therefore, the TMP19A71 flash memory provides a security feature to prevent intrusive access to the flash memory while in Programmer mode. The TMP19A71 is secured when both of the two blocks are protected, and the contents of the flash memory cannot be read by a programmer. * Turning on the anti-programmer security feature (Disabling read accesses) Turning on the anti-programmer security feature disables a general-purpose programmer from reading the contents of the flash memory. To turn on this feature, once programming is complete, protect both the flash blocks. If either one of the blocks is unprotected, the anti-programmer security feature is off. In on-board programming modes, the TX19A core processor can read the flash memory even if the anti-programmer security feature is on. When the anti-programmer security feature is on, any reads by programming equipment will always return a half-word length value of 0x0098. * Turning off the anti-programmer security feature (Enabling read accesses) The anti-programmer security feature is designed to disable reads of the flash memory by programming equipment. While the TMP19A71 is soldered on a board, the TX19A core processor can always read the flash memory, regardless of whether or not the anti-programmer security feature is on. Since the flash memory is placed under control of a user's application program in on-board operating modes, it is not easy for third parties to perform intrusive access to the flash memory. Therefore, within the confines of a board, the flash memory does not need to be secured. The anti-programmer security feature can be turned off by unprotecting both of the two flash blocks. Prior to turning off the anti-programmer security feature, the flash array is erased unconditionally. After the flash array is erased, the protect bit of each block is erased to turn off the anti-programmer security feature. In Single-Chip mode, block protection is lifted in a user application program. Thus, the flash memory is not erased when the anti-programmer security feature is turned off.
TMP19A71
17-60
TMP19A71
(4) Command definitions Table 17.4.4 On-Board Programming Mode Command Definitions
Command Sequence Cycles Required 1 3 4 6 6 4 1st Bus Cycle (Write) Addr. Reset Read/Reset Auto Program Auto Chip Erase Auto Block Erase Block Protect Block Unprotect ID Read/ Block Protect Verify 0xXXXX 0x5554 0x5554 0x5554 0x5554 0x5554 0x5554 0x5554 Data 0x0F0 0x0AA 0x0AA 0x0AA 0x0AA 0x0AA 0x0AA 0x0AA 2nd Bus Cycle (Write) Addr. 0xAAA8 0xAAA8 0xAAA8 0xAAA8 0xAAA8 0xAAA8 0xAAA8 Data 0x055 0x055 0x055 0x055 0x055 0x055 0x055 3rd Bus Cycle (Write) Addr. 0x5554 0x5554 0x5554 0x5554 0x5554 0x5554 0x5554 Data 0x0F0 0x0A0 0x080 0x080 0x09A 0x06A 0x090 4th Bus Cycle (Read/Write) Addr. RA PA 0x5554 0x5554 0x5554 0x5554 IA Data RD PD 0xAA 0xAA 0xAA 0xAA ID
(Continued from above)
Command Sequence Reset Read/Reset Auto Program Auto Chip Erase Auto Block Erase Block Protect Block Unprotect ID Read/Block Protect Verify Cycles Required 1 3 4 6 6 7 7 4 5th Bus Cycle (Write) Addr. Data 6th Bus Cycle (Write) Addr. Data 7th Bus Cycle (Write) Addr. Data
0xAAA8 0xAAA8 0xAAA8 0xAAA8
0x055 0x055 0x055 0x055
0x5554 BA 0x5554 0x5554
0x010 0x030 0x09A 0x06A
BA (Note 3) BPA 0x5554
0x030 0x09A 0x06A
Note 1: After every bus write cycle, execute the SYNC and NOP instructions in sequence. Note 2: In each bus write cycle, bits 16 to 19 should be set to the value coresponding to the flash memory address. Note 3: For a multi-block erase operation, add BA in the 7th and subsequent bus write cycles. Note 4: To operate on the flash memory, the watchdog timer must be disabled.
TMP19A71
17-61
TMP19A71
The addresses to be provided by the TX19A core processor are shown below. Table 17.4.5 Addresses Provided by the TX19A Core Processor
Command Address Addr. 0xXXX0 0x0000 0xAAA8 0x5554 Flash memory block A[23:16] A15 X 0 1 0 A14 A13 X 0 0 1 X 0 1 0 A12 X 0 0 1 A11 X 0 1 0 Address: A[23:0] A10 A9 X 0 0 1 X 0 1 0 A8 X 0 0 1 A7 X 0 1 0 A6 X 0 0 1 A5 X 0 1 0 A4 X 0 0 1 A3 0 0 1 0 A2 0 0 0 1 A1 0 0 0 0 A0 0 0 0 0
(5) Miscellaneous * 0x0F0, 0x0AA, 0x055, 0x0A0, 0x080, 0x09A, 0x06A, 0x090, 0x010, 0x030 Command sequence write data D[8:0]. To write command data, use a 32-bit (word) load (SW) instruction with D[31:9] = 0. * RA: Read Address Any address in the flash memory can be specified. * RD: Read Data The data at the RA (Read Address) can be read by using an 8-bit (byte) 16-bit (half-word) or 32-bit (word) load instruction. * PA: Program Address Any flash memory address (A[1:0]=0) to be programmed can be specified. * PD: Program Data By using a 32-bit (word) SW instruction, the PA (Program Address) can be programmed to the specified data. * IA: ID Address The flash memory address (A[1:0]=0) on which the ID-READ or Verify Block Protect command is to be executed. Table 17.4.6
A17 ID-READ (manufacturer's code) Verify Block 0 Protect Verify Block 1 Protect x 0 0 1 1 0 A6 0
IA (ID Address) Table
A4 0 A3 0 0x0098 (fixed) 0x0000_0001 (Block 0 protected) 0x0000_0000 (Block 0 not protected) 0x0000_0001 (Block 1 protected) 0x0000_0000 (Block 1 not protected) ID
* ID: ID Data The data that indicates the result of ID-READ or Verify Block Protect executed on the IA (ID Address).
TMP19A71
17-62
TMP19A71
* BA: Block Address The flash memory address (A[1:0]=0) to specify the block to be erased. For example, in User Boot mode, Block 0 can be selected by executing the LW instruction on an address in the range of 0xBFC0_0000 to 0xBFC1_FFFF (0x0000_00000x0001_FFFF). * BPA: Block Protect Address The flash memory address (A[1:0]=0) to specify the block to be protected. For example, in User Boot mode, Block 0 can be selected by executing the LW instruction on an address in the range of 0xBFC0_0000 to 0xBFC1_FFFF (0x0000_00000x0001_FFFF). Table 17.4.7
Block 0 Block 1
BA (Block Address) and BPA (Block Protect Address) Table
User Boot Mode Single Boot Mode 0x0000_0000 to 0x0001_FFFF 0x0002_0000 to 0x0003_FFFF Size 128 Kbytes 128 Kbytes A17 0 1
0xBFC0_0000 to 0xBFC1_FFFF (or 0x0000_0000 to 0x0001_FFFF) 0xBFC2_0000 to 0xBFC3_FFFF (or 0x0002_0000 to 0x0003_FFFF)
(6)
Programming Examples
(a) Programming example for ID-READ lui addiu lui ori ori sw sync nop ori sw sync nop ori sw sync nop ori lw lw lw sync nop r6,r0,0x00aa r7,0(r0) r7,0(r0) r7,0(r0) ; 4th bus read cycle ; 4th 0x0000_0000(IA:A6=A4=A3=A1=A0 =0) --> r7(dummy) ; 4th 0x0000_0000(IA:A6=A4=A3=A1=A0 =0) --> r7(dummy) ; 4th 0x0000_0000(IA:A6=A4=A3=A1=A0 =0) --> r7 r6,r0,0x0090 r6,0(r4) ; 3rd bus write cycle ; 3rd 0x0000_5554 <-- 0x0090 r6,r0,0x0055 r6,0(r5) ; 2nd bus write cycle ; 2nd 0x0000_aaa8 <-- 0x0055 r4,0x0000 r4,r4,0x5554 r5,0x0000 r5,r5,0xaaa8 r6,r0,0x00aa r6,0(r4) ; r4=0x0000_xxxx ; r4=0x0000_5554 ; r5=0x0000_xxxx ; r5=0x0000_aaa8 ; 1st bus write cycle ; 1st 0x0000_5554 <-- 0x00aa
TMP19A71
17-63
TMP19A71
(b) Programming example for polling the FLCS.RDY/BSY bit lui addiu rdybsy_lp: lw andi beq nop r6,0(r7) r6,r6,0x04 r6,r0,rdybsy_lp r7,hi(FLCS) r7,r7,lo(FLCS) ; r7=0xFFFF_xxxx ; r7=0xFFFF_E520 (FLCS address) ; RDY/BSY poiing ; r6 <-- FLCS ; Mask bits other than FLCS.RDY/BSY ; Loop until FLCS.RDY/BSY=1
(c) Programming example for erasing Block 1 and polling the write status flags lui addiu lui ori ori sw sync nop ori sw sync nop ori sw sync nop ori sw sync nop ori sw sync nop ori sw sync nop r6,r0,0x0030 r6,0(r5) ; 6th bus write cycle ; 6th 0x0002_aaa8(A17=1) <-- 0x0030 ; Start erasing Block 1 r6,r0,0x0055 r6,0(r5) ; 5th bus write cycle ; 5th 0x0002_aaa8 <-- 0x0055 r6,r0,0x00aa r6,0(r4) ; 4th bus write cycle ; 4th 0x0002_5554 <-- 0x00aa r6,r0,0x0080 r6,0(r4) ;3rd bus write cycle ; 3rd 0x0002_5554 <-- 0x0080 r6,r0,0x0055 r6,0(r5) ; 2nd bus write cycle ; 2nd 0x0002_aaa8 <-- 0x0055 r4,0x0002 r4,r4,0x5554 r5,0x0002 r5,r5,0xaaa8 r6,r0,0x00aa r6,0(r4) ; r5=0x0002_aaa8 ; 1st bus write cycle ; 1st 0x0002_5554 <-- 0x00aa ; r4=0x0002_5554
dq3_lp: lw r6,0(r5)
; Start polling the write status flags ; Read data at 0x0002_aaa8
TMP19A71
17-64
TMP19A71
andi beq nop dq7_lp: lw andi bne nop andi beq nop lw andi beq nop data_chk: nor lw beq nop erase_err: ori sw sync nop r6,r0,0x00F0 r6,0(r0) ; Software reset ; 1st 0x0000_0000 <-- 0x00F0 ; Return to Read mode r7,r0,r0 r6,0(r5) r7,r6,complete ; r7=0xFFFF_FFFF ; Read data at 0x0002_aaa8 again ; If erased properly, go to end routine r6,0(r5) r7,r6,0x80 r7,r0,erase_err ; Read data at 0x0002_aaa8 again ; Mask flags other than DQ7 ; If DQ7=0, go to error routine r7,r6,0x20 r7,r0,dq7_lp ; Mask flags other than MDQ5 ; If DQ5=0 (busy), go to dq7_lp r6,0(r5) r7,r6,0x80 r7,r0,data_chk ; Read data at 0x0002_aaa8 again ; Mask flags other than DQ7 ; If DQ7=1, go to data_chk r7,r6,0x08 r7,r0,dq3_lp ; Mask flags other than DQ3 ; If during the time-out (DQ3=0), go to dp3_lp
complete:
(Omitted)
; End routine
Note:
These programming examples assume the use of a Toshiba assembler. If a third-party assembler is used, syntax errors may occur. Change the code as necessary according to the assembler to be used.
TMP19A71
17-65
TMP19A71
(7)
Embedded Algorithms
Start
Auto Program Command Sequence (Shown below)
Data Polling Bit (Read as a word quantity)
Address = Address + 4 (Word-by-word)
No
Last Address?
Yes Auto Program Done
Auto Program Command Sequence (Address Command) 0x5554(Addr.)/0xAA(Data)
0xAAA8(Addr.)/55H(Data)
0x5554(Addr.)/A0H(Data)
Program Address (A1, A0 = 0) / Program Data (Word-by-word))
Figure 17.4.3 Auto Program Operation
TMP19A71
17-66
TMP19A71
Start
Auto Erase Command Sequence (Shown below)
Data Polling Bit (Read as a word quantity)
Auto Erase Done
Auto Chip Erase Command Sequence (Address/Command) 0x5554(Addr.)/0xAA(Data)
Auto Block/Multi-Block Erase Command Sequence (Address/Command) 0x5554(Addr.)/0xAA(Data)
0xAAA8(Addr.)/0x55(Data)
0xAAA8(Addr.)0x55(Data)
0x5554(Addr.)/0x80(Data)
0x5554(Addr.)/0x80(Data)
0x5554(Addr.)/0xAA(Data)
0x5554(Addr.)/0xAA(Data)
0xAAA8(Addr.)/0x55(Data)
0xAAA8(Addr.)/0x55(Data)
0x5554(Addr.)/0x10(Data)
Block Address/0x30(Data)
Block Address/0x30(Data)
Additional addresses for Auto Multi-Block Erase (each within 50 s)
Block Address/0x30(Data)
Figure 17.4.4 Auto Erase Operations
TMP19A71
17-67
TMP19A71
Start
Read a word. Addr. = VA
DQ7 = Data? No No DQ5 = 1? Yes Read a word. Addr. = VA
Yes
DQ7 = Data? No
Yes
Read a word. Addr. = virtual address
Compare with 32-bit quantity.
Fail
Pass
Figure 17.4.5 Data Polling (DQ7) Algorithm
TMP19A71
17-68
Under Development
TMP19A71
18. I/O Register Summary
18.1 Register Map
I/O registers occupy 16-Kbyte addresses from FFFFC000H through FFFFFFFFH. (1) Ports (2) Motor control circuit (PMD: Programmable Motor Driver) (3) Encoder input circuit (4) Serial I/O (SIO) (5) 16-bit timer/event counter (TMRB) (6) Watchdog timer (7) AD converter (8) Interrupts (9) Clock/standby control (10) DMA controller (DMAC) (11) Flash memory (12) ROM correction
TMP19A71
18-1
TMP19A71
[1] Ports
Address FFFFC000H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic P0D Address FFFFC010H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Address FFFFC020H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Address FFFFC030H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved
P0CR
P0PUCR
Reserved
Reserved
P0IER
Reserved
Reserved
Reserved
P0DSSR
Reserved
Reserved
Reserved
Address FFFFC040H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P1D
Address FFFFC050H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC060H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC070H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P1CR
P1PUCR
Reserved
Reserved
P1IER
Reserved
Reserved
Reserved
P1DSSR
Reserved
Reserved
Reserved
Address FFFFC080H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P2D
Address FFFFC090H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC0A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC0B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P2CR
P2PUCR
Reserved
Reserved
P2IER
Reserved
Reserved
Reserved
P2DSSR
Reserved
Reserved
Reserved
TMP19A71
18-2
Under Development
TMP19A71
Address FFFFC0C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P3D
Address FFFFC0D0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC0E0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC0F0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P3CR
P3PUCR
Reserved
Reserved
P3IER
Reserved
Reserved
Reserved
P3DSSR
Reserved
Reserved
Reserved
Address FFFFC100H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC110H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC120H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC130H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Address FFFFC140H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P5D
Address FFFFC150H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC160H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC170H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Reserved
P5PUCR
Reserved
Reserved
P5IER
P5FR
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
TMP19A71
18-3
TMP19A71
Address FFFFC180H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P6D
Address FFFFC190H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC1A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC1B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P6CR
P6PUCR
Reserved
Reserved
P6IER
P6FR
Reserved
Reserved
P6DSSR
Reserved
Reserved
Reserved
Address FFFFC1C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P7D
Address FFFFC1D0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC1E0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC1F0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P7CR
P7PUCR
Reserved
Reserved
P7IER
P7FR1
Reserved
Reserved
P7DSSR
P7FR2
Reserved
Reserved
Address FFFC200H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P8D
Address FFFFC210H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P8ODCR
Address FFFFC220H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC230H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P8CR
P8PUCR
Reserved
Reserved
P8IER
P8FR
Reserved
Reserved
P8DSSR
Reserved
Reserved
Reserved
TMP19A71
18-4
Under Development
TMP19A71
Address FFFFC240H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P9D
Address FFFFC250H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC260H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic P9ECR
Address FFFFC270H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
P9CR
P9PUCR
P9ECLR
Reserved
P9IER
P9FR1
Reserved
Reserved
P9DSSR
P9FR2
Reserved
Reserved
Address FFFFC280H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic PAD
Address FFFFC290H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC2A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic PAECLR
Address FFFFC2B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
PACR
PAPUCR
Reserved
Reserved
PAIER
PAFR
Reserved
Reserved
PADSSR
PAECR
Reserved
Reserved
Address FFFFC2C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic PBD
Address FFFFC2D0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFC2E0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic PBECLR
Address FFFFC2F0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
PBCR
PBPUCR
Reserved
Reserved
PBIER
PBFR
Reserved
Reserved
PBDSSR
PBECR
Reserved
Reserved
TMP19A71
18-5
TMP19A71
[2] PMD
Address FFFFC300H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic MDCR0 Address FFFFC310H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CMPV0 Address FFFFC320H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic EMGCR0 Address FFFFC330 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic TRGCMP02
MDCNT0
CMPW0
TRGCR0
Reserved
MDPRD0
MDOUT0
TRGCMP00
CMPU0
EMGREL0
TRGCMP01
Address FFFFC340H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic MDCR1
Address FFFFC350H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic CMPV1
Address FFFFC360H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic EMGCR1
Address FFFFC370 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic TRGCMP12
MDCNT1
CMPW1
TRGCR1
Reserved
MDPRD1
MDOUT1
TRGCMP10
CMPU1
EMGREL1
TRGCMP11
[3] ABZ Encoder
Address FFFFC400H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ENTNCR Address FFFFC410H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Address FFFFC420H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic
ENRELOAD
ENINT
ENCNT
TMP19A71
18-6
Under Development
[4] SIO
Address FFFFC480H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic SC0MOD0 SC0MOD1 Address FFFFC490H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic SC0BUF Address FFFFC4A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TMP19A71
Mnemonic SC1MOD0 SC1MOD1
Address FFFFC4B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic SC1BUF
SC0CR SC0MOD2
SC0FCNF
SC1CR SC1MOD2
SC1FCNF
BR0CR BR0ADD
SC0FTC SC0FRC
BR1CR BR1ADD
SC1FTC SC1FRC
SC0FTS SC0FRS
SC1FTS SC1FRS
Address FFFFC4C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic SC2MOD0 SC2MOD1
Address FFFFC4D0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic SC2BUF
Address FFFFC4E0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic SC3MOD0 SC3MOD1
Address FFFFC4F0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic SC3BUF
SC2CR SC2MOD2
SC2FCNF
SC3CR SC3MOD2
SC3FCNF
BR2CR BR2ADD
SC2FTC SC2FRC
BR3CR BR3ADD
SC3FTC SC3FRC
SC2FTS SC2FRS
SC3FTS SC3FRS
[5] TMRB
Address FFFFC700H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic TB0RUN Address FFFFC710H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic TB0REG1 Address FFFFC720H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic TB1RUN Address FFFFC730H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic TB1REG1
TB0MOD(L) (TB0MODH)
TB0CP0
TB1MOD(L) (TB1MODH)
TB1CP0
TB0FF
TB0CP1
TB1FF
Reserved
TB0REG0
TB0CNT
TB1REG0
TB1CNT
TMP19A71
18-7
TMP19A71
Address FFFFC740H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic TB2RUN
Address FFFFC750H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic TB2REG1
Address FFFFC760H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic TB3RUN
Address FFFFC770H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic TB3REG1
TB2MOD(L) (TB2MODH)
TB2CP0
TB3MOD(L) (TB3MODH)
TB3CP0
TB2FF
Reserved
TB3FF
Reserved
TB2REG0
TB2CNT
TB3REG0
TB3CNT
[6] WDT
Address FFFFC830H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic WDMOD(L) (WDMODH)
WDCR
WDCNT
[7-1] ADC (Normal Mode)
Address FFFFC900H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADNRES0 Address FFFFC910H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADNRES4 Address FFFFC920H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADCHPR0 Address FFFFC930H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADCHPC0
ADNRES1
ADNRES5
ADNMOD0(L) (ADNMOD0H)
ADCMP00
ADNRES2
ADNRES6
ADNCLK0
ADCMP01
ADNRES3
ADNRES7
CMPCTL0(L) (CMPCTL0H)
ADCBASN0
TMP19A71
18-8
Under Development
TMP19A71
Address FFFFC940H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCSTART0
Address FFFFC980H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADNRES8
Address FFFFC990H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADNRES12
Address FFFFC9A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCHPR1
Address FFFFC9B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCHPC1
ADNRES9
ADNRES13
ADNMOD1(L) (ADNMOD1H)
ADCMP10
ADNRES10
ADNRES14
ADNCLK1
ADCMP11
ADNRES11
ADNRES15
CMPCTL1(L) (CMPCTL1H)
ADCBASN1
Address FFFFC9C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCSTART1
TMP19A71
18-9
TMP19A71
[7-2] ADC (PMD Mode)
Address FFFFCD00H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADPRES0 Address FFFFCD10H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADPRES4 Address FFFFCD20H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Address FFFFCD30H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved
ADPRES1
ADPRES5
Reserved
Reserved
ADPRES2
ADPRES6
Reserved
Reserved
ADPRES3
ADPRES7
Reserved
Reserved
Address FFFFCD40H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCSETT00(L) (ADCSETT00H)
Address FFFFCD50H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
Address FFFFCD60H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADPMOD01(L) (ADPMOD01H)
Address FFFFCD70H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADMODSEL0
Reserved
Reserved
ADCNE0(L) (ADCNE0H)
ADCSET00(L) (ADCSET00H)
ADPCLK0
ADCNT0
ADCSET01(L) (ADCSET01H)
ADPMOD00
ADCBASP0
Address FFFFCD80H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADPRES8
Address FFFFCD90H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADPRES12
Address FFFFCDA0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADPRES16
Address FFFFCDB0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic Reserved
ADPRES9
ADPRES13
ADPRES17
Reserved
ADPRES10
ADPRES14
ADPRES18
Reserved
ADPRES11
ADPRES15
Reserved
Reserved
TMP19A71
18-10
Under Development
TMP19A71
Address FFFFCDC0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH [8] IRC Address FFFFD000H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCSETT10(L) (ADCSETT10H)
Address FFFFCDD0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADCSET12(L) (ADCSET12H)
Address FFFFCDE0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADPMOD11(L) (ADPMOD11H)
Address FFFFCDF0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic ADMODSEL1
ADCSETT11
Reserved
ADCNE1(L) (ADCNE1H)
ADCSET10(L) (ADCSET10H)
ADPCLK1
ADCNT1
ADCSET11(L) (ADCSET11H)
ADPMOD10
ADCBASP1
Mnemonic IMR00 (IMR01) (IMR02) (IMR03) IMR04 (IMR05) (IMR06) (IMR07) IMR08 (IMR09) (IMR10) (IMR11) IMR12 (IMR13) (IMR14) (IMR15)
Address FFFFD010H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IMR16 (IMR17) (IMR18) (IMR19) IMR20 (IMR21) (IMR22) (IMR23) IMR24 (IMR25) (IMR26) (IMR27) IMR28 (IMR29) (IMR30) (IMR31)
Address FFFFD020H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IMR32 (IMR33) (IMR34) (IMR35) IMR36 (IMR37) (IMR38) (IMR39) IMR40 (IMR41) (IMR42) (IMR43) IMR44 (IMR45) (IMR46) (IMR47)
Address FFFFD030H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IMR48 (IMR49) (IMR50) (IMR51) IMR52 (IMR53) (IMR54) (IMR55) IMR56 (IMR57) (IMR58) (IMR59) IMR60 (IMR61) (IMR62) (IMR63)
Address FFFFD040H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IMR64 (IMR65) (IMR66) (IMR67) IMR68 (IMR69) (IMR70) (IMR71) IMR72 (IMR73) (IMR74) (IMR75) IMR76 (IMR77) (IMR78) (IMR79)
Address FFFFD050H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IMR80 (IMR81) (IMR82) (IMR83) IMR84 (IMR85) (IMR86) (IMR87) IMR88 (IMR89) (IMR90) (IMR91) IMR92 (IMR93) (IMR94) (IMR95)
Address FFFFD080H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic IVR
Address FFFFD070H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
ICLR
ILEV
TMP19A71
18-11
TMP19A71
[9] Clock Generator
Address FFFFD300H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CLKACT Address FFFFD310H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CLKNMI Reserved CLKW0 Reserved Reserved Reserved Reserved Reserved Reserved Reserved CLKINT0 CLKINT1 CLKINT2 CLKINT3 Reserved Reserved Address FFFFD320H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Reserved Address Mnemonic FFFFD330H Reserved 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
CLKOSC CLKWUT CLKSPD CLKPRSC Reserved Reserved Reserved Reserved CLKMISC
[10] MODEC
Address FFFFD400H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic MODECR Address FFFFD410H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Address FFFFD420H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Address FFFFD430H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic
[11] DMAC
Address FFFFD600H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CCR0(LL) (CCR0LH) (CCR0HL) (CCR0HH) CSR0(LL) (CSR0LH) (CSR0HL) (CSR0HH) SAR0(LL) (SAR0LH) (SAR0HL) (SAR0HH) DAR0(LL) (DAR0LH) (DAR0HL) (DAR0HH) Address FFFFD610H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH DTCR0(LL) (DTCR0LH) (DTCR0HL) (DTCR0HH) Mnemonic BCR0(LL) (BCR0LH) (BCR0HL) (BCR0HH) Address FFFFD620H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CCR1(LL) (CCR1LH) (CCR1HL) (CCR1HH) CSR1(LL) (CSR1LH) (CSR1HL) (CSR1HH) SAR1(LL) (SAR1LH) (SAR1HL) (SAR1HH) DAR1(LL) (DAR1LH) (DAR1HL) (DAR1HH) Address FFFFD630H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH DTCR1(LL) (DTCR1LH) (DTCR1HL) (DTCR1HH) Mnemonic BCR1(LL) (BCR1LH) (BCR1HL) (BCR1HH)
TMP19A71
18-12
Under Development
Address FFFFD640H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic CCR2(LL) (CCR2LH) (CCR2HL) (CCR2HH) CSR2(LL) (CSR2LH) (CSR2HL) (CSR2HH) SAR2(LL) (SAR2LH) (SAR2HL) (SAR2HH) DAR2(LL) (DAR2LH) (DAR2HL) (DAR2HH) Address FFFFD650H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH DTCR2(LL) (DTCR2LH) (DTCR2HL) (DTCR2HH) Mnemonic BCR2(LL) (BCR2LH) (BCR2HL) (BCR2HH) Address FFFFD660H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TMP19A71
Mnemonic CCR3(LL) (CCR3LH) (CCR3HL) (CCR3HH) CSR3(LL) (CSR3LH) (CSR3HL) (CSR3HH) SAR3(LL) (SAR3LH) (SAR3HL) (SAR3HH) DAR3(LL) (DAR3LH) (DAR3HL) (DAR3HH) Address FFFFD670H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH DTCR3(LL) (DTCR3LH) (DTCR3HL) (DTCR3HH) Mnemonic BCR3(LL) (BCR3LH) (BCR3HL) (BCR3HH)
Address FFFFD680H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic CCR4(LL) (CCR4LH) (CCR4HL) (CCR4HH) CSR4(LL) (CSR4LH) (CSR4HL) (CSR4HH) SAR4(LL) (SAR4LH) (SAR4HL) (SAR4HH) DAR4(LL) (DAR4LH) (DAR4HL) (DAR4HH)
Address FFFFD690H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic BCR4(LL) (BCR4LH) (BCR4HL) (BCR4HH)
Address FFFFD6A0H 1H 2H 3H 4H 5H 6H 7H
Mnemonic CCR5(LL) (CCR5LH) (CCR5HL) (CCR5HH) CSR5(LL) (CSR5LH) (CSR5HL) (CSR5HH) SAR5(LL) (SAR5LH) (SAR5HL) (SAR5HH) DAR5(LL) (DAR5LH) (DAR5HL) (DAR5HH)
Address FFFFD6B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic BCR5(LL) (BCR5LH) (BCR5HL) (BCR5HH)
DTCR4(LL) (DTCR4LH) (DTCR4HL) (DTCR4HH)
8H 9H AH BH CH DH EH FH
DTCR5(LL) (DTCR5LH) (DTCR5HL) (DTCR5HH)
Address FFFFD6C0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic CCR6(LL) (CCR6LH) (CCR6HL) (CCR6HH) CSR6(LL) (CSR6LH) (CSR6HL) (CSR6HH) SAR6(LL) (SAR6LH) (SAR6HL) (SAR6HH) DAR6(LL) (DAR6LH) (DAR6HL) (DAR6HH)
Address FFFFD6D0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic BCR6(LL) (BCR6LH) (BCR6HL) (BCR6HH)
Address FFFFD6E0H 1H 2H 3H 4H 5H 6H 7H
Mnemonic CCR7(LL) (CCR7LH) (CCR7HL) (CCR7HH) CSR7(LL) (CSR7LH) (CSR7HL) (CSR7HH) SAR7(LL) (SAR7LH) (SAR7HL) (SAR7HH) DAR7(LL) (DAR7LH) (DAR7HL) (DAR7HH)
Address FFFFD6F0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic BCR7(LL) (BCR7LH) (BCR7HL) (BCR7HH)
DTCR6(LL) (DTCR6LH) (DTCR6HL) (DTCR6HH)
8H 9H AH BH CH DH EH FH
DTCR7(LL) (DTCR7LH) (DTCR7HL) (DTCR7HH)
TMP19A71
18-13
TMP19A71
Address FFFFD700H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic DCR(LL) (DCRLH) (DCRHL) (DCRHH) Reserved Reserved Reserved Reserved
Address FFFFD710H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH
Mnemonic
Address FFFFD720H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
Address FFFFD730H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
DHR(LL) (DHRLH) (DHRHL) (DHRHH)
CH DH EH FH
Address FFFFD740H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
Address FFFFD750H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
Address FFFFD760H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
Address FFFFD770H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
Mnemonic
TMP19A71
18-14
Under Development
TMP19A71
[12] Flash Memory (Flash version only; DMA not supported)
Address FFFFE510H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic SEQMOD Address FFFFE520H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic FLCS Address FFFFE530H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic B0DCR
SEQCNT
B0DLR
Reserved
B1DCR
Reserved
B1DLR
[13] ROM Correction (DMA not supported)
Address FFFFE540H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADDREG0 Address FFFFE550H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic ADDREG4 Address FFFFE560H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved Address FFFFE570H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH Mnemonic Reserved
ADDREG1
ADDREG5
Reserved
Reserved
ADDREG2
ADDREG6
Reserved
Reserved
ADDREG3
ADDREG7
Reserved
Reserved
TMP19A71
18-15
TMP19A71
18.2
FFFF_C000
Bus Error Area
FFFF_D000 Ports 0 to 3 IRC FFFF_D0FF FFFF_D080 (Note 1) (Note 1) FFFF_D2FF FFFF_D300 Ports 5 to B CG FFFF_D33F FFFF_D340 PMD (Note 1) FFFF_D3FF FFFF_D400 (Note 1) MODEC FFFF_D4FF FFFF_D500 ENC (Note 1) FFFF_D5FF FFFF_D600 (Note 1) DMAC FFFF_D61B FFFF_D61C SIO (Note 2) FFFF_D61F FFFF_D620 (Note 1) DMAC FFFF_D63B FFFF_D63C TMRB (Note 2) FFFF_D63F FFFF_D640 (Note 1) DMAC FFFF_D65B FFFF_D65C WDT (Note 2) FFFF_D65F FFFF_D660 (Note 1) DMAC FFFF_D67B ADC (Normal) FFFF_D67C (Note 2) FFFF_D67F FFFF_D680 (Note 1) DMAC FFFF_D69B ADC (PMD) FFFF_D69C (Note 2) FFFF_D69F FFFF_D6A0 (Note 1) DMAC FFFF_D6BB Bus error area. A store access does not cause a bus error exception, but a NMI occurs.(MODECR=0) Bus error area, but a store access does not cause a NMI. FFFF_FFFF FFFF_E6FF FFFF_E700 (Note 1) FFFF_E4FF FFFF_E500 Flash /ROM FFFF_E48B FFFF_E48C (Note 2) FFFF_E47F FFFF_E480 Reserved FFFF_E40F FFFF_E410 (Note 1) FFFF_E3FF FFFF_E400 Reserved FFFF_D7FF FFFF_D800 (Note 1) FFFF_D70F FFFF_D710 (Note 2) FFFF_D70B FFFF_D70C DMAC FFFF_D707 FFFF_D708 (Note 2) FFFF_D6FF FFFF_D700 DMAC FFFF_D6FB FFFF_D6FC (Note 2) FFFF_D6DF FFFF_D6E0 DMAC FFFF_D6DB FFFF_D6DC (Note 2) FFFF_D6BF FFFF_D6C0 DMAC FFFF_D6BC (Note 2)
FFFF_C0FF FFFF_C100 FFFF_C13F FFFF_C140 FFFF_C2FF FFFF_C300 FFFF_C37F FFFF_C380 FFFF_C3FF FFFF_C400 FFFF_C43F FFFF_C440 FFFF_C47F FFFF_C480 FFFF_C4DF FFFF_C4E0 FFFF_C6FF FFFF_C700 FFFF_C77F FFFF_C780 FFFF_C82F FFFF_C830 FFFF_C83F FFFF_C840 FFFF_C8FF FFFF_C900 FFFF_C9FF FFFF_CA00 FFFF_CCFF FFFF_CD00 FFFF_CDFF FFFF_CE00 FFFF_CFFF Note 1: Note 2:
TMP19A71
18-16
TMP19A71
19. Electrical Characteristics
19.1 Maximum Ratings Mask-Version Product
Parameter Symbol VCC15 (Core) Supply voltage VCC3 (I/O) AVCC (AD) Input voltage Low-level output current High-level output current Per pin Total Per pin Total VIN IOL IOL IOH IOH PD TSOLDER TSOLDER Ta ave TSTG TOPR Rating -0.3 to 3.0 -0.3 to 3.9 -0.3 to 3.6 -0.3 to VCC3 + 0.3 (Note 2) -0.3 to AVCC + 0.3 15 80 -15 -50 600 260 350 -20 to 65 -65 to 150 -40 to 85 mW mA
(Note 1)
The letter X in equations presented in this chapter represents the fsys or IMCLK period selected by the CLKPRSC.PRS1 or PRS2 field.
Unit
V
V
Power dissipation (Ta = 85C) Soldering temperature 10 seconds 3 seconds
Average temperature Storage temperature Operating temperature
VCC15DVCC15CVCC15, VCC3DVCC3, AVCCAVCCn (n0, 1), VSSDVSSAVSSCVSS Note 1: Note 2: The absolute maximum rating of VCC3 (-0.3 to 3.9 V) must not be exceeded. Since Ports 5 to 7 use AVCC as the power supply for each port function, the maximum rating for AVCC (-0.3 to 3.6 V) should be applied to these ports. Note 3: Maximum ratings are limiting values of operating and environmental conditions which should not be exceeded under the worst possible conditions. The equipment manumacturer should design so that no maximum rating value is exceeded with respect to current, voltage, power dissipation, temperature, etc. Exposure to conditions beyond those listed above may cause permanent damage to the device or affect device reliability, which could increase potential risks of personal injury due to IC blowup and/or burning.
TMP19A71
19-1
TMP19A71
Flash-Version Product
Parameter Supply voltage Symbol VCC2 (Core) VCC3 (I/O) AVCC (A/D) Input voltage VIN Low-level output current High-level output current Per pin Total Per pin Total IOL IOL IOH IOH PD TSOLDER TSOLDER Ta ave TSTG Rating -0.3 to 3.6 -0.3 to 3.9 -0.3 to3.6 -0.3 to VCC3 + 0.3 (Note 2) -0.3 to AVCC + 0.3 15 80 -15 -50 1000 260 350 -20 to 65 -65 to 150 -40 to 85 TOPR -0 to 60 NWE 100 cycle mW mA
(Note 1)
Unit
V
V
Power dissipation (Ta = 85C) Soldering temperature 10 seconds 3 seconds
Average temperature Storage temperature Operating temperature Other than Flash program/erase Flash program/erase
Flash reprogram times
VCC2DVCC2CVCC2FVCC2, VCC3FVCC3DVCC3, AVCCAVCCn (n0, 1), VSSDVSSAVSSCVSSFVSS
Note 1: Note 2:
The absolute maximum rating of VCC3 (-0.3 to 3.9V) must not be exceeded. Since Ports 5 to 7 use AVCC as the power supply for each port function, the maximum rating for AVCC (-0.3 to 3.6 V) should be applied to these ports.
Note 3:
Maximum ratings are limiting values of operating and environmental conditions which should not be exceeded under the worst possible conditions. The equipment manufacturer should design so that no maximum rating value is exceeded with respect to current, voltage, power dissipation, temperature, etc. Exposure to conditions beyond those listed above may cause permanent damage to the device or affect device reliability, which could increase potential risks of personal injury due to IC blowup and/or burning.
Note 4:
The number of times the flash memory can be reprogrammed includes programming of nonvolatile bits in the flash ROM. Note that programming nonvolatile bits to the same value is also counted in the reprogram times.
TMP19A71
19-2
TMP19A71
19.2 Recommended Operating Conditions Mask-Version Product
Ta -40 to 85 Parameter Supply voltage DVCC15CVCC15 DVCC3 CVSSDVSSAVSS0V P0, P1, P23, P3, P80-P83, P85, P86, P94, PA0-PA5, PB0-PB5 P5-P63 (Used as a port) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, PA7, PB6, PB7, P95/NMI, RESET X1 P0, P1, P23, P3, P80-P83, P85-P86, P94, PA0-PA5, PB0-PB5 P5-P63 (Used as a port) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, PA7, PB6, PB7, P95/NMI, RESET X1 Symbol Conditions Min. Typ.
(Note 1)
Max.
Unit
DVCC15 DVCC3 Input clock = 4 to 7 MHz fsys = 32 to 56 MHz
1.35 3.0 3.0
1.65 3.6 3.6 V
AVCCn VIL
3.0 V DVCC3 3.6 V
0.3 DVCC3
Low-level input voltage
VIL1
3.0 V AVCCn (n=0, 1) 3.6 V -0.3 3.0 V DVCC3 3.6 V 3.0 V AVCCn (n=0, 1) 3.6 V
0.3 AVCCn V 0.2 DVCC3 (0.2 AVCCn)
VIL2 VIL3 VIH
1.35 V CVCC15 1.65 V 3.0 V DVCC3 3.6 V 0.7 DVCC3
0.1 CVCC15 DVCC3
High-level input voltage
VIH1
3.0 V AVCCn (n=0, 1) 3.6 V
0.7 AVCCn
AVCCn V
VIH2
3.0 V DVCC3 3.6 V 3.0 V AVCCn (n=0, 1) 3.6 V
0.8 DVCC3 (0.8 AVCCn)
DVCC3 (AVCCn)
VIH3
1.35 V CVCC15 1.65 V
0.9 CVCC15
CVCC15
Note 1:
Recommended operating conditions are usage conditions recommended for proper operation of the device maintaining an expected level of quality. The equipment manufacturer should design so that no recommended operating condition is exceeded with respect to supply voltage, operating temperature range, AC/DC specifications, etc. Using the device under conditions beyond those listed above may cause the device to malfunction. No maximum absolute rating as well as recommended operating condition must ever be exceeded. Since AVCCn is also used as the power supply for Ports 5 to 7, it should be connected to a power source even if the AD converter is not used. Unless otherwise specified, the values specified for ports also apply to functions assigned to each port.
Note 2: Note 3:
Note 4:
TMP19A71
19-3
TMP19A71
Flash-Version Product
Ta -40 to 85 Parameter Supply voltage DVCC2FVCC2CVCC2 DVCC3FVCC3 CVSSDVSSFVSS AVSS0V P0, P1, P23, P3, P80-P83, P85, P86, P94, PA0-PA5, PB0-PB5 P5-P63 (Used as a port) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, PA7, PB6, PB7, P95/NMI, RESET X1 P0, P1, P23, P3, P80-P83, P85, P86, P94, PA0-PA5, PB0-PB5 P5-P63 (Used as a port) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, PA7, PB6, PB7, P95/NMI, RESET X1 Symbol Conditions Min. Typ.
(Note 1)
Max.
Unit
DVCC2 DVCC3 Input clock = 4 to 7 MHz fsys = 32 to 56 MHz
2.3
2.7 V
3.0
3.6
AVCCn VIL
3.0
3.6
3.0 V DVCC3 3.6 V
0.3 DVCC3
Low-level input voltage
VIL1
3.0 V AVCCn (n=0, 1) 3.6 V -0.3 3.0V DVCC3 3.6 V 3.0 V AVCCn (n=0, 1) 3.6 V
0.3 AVCCn V 0.2 DVCC3 (0.2 AVCCn)
VIL2 VIL3 VIH
2.3 V CVCC2 2.7 V
0.1 CVCC2
3.0 V DVCC3 3.6 V
0.7 DVCC3
DVCC3
High-level input voltage
VIH1
3.0 V AVCCn (n=0, 1) 3.6 V
0.7 AVCCn
AVCCn V
VIH2
3.0 V DVCC3 3.6 V 3.0 V AVCCn (n=0, 1) 3.6 V
0.8 DVCC3 (0.8 AVCCn)
DVCC3 (AVCCn)
VIH3
2.3 V CVCC2 2.7 V
0.9 CVCC2
CVCC2
Note 1:
Recommended operating conditions are usage conditions recommended for proper operation of the device maintaining an expected level of quality. The equipment manufacturer should design so that no recommended operating condition is exceeded with respect to supply voltage, operating temperature range, AC/DC specifications, etc. Using the device under conditions beyond those listed above may cause the device to malfunction. No maximum absolute rating as well as recommended operating condition must ever be exceeded. Since AVCCn is also used as the power supply for Ports 5 to 7, it should be connected to a power source even if the AD converter is not used. Unless otherwise specified, the values specified for ports also apply to functions assigned to each port.
Note 2: Note 3:
Note 4:
TMP19A71
19-4
TMP19A71
19.3 DC Electrical Characteristics (1/2) Mask-Version Product
Parameter Low drive capability High drive capability Low drive capability High drive capability Ta -40 to 85 Symbol Conditions Min. Typ.
(Note1)
Max.
Unit
Low-level output (Note 2) voltage
IOL = 0.5 mA VOL IOL = 2 mA IOL =10 mA VOH ILI ILO IOH = -0.5 mA IOH = -2 mA
DVCC3 3.0 V DVCC3 3.0 V DVCC3 3.0 V DVCC3 3.0 V 2.4 DVCC3 3.0 V 0.02 0.05
0.4 1.0
V
High-level output (Note 2) voltage Input leakage current
0.0 VIN DVCC3 0.0 VIN AVCCn (n=0, 1) 0.2 VIN DVCC3-0.2 0.2 VIN AVCCn-0.2 (N=0, 1)

5 A 10
Output leakage current Hysteresis (Schmitt width) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, A7, PB6, PB7, P95/NMI, RESET Pull-up resistor Pin capacitance (excluding power supply pins) Note 1: Note 2:
VIN
3.0VDVCC33.6V 3.0 V AVCCn (n=0, 1) 3.6 V
0.4
0.9
1.6
V
PUP CIO
DVCC3 = 3.0 V to 3.6 V fc = 1 MHz
40
100
185 10
k pF
Ta = 25, DVCC3 = 3.3 V, DVCC15 = 1.5V and AVCCn = 3.3 V, unless otherwise noted. The drive capability can be set to low or high in the PnDSSR register for each port. Ta -40 to 85 Symbol Conditions Min. Typ.
(Note 1)
Flash-Version Product
Parameter
Low drive
Max.
Unit
Low-level output (Note 2) voltage
capability High drive capability Low drive
IOL = 0.5mA VOL IOL = 2mA IOL = 10mA VOH ILI ILO IOH = -0.5mA IOH = -2mA
DVCC3 3.0V DVCC3 3.0V DVCC3 3.0V DVCC3 3.0V 2.4 DVCC3 3.0V 0.02 0.05
0.4 1.0
V
High-level output (Note 2) voltage Input leakage current
capability High drive capability
0.0 VIN DVCC3 0.0 VIN AVCCn (n=0, 1) 0.2VINDVCC3-0.2 0.2 VIN AVCCn-0.2 (n=0, 1)
5 A 10
Output leakage current Hysteresis (Schmitt width) P20-P22, P24, P64-P67, P70-P72, P84, P87, P90-P93, P95, PA6, PA7, PB6, PB7, P95/NMI, RESET Pull-up resistor Pin capacitance (excluding power supply pins) Note 1: Note 2:
VIN
3.0V DVCC3 3.6 V 3.0 V AVCCn (n=0, 1) 3.6 V
0.4
0.9
1.6
V
PUP CIO
DVCC3 = 3.0 V to 3.6 V fc = 1 MHz
40
100
185 10
k pF
Ta=25, DVCC3=3.3V, DVCC2=2.5V and AVCCn=3.3V, unless otherwise noted. The drive capability can be set to low or high in the PnDSSR register for each port.
TMP19A71
19-5
TMP19A71
19.4 DC Electrical Characteristics (2/2) Mask-Version Product
DVCC15 CVCC151.35 V to 1.65 V, DVCC3 3.0 V to 3.6 V, AVCCn 3.0 V to 3.6 V, Ta -40 to 85 (n0, 1) Parameter Symbol ICCN15 ICCD ICCH ICCSt fsys=56 MHz (Input clock = 7 MHz, PLL x16, gear ratio = 1/2) DVCC15=CVCC15=1.35 to 1.65V DVCC3= 3.0 to 3.6V AVCCn=3.0 to 3.6V Conditions Min. Typ.
(Note 1)
Max.
(Note 2)
Unit
NORMAL 1.5V IDLE (Doze) IDLE (Halt) STOP
(Note 3)
70 45 45 3
90 60 60 5 mA mA
Note 1: Note 2: Note 3:
Ta=25, DVCC3=3.3V, DVCC15=1.5V and AVCCn=3.3V, unless otherwise noted. Max. values are theoretical maximum values that should not be exceeded under the worst possible conditions. ICCN (Typ) measurement conditions: Run an arithemetic program provided by Toshiba with all internal peripheral active.
Flash-Version Product
DVCC2 CVCC2 2.3 V to 2.7 V, DVCC3 3.0 V to 3.6 V, AVCCn 3.0 V to 3.6 V, Ta -40 to 85 (n 0, 1)
Parameter
Symbol ICCN2 ICCD2 ICCH2 ICCSt fsys = 56 MHz
Conditions
Min.
Typ.
(Note 1)
Max.
(Note 2)
Unit
NORMAL 2.5V IDLE (Doze) IDLE (Halt) STOP
(Note 3)
212 130 120 11
285 200 190 1000 A mA
(Input clock = 7 MHz, PLL x16, gear ratio = 1/2) DVCC2 = CVCC2 = 2.3 to 2.7 V DVCC3 = 3.0 to 3.6 V AVCCn = 3.0 to 3.6 V
Note 1: Note 2: Note 3:
Ta=25, DVCC3=3.3V, DVCC2=2.5V and AVCCn=3.3V, unless otherwise noted. Max. values are theoretical maximum values that should not be exceeded under the worst possible conditions. ICCN (Typ) measurement conditions: Run an arithmetic program provided by Toshiba with all internal peripherals acitve.
TMP19A71
19-6
TMP19A71
19.5 10-Bit AD Conversion Characteristics Mask-Version Product
DVCC15 = CVCC15 = 1.35 to 1.65 V, DVCC3 = 3.0 to 3.6 V, AVCCn = VREFH = 3.0 to 3.6 V, AVSS = DVSS = VREFL = 0 V, Ta -40 to 85
Parameter Analog reference voltage (+) Analog input voltage Integral nonlinearity error
(Note 6) (Note 3)
Symbol VREFH VAIN
Conditions
Min 3.0 AVSS
Typ
Max 3.6 AVCCn
Unit V V LSB

Differential nonlinearity error
AVCCn = VREFH = 3.0 to 3.6 V DVSS = AVSS AVCCn load capacitance 10 F VREFH load capacitance 10 F Conversion time 2.36 s
1.5
3
1
2
LSB
Offset error
4
7
LSB
Gain error
2
4
LSB
Relative error
(Note 5)

4
8
LSB
Total error
4
7
LSB
Note 1: 1 LSB = (VREFH-VREFL)/1024 [V] Note 2: The supply current flowing through the AVCCn pin is included in the digital supply current parameter (ICC). Note 3: The VREFHn pin is shared with the AVCCn pin. Note 4: The above characteristics apply when the ADC input pins are not used for other functions. Note 5: Indicates the difference between the minimum and maximum conversion errors. Note 6: Indicates a value after offset and gain errors have been adjusted.
TMP19A71
19-7
TMP19A71
Flash-Version Product
DVCC2 = FVCC2 = CVCC2 = 2.5 0.2 V, DVCC3 = 3.3 0.3 V, AVCCn = VREFH = 3.0 to 3.6 V, AVSS = DVSS = VREFL = 0 V, Ta -40 to 85
Parameter Analog reference voltage (+) Analog input voltage Integral nonlinearity error
(Note 6) (Note 3)
Symbol VREFH VAIN
Condition
Min 3.0 AVSS
Typ
Max 3.6 AVCCn
Unit V V LSB

Differential nonlinearity error
AVCCn = VREFH = 3.0 to 3.6V DVSS = AVSS AVCCn load capacitance 10F VREFH load capacitance 10F Conversion time2.36s
1.5
3
1
2
LSB
Offset error
4
7
LSB
Gain error
2
4
LSB
Relative error
(Note 6)

4
8
LSB
Total error
4
7
LSB
Note 1: 1 LSB = (VREFH-VREFL)/1024 [V] Note 2: The supply current flowing through the AVCCn pin is included in the digital supply current parameter (ICC). Note 3: The VREFHn pin is shared with the AVCCn pin. Note 4: The above characteristics apply when the ADC input pins are not used for other functions. Note 5: Indicates the difference between the minimum and maximum conversion errors. Note 6: Indicates a value after offset and gain errors have been adjusted.
TMP19A71
19-8
TMP19A71
19.6 SIO Timings Mask-Version Product
(1) I/O Interface Mode (DVCC3 = 3.3 0.3 V, DVCC15 = 1.5 0.15 V, Ta = -40 to 85 C) The letter x in the tables below represents the system clock fsys period which depends on the clock gear setting. * SCLK Input mode (SIO2)
Parameter SCLK period TxD data to SCLK rise or fall * TxD data hold after SCLK rise or fall* RxD data valid to SCLK rise or fall* RxD data hold after SCLK rise or fall* Symbol tSCY tOSS tOHS tSRD tHSR Equation Min 16x (tSCY/2) - 4x - 23 (tSCY/2) + 2x 2x + 8 0 Max 56 MHz Min 286 50 179 44 0 Max ns ns ns ns ns Unit
*) SCLK rise or fall: Measured relative to the programmed active edge of SCLK.
* SCLK Output mode (SIO2)
Parameter SCLK period (programmable) TxD data to SCLK rise TxD data hold after SCLK rise RxD data valid to SCLK rise RxD data hold after SCLK rise Symbol tSCY tOSS tOHS tSRD tHSR Equation Min 16x (tSCY/2) - 15 (tSCY/2) - 15 2X + 23 0 Max 56 MHz Min 286 128 128 59 0 Max ns ns ns ns ns Unit
SCLK Output Mode Active-High SCLK Input Mode Active-Low Output Data TxD
tSCY
tOSS 0 tSRD 1
tOHS 2 tHSR 1 Valid 2 Valid 3 Valid 3
Input Data RxD
0 Valid
Note 1: Output level measurement conditions: High 0.8DVCC3 [V] / Low 0.2DVCC3 [V], CL=30 pF Note 2: Input level measurement conditions: High 0.7DVCC3 [V] / Low 0.2DVCC3 [V]
TMP19A71
19-9
TMP19A71
Flash-Version Product
(1) I/O Interface mode (DVCC3 = 3.3 0.3 V, DVCC2 = 2.5 0.2 V, Ta = -40 to 85 C) The letter x in the tables below represents the system clock fsys period which depends on the clock gear setting. * SCLK Input mode (SIO2)
Parameter SCLK period TxD data to SCLK rise or fall* TxD data hold after SCLK rise or fall* RxD data valid to SCLK rise or fall* RxD data hold after SCLK rise or fall* Symbol tSCY tOSS tOHS tSRD tHSR Equation Min 16x (tSCY/2) - 4x - 23 (tSCY/2) + 2x 2x + 8 0 Max 56 MHz Min 286 50 179 44 0 Max ns ns ns ns ns Unit
*) SCLK rise or fall: Measured relative to the programmed active edge of SCLK
* SCLK Output mode (SIO2)
Parameter SCLK period (programmable) TxD data to SCLK rise TxD data hold after SCLK rise RxD data valid to SCLK rise RxD data hold after SCLK rise Symbol tSCY tOSS tOHS tSRD tHSR Equation Min 16x (tSCY/2) - 15 (tSCY/2) - 15 2X + 23 0 Max 56 MHz Min 286 128 128 59 0 Max ns ns ns ns ns Unit
SCLK Output Mode Active-High SCLK Input Mode Active-Low Output Data TxD
tSCY
tOSS 0 tSRD 1
tOHS 2 tHSR 1 Valid 2 Valid 3 Valid 3
Input Data RxD
0 Valid
Note 1: Output level measurement conditions: High 0.8DVCC3 [V] / Low 0.2DVCC3 [V], CL=30 pF Note 2: Input level measurement conditions: High 0.7DVCC3 [V] / Low 0.2DVCC3 [V]
TMP19A71
19-10
TMP19A71
19.7 Event Counter Mask-Version and Flash-Version Products
The letter x in the table below represents the IMCLK period.
Parameter Clock low-level pulse width Clock high-level pulse width Symbol Min tVCKL tVCKH X + 100 X + 100 Equation Max IMCLK = 28 MHz Min 136 136 Max ns ns Unit
19.8 Capture Mask-Version and Flash-Version Products
The letter x in the table below represents the IMCLK period.
Parameter Low-level pulse width High-level pulse width Symbol Min tCPL tCPH X + 100 X + 100 Equation Max IMCLK = 28 MHz Min 136 136 Max ns ns Unit
19.9 Interrupts (INTC) Mask-Version and Flash-Version Products
The letter x in the table below represents the system clock fsys period.
Parameter INT0 to A low-level pulse width INT0 to A high-level pulse width Symbol Min tINTAL tINTAH X + 100 X + 100 Equation Max fsys = 56 MHz Min 118 118 Max ns ns Unit
19.10 Interrupts (NMI, STOP wakeup interrupt) Mask-Version and Flash-Version Products
Parameter NMI, INT0 to 4 low-level pulse width INT0 to 4 high-level pulse width Symbol tINTBL tINTBH Equation Min 100 100 Max fsys = 56 MHz Min 100 100 Max ns ns Unit
TMP19A71
19-11
TMP19A71
19.11 ADTRG Input Mask-Version and Flash-Version Products
The letter x in the table below represents the IMCLK period.
Parameter ADTRG low-level pulse width ADTRG high-level pulse width Symbol Min tadL tadh X + 100 X + 100 Equation Max IMCLK = 28 MHz Min 136 136 Max ns ns Unit
TMP19A71
19-12
TMP19A71
20. Package Dimensions
20.1 P-LQFP-1414-0.50F
TMP19A71
20-1
TMP19A71
20.2
P-QFP-1420-0.65A
TMP19A71
20-2


▲Up To Search▲   

 
Price & Availability of TMP19A71CYFG

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

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


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