PRELIMINARY DATA SHEET MICRONAS CDC16xxF-E Automotive Controller Family User Manual CDC1605F-E Automotive Controller Specification Edition May 25, 2004 6251-606-1PD MICRONAS CDC16xxF-E PRELIMINARY DATA SHEET Contents Page Section Title 5 5 9 1. 1.1. 1.2. Introduction Features Abbreviations 11 11 13 14 14 17 18 2. 2.1. 2.2. 2.3. 2.4. 2.5. 2.6. Package and Pins Pin Assignment Package Outline Dimensions Multiple Function Pins Pin Function Description External Components Pin Circuits 19 19 20 21 28 28 3. 3.1. 3.2. 3.3. 3.4. 3.5. Electrical Data Absolute Maximum Ratings Recommended Operating Conditions Characteristics Recommended Crystal Characteristics Flash/EMU Port Characteristics 31 31 32 35 37 4. 4.1. 4.2. 4.3. 4.4. CPU and Clock System W65C816 Operating Modes Clock System EMI Reduction Module (ERM) 39 39 41 44 5. 5.1. 5.2. 5.3. Memory and Boot System RAM and ROM Memory Banking Boot System 48 48 49 54 55 6. 6.1. 6.2. 6.3. 6.4. Core Logic Control Register CR Reset Logic Standby Registers Test Registers 56 57 57 57 7. 7.1. 7.2. 7.3. Multiplier Functional Description Registers Operation of the Multiplier 58 59 60 64 68 69 70 8. 8.1. 8.2. 8.3. 8.4. 8.5. 8.6. Power-Saving Module (PSM) Functional Description Registers Operation of Power-Saving Module Operation of RTC Module Operation of Polling Module Operation of Port Wake Module 2 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Contents, continued Page Section Title 72 72 73 9. 9.1. 9.2. Memory Patch Module Principle of operation Registers 75 75 77 79 81 83 10. 10.1. 10.2. 10.3. 10.4. 10.5. Interrupt Controller (IR) Principle of Operation Registers Interrupt Assignment Interrupt Timing Port Interrupt Module 85 85 86 88 90 91 11. 11.1. 11.2. 11.3. 11.4. 11.5. Ports Analog Input Port 0 Universal Ports U1 to U7 Universal Port Registers High Current Ports H0.0 to H3.5 High Current Port Registers 92 93 93 12. 12.1. 12.2. A/D Converter (ADC) Operation Registers 95 95 97 13. 13.1. 13.2. Timers (TIMER) Timer T0 Timer T1 and T2 99 99 100 14. 14.1. 14.2. Pulse Width Modulator (PWM) Principle of Operation Registers 101 102 103 15. 15.1. 15.2. Capture Compare Module (CAPCOM) Principle of Operation Registers 105 105 107 107 108 16. 16.1. 16.2. 16.3. 16.4. Stepper Motor Module (SMM) Functional Description Registers Principle of Operation Rotor Zero Position Detection (RZPD) 110 110 113 113 17. 17.1. 17.2. 17.3. LCD Module Principle of Operation Registers Software Hints for Cascading LCD Modules 115 115 116 119 119 121 18. 18.1. 18.2. 18.3. 18.4. 18.5. DMA Principle of Operation Registers Ports SW Application Hints Timings Micronas May 25, 2004; 6251-606-1PD 3 CDC16xxF-E PRELIMINARY DATA SHEET Contents, continued Page Section Title 125 126 127 128 19. 19.1. 19.2. 19.3. Serial Synchronous Peripheral Interface (SPI) Principle of Operation Registers Timing 129 130 132 134 20. 20.1. 20.2. 20.3. Universal Asynchronous Receiver Transmitter (UART) Principle of Operation Timing Registers 136 137 137 143 148 150 21. 21.1. 21.2. 21.3. 21.4. 21.5. CAN Manual Abbreviations Functional Description Application Notes Bit Timing Logic Bus Coupling 152 152 152 153 154 22. 22.1. 22.2. 22.3. 22.4. DIGITbus System Description Bus Signal and Protocol Other Features Standard Functions Optional Functions 155 155 155 155 158 161 164 23. 23.1. 23.2. 23.3. 23.4. 23.5. 23.6. DIGITbus Master Module Introduction Context Functionality Registers Principle of Operation Timings 165 166 169 24. 24.1. 24.2. Audio Module (AM) Functional Description Registers 171 171 171 25. 25.1. 25.2. Hardware Options Functional Description Listing of Dedicated Addresses and Corresponding Hardware Options 176 176 176 177 178 26. 26.1. 26.2. 26.3. 26.4. Register Cross Reference Table V2.1 CAN RAM, memory pages 19 ... 1B CAN Registers, memory page 1C I/O Registers, memory page 1E I/O Registers, memory page 1F 182 27. Register Quick Reference 208 28. Differences 210 29. Data Sheet History 4 May 25, 2004; 6251-606-1PD Micronas Release Note: Revision bars indicate significant changes to the previous edition. The IC is a single-chip controller for use in automotive applications. The CPU on the chip is an upgrade of the 65C02 with 16-bit internal data and 24-bit address bus. The chip consists of timer/counters, an interrupt controller, a multichannel A/D converter, a stepper motor and LCD driver, CAN interfaces and PWM outputs. 1.1. Features PRELIMINARY DATA SHEET Micronas 1. Introduction Table 1-1: CDC16xxF Family Feature List May 25, 2004; 6251-606-1PD This Document: Item CDC1605F-E EMU CDC1607F-E MCM Flash CDC1631F-E MASK ROM CDC1605F-C EMU CDC1607F-C MCM Flash CDC1641F-C Mask ROM CDC1652F-C Mask ROM CDC1672F-C Mask ROM 2.75 KB 4 KB 6 KB 90 KB 128 KB 216 KB Core 16-bit 65C816, featuring software compatibility with its 8-bit NMOS and CMOS 6500-series predecessors CPU-Active Operation Modes FAST, SLOW and DEEP SLOW FAST and SLOW Power Saving Modes (CPU Inactive) WAKE and IDLE - EMI Reduction Mode selectable in FAST mode Oscillators 4 to 12 MHz Quartz and 20 to 57 kHz internal RC 4 MHz to 12 MHz Quartz RAM 6 KB 2 KB 6 KB ROM ROMless, external program storage with up to 16 MB, internal 2 KB Boot ROM 64 KB ROMless, external program storage with up to 16 MB, internal 2 KB Boot ROM 256 KB Flash, bottom boot configuration, internal 2 KByte Boot ROM 256 KB Flash, bottom boot configuration, internal 2 KB Boot ROM 5 CDC16xxF-E CPU This Document: May 25, 2004; 6251-606-1PD Item CDC1605F-E EMU CDC1607F-E MCM Flash CDC1631F-E MASK ROM Multiplier, 8 by 8 bit Digital Watchdog Central Clock Divider Interrupt Controller expanding NMI 16 inputs,15 priority levels Port Interrupts including Slope Selection 4 inputs Port Wake-Up Inputs including Slope / Level Selection 10 Patch Module 10 ROM locations 5 ROM locations Boot System allows in-system downloading of code and data into RAM via serial link - CDC1605F-C EMU CDC1607F-C MCM Flash CDC1641F-C Mask ROM CDC1652F-C Mask ROM 10 ROM locations 5 ROM locations 6 ROM locations allows in-system downloading of code and data into RAM via serial link - - CDC1672F-C Mask ROM - CDC16xxF-E 6 Table 1-1: CDC16xxF Family Feature List, continued - - Analog Combined Input for Regulator Input Supervision Clock and Supply Supervision 10-bit ADC, charge balance type 9 channels (5 channels selectable as digital input) ADC Reference VREF Pin Comparators P06COMP with 1/2 AVDD reference LCD Internal processing of all analog voltages for the LCD driver Micronas PRELIMINARY DATA SHEET Reset/Alarm This Document: Item CDC1605F-E EMU CDC1607F-E MCM Flash CDC1631F-E MASK ROM CDC1605F-C EMU CDC1607F-C MCM Flash CDC1641F-C Mask ROM CDC1652F-C Mask ROM CDC1672F-C Mask ROM Communication May 25, 2004; 6251-606-1PD DMA 1 DMA Channel for serving the Graphics Bus interface - 1 DMA Channel for serving the Graphics Bus interface - 1 DMA Channel for serving the Graphics Bus interface UART 3: UART0, UART1 and UART2 1: UART0 3: UART0, UART1 and UART2 1: UART0 3: UART0, UART1 and UART2 Synchronous Serial Peripheral Interfaces 2: SPI0 and SPI1 1: SPI0 2: SPI0 and SPI1 1: SPI0 2: SPI0 and SPI1 Full CAN modules V2.0B 3: CAN0, CAN1 and CAN2 with 256-byte object RAM each (LCAN000F) 1: CAN0 with 256-byte object RAM (LCAN000F) 3: CAN0, CAN1 and CAN2 with 256-byte object RAM each (LCAN0009) 1: CAN0 with 256-byte object RAM (LCAN0009) 2: CAN0 and CAN1 with 256-byte object RAM each (LCAN0009) DIGITbus 1 master module - 1 master module - 1 master module 2 Modules: PWM0, PWM1 5 Modules: PWM0, PWM1, PWM2, PWM3 and PWM4 PRELIMINARY DATA SHEET Micronas Table 1-1: CDC16xxF Family Feature List, continued Input & Output up to 52 I/O or 48 LCD segment lines (=192 segments), in groups of two configurable as I/O or LCD Universal Port Slew Rate HW preselectable Stepper Motor Control Modules with High-Current Ports 5 Modules, 24 dI/dt controlled ports 8-bit PWM Modules 5 Modules: PWM0, PWM1, PWM2, PWM3 and PWM4 Audio Module with autodecay SW select. Clock outputs 2 Polling / Flash Timer Output 1 High-Current Port output operable in Power Saving Mode 3 Modules: PWM0, PWM1, PWM2 5 Modules: PWM0, PWM1, PWM2, PWM3 and PWM4 - 7 CDC16xxF-E Universal Ports selectable as 4:1 mux LCD Segment/Backplane lines or Digital I/O Ports This Document: Item CDC1605F-E EMU CDC1607F-E MCM Flash CDC1631F-E MASK ROM CDC1605F-C EMU CDC1607F-C MCM Flash Timers & Counters May 25, 2004; 6251-606-1PD 16-bit free running counters with Capture/ Compare modules CCC0 with 3CAPCOM 16-bit timers 1: T0 8-bit timers 2: T1 and T2 Real Time Clock, Delivering Hours, Minutes and Seconds CDC1641F-C Mask ROM CDC1652F-C Mask ROM CDC1672F-C Mask ROM CDC16xxF-E 8 Table 1-1: CDC16xxF Family Feature List, continued - Miscellaneous - Various randomly selectable hardware options Most options software-programmable, copy from user program storage during system start-up Core Bond-Out Supply Voltage 4.5 V to 5.5 V Temperature Range Mask programmed according to user specification Most options software-programmable, copy from user program storage during system start-up - Tcase: 0 C to +70 C Tcase: -40 C to +105 C Tamb: -40 C to +85 C Type Ceramic 177PGA Plastic 100QFP 0.65 mm pitch Ceramic 177PGA Plastic 100QFP 0.65 mm pitch Bonded Pins 176 100 176 100 - Package Micronas PRELIMINARY DATA SHEET Scalable layout in CAN, RAM and ROM May 25, 2004; 6251-606-1PD AM CAN CAPCOM CPU DMA ERM IR LCD P06COMP PINT PSM PWM RTC SM SPI T0 T1, T2 UART Audio Module Controller Area Network Module Capture/Compare Module Central Processing Unit Direct Memory Access Module EMI Reduction Module Interrupt Controller Liquid Crystal Display Module P0.6 Alarm Comparator Port Interrupt Module Power Saving Module 8-Bit Pulse Width Modulator Module Real time Clock Stepper Motor Control Module Serial Synchronous Peripheral Interface 16-Bit Timer 0 8-Bit Timers 1 and 2 Universal Asynchronous Receiver Transmitter PRELIMINARY DATA SHEET Micronas 1.2. Abbreviations CDC16xxF-E 9 CDC16xxF-E PRELIMINARY DATA SHEET VSS VDD Test Patch Module Watchdog Clock RC Oscillator 8-Bit Timer 1 65C816 CPU 8-Bit Timer 2 16-Bit CAPCOM 1 RTC Power Saving Module DMA Logic Banking ERM XTAL1 XTAL2 8 CAN 1 Reset/Alarm RESETQ TEST 8 16 Inputs Interrupt Controller UPort3 EVDD EVSS LCD Control UPort1 Data-, address- and control bus 40 UPort2 UVDD UVSS 8 16-Bit CAPCOM 2 16-Bit Timer 0 DIGITbus Multiplier 8 by 8 bit RAM 6k x 8 UART 0 UPort4 VREF AVDD AVSS 8 UPort5 Audio Module 8 6 HPort0 9 PPort0 UART 2 CAN 10-Bit ADC Clock Out 0 Stepper Motor Control Clock Out 1 6 HPort1 16-Bit CAPCOM 0 UART 1 8-Bit PWM 2 CAN 0 UPort6 Boot ROM 8 UPort7 6 HPort2 8-Bit PWM 0 4 SPI 0 8-Bit PWM 4 6 HPort3 SPI 1 8-Bit PWM 1 8-Bit PWM 3 HVDD1 HVSS1 HVDD2 HVSS2 Fig. 1-1: Block diagram of CDC1605F-E 10 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 2. Package and Pins 2.1. Pin Assignment 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 A 92 88 85 83 79 75 71 70 66 64 60 55 51 49 48 A B 93 91 87 84 80 76 74 69 65 61 59 54 50 47 44 B C 95 94 90 86 81 78 73 68 63 58 56 53 46 43 41 C D 99 98 97 89 82 77 72 67 62 57 52 45 42 40 39 D E 104 103 100 96 177 38 37 36 35 E F 108 105 102 101 33 34 32 31 F G 110 109 107 106 28 29 30 27 G 23 24 25 26 H J 115 118 117 116 18 19 21 22 J K 119 120 122 121 13 14 17 20 K L 123 124 125 126 8 12 15 16 L M 127 128 130 133 140 145 150 155 160 165 170 1 9 10 11 M 2 6 7 N 3 5 P 4 Q Top View H 114 113 112 111 N 129 131 134 141 144 146 151 156 161 166 169 174 P 132 135 138 142 147 149 153 157 162 164 168 172 175 Q 136 137 139 143 148 152 154 158 159 163 167 171 173 176 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 A1 Top View Pin 1 Fig. 2-1: Pin Map of CPGA177 Package Micronas May 25, 2004; 6251-606-1PD 11 CDC16xxF-E Bus Mode LCD Mode Pin Functions Port Port Special Out Special In Basic Function EADB21 EADB20 NC NC EPH2 EBE EVPA EVDA ESTOPCLK UVSS UVDD ADB7 SEG3.7 T2-OUT U3.7 ADB6 SEG3.6 CC1-OUT U3.6 ADB5 SEG3.5 SPI1-CLK-OUT SPI1-CLK-IN U3.5 ADB4 SEG3.4 T0-OUT WP0 U3.4 ADB3 SEG3.3 CC2-OUT U3.3 ADB2 SEG3.2 DIGIT-OUT DIGIT-IN U3.2 ADB1 SEG3.1 CO1 SPI1-D-IN U3.1 ADB0 SEG3.0 SPI1-D-OUT U3.0 NC NC NC Extra pin for avoiding wrong chip insertion. Connect to System Ground. NC NC NC NC SEG6.7 CAN0-TX MULTI_TEST_IN U6.7 SEG6.6 PINT1-OUT CAN0-RX/WP1 U6.6 SEG6.5 T1-OUT SPI0-D-IN U6.5 Connect to System Ground SEG6.4 SPI0-D-OUT U6.4 TEST RESETQ XTAL2 XTAL1 VSS VDD SEG6.3 SPI0-CLK-OUT SPI0-CLK-IN U6.3 SEG6.2 T1-OUT PINT2-IN/WP5 U6.2 SEG6.1 LCD-CLK-OUT PINT1-IN/WP4 U6.1 SEG6.0 LCD-SYNC-OUT PINT0-IN/WP3 U6.0 WEQ SEG1.7 CAN1-TX U1.7 CEQ SEG1.6 CAN1-RX/WP2 U1.6 ITSTOUT SEG1.5 LCD-CLK-OUT U1.5 RWQ SEG1.4 LCD-SYNC-OUT U1.4 PH2 BP3 U1.3 OEQ BP2 U1.2 BE BP1 U1.1 RDY BP0 ITSTOUT U1.0 EADB17 EADB0 EDB7 EDB6 EDB5 EDB4 EDB3 EDB2 EDB1 EDB0 Connect to System Ground EVSS1 NC NC NC NC NC EVDD1 EOEQ ECEQ EADB1 STOPCLK SMB1+ H1.5 VPQ SMB1H1.4 VPA SMB2+ H1.3 Connect to System Ground VDA SMB2SMB-COMP H1.2 DB7 SME1+/PWM2 H1.1 DB6 SME1-/PWM0 H1.0 HVDD1 HVSS1 DB5 SME2+ H0.5 DB4 SME2SME-COMP H0.4 DB3 SMA1+ H0.3 DB2 SMA1H0.2 DB1 SMA2+ H0.1 DB0 SMA2SMA-COMP H0.0 SMD1+ H3.5 SMD1H3.4 SMD2+ H3.3 PRELIMINARY DATA SHEET Co- Pin ord. No. Pin CoNo. ord. M8 N8 P8 Q8 Q7 M7 N7 P7 Q6 P6 M6 N6 Q5 P5 N5 M5 Q4 P4 Q3 N4 P3 Q2 E5 M4 N3 P2 Q1 P1 N2 N1 L4 M3 M2 M1 L3 K4 K3 L2 L1 K2 J4 J3 K1 J2 J1 H4 H3 H2 H1 G1 G4 G3 G2 F1 F2 F4 F3 E1 E2 E3 E4 D1 D2 C1 D3 C2 B1 D4 C3 B2 A1 A2 B3 A3 D5 C4 B4 A4 C5 D6 C6 B5 A5 B6 D7 C7 A6 B7 A7 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 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 56 57 58 59 60 61 62 63 64 65 66 177 155 154 133 1 132 44 88 45 66 67 87 NC = not connected, leave vacant Q9 P9 Q10 N9 M9 P10 Q11 P11 N10 M10 N11 Q12 P12 N12 M11 Q13 P13 Q14 Q15 P14 N13 M12 P15 N14 M13 N15 M14 M15 L12 L13 L14 L15 K13 K12 K14 K15 J14 J13 J12 J15 H15 H14 H13 H12 G15 G14 F15 G13 G12 F14 E15 E14 F13 F12 E13 D15 D14 D13 E12 C15 C14 B15 A15 B14 C13 D12 A14 B13 C12 A13 B12 A12 D11 C11 B11 A11 C10 D10 B10 A10 B9 C9 D9 A9 A8 B8 C8 D8 Pin Functions Basic Port Port Function Special In Special Out EADB22 EADB23 U7.0 U7.1 U7.2 GRDQ U7.3 GWRQ U4.0 CAN2-RX/WP7 U4.1 CAN2-TX U4.2 UART2-RX U4.3 UART2-TX U4.4 UART0-RX/WP8 U4.5 UART0-TX U4.6 CC2-IN CC1-OUT U4.7 CC1-IN Connect to System Ground U5.0 CC0-IN CO1 U5.1 INT-TEST-IN CC0-OUT U5.2 LCD-CLK-IN AM-PWM U5.3 LCD-SYNC-IN AM-OUT U5.4 IRQ UART1-TX U5.5 ABORTQ CO0 NC NC NC NC NC U5.6 PINT3/WP6 PWM2 U5.7 PINT3/UART1-RX PINT0-OUT U2.0/GD0 U2.1/GD1 U2.2/GD2 U2.3/GD3 U2.4/GD4 U2.5/GD5 U2.6/GD6 U2.7/GD7 AVSS AVDD VREF NC P0.1 P0.1 digital input P0.2 P0.2 digital input P0.3 P0.3 digital input P0.4 P0.4 digital input P0.5 P0.5 digital input P0.6 P0.6 Comparator input P0.7 P0.8 P0.9 EADB16 EADB15 EADB14 EADB13 EADB12 EADB11 EADB10 EADB9 EWEQ Connect to System Ground EADB18 EVSS2 NC NC NC NC NC NC NC EVDD2 EADB19 EADB8 EADB7 EADB6 EADB5 EADB4 EADB3 EADB2 H2.0 SMC-COMP SMC2H2.1 SMC2+ H2.2 SMC1H2.3 SMC1+ H2.4 WP9 PWM0 H2.5/POL PWM4 HVSS2 HVDD2 H3.0 PWM1 H3.1 PWM3 H3.2 SMD-COMP SMD2- LCD Mode Bus Mode SEG7.0 SEG7.1 SEG7.2 SEG7.3 SEG4.0 SEG4.1 SEG4.2 SEG4.3 SEG4.4 SEG4.5 SEG4.6 SEG4.7 ADB8 ADB9 ADB10 ADB11 ADB12 ADB13 ADB14 ADB15 SEG5.0 SEG5.1 SEG5.2 SEG5.3 SEG5.4 SEG5.5 SEG5.6 SEG5.7 SEG2.0 SEG2.1 SEG2.2 SEG2.3 SEG2.4 SEG2.5 SEG2.6 SEG2.7 ADB16 ADB17 ADB18 ADB19 ADB20 ADB21 ADB22 ADB23 Fig. 2-2: Pin Assignment for CPGA177 Package 12 May 25, 2004; 6251-606-1PD Micronas PIN No. 1 INDEX 38 0.4 21 0.2 19.8 Micronas May 25, 2004; 6251-606-1PD 7.6 0.2 1 0.1 0.4 0.1 4.80 0.20 0.2 0.8 0.46 0.05 2.1 0.20 A B C K 140 D 52 F G 28 H J 18 L M 1 170 160 8 126 62 E 116 MIS-INSERT COVERING PIN 106 150 38 96 2.540 x 14 = 35.56 0.2 72 82 2.540 0.15 N P D0022-B/1 Q 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 PRELIMINARY DATA SHEET CDC16xxF-E 2.2. Package Outline Dimensions Fig. 2-3: CPGA177 Ceramic Pin Grid Array 177-Pin (Weight approx. 14g) 13 2.540 0.15 2.540 x 14 = 35.56 0.2 1. 0.1 11.7 CDC16xxF-E PRELIMINARY DATA SHEET 2.3. Multiple Function Pins 2.3.1. U-Ports Apart from their basic function (digital I/O), Universal Ports (prefix "U") have overlaid alternative functions (see Fig. 2-2 on page 12). How to enable Basic Function, Special In and Special Out mode is explained in the functional description of the UPorts. How to enable LCD mode is explained in the functional descriptions of LCD module and U-Ports. Bus Mode is used for testing purposes only. It is controlled by the Control Register (CR) setting. Refer to section "Control Word" for more information. 2.3.2. H-Ports Apart from their basic function (digital I/O), High Current Ports (prefix "H") have overlaid alternative functions (see Fig. 2-2 on page 12). How to enable Basic Function, Special In and Special Out mode is explained in the functional description of the HPorts. The Bus Mode is used for testing purposes only. It is controlled by the Control Register (CR) setting. Refer to section "Control Word" for more information. 2.3.3. Emulator Bus In the CPGA177 package, the Emulator Bus (prefix "E") serves as connection to an external emulation hardware. In the PQFP100 MCM Package it is internally connected to the Flash program storage and is not available to the outside. Its function is controlled by register CR. Refer to section "Control Word" for more information. 2.4. Pin Function Description ABORTQ The Abort input serves as the CPU's ABORTQ input provided that flag EXTIR in register SR2 is set. Active LOW. CC0-IN, CC1-IN, CC2-IN These signals are the capture inputs of the CAPCOM0, CAPCOM1 and CAPCOM2 modules. ADB0 to ADB23 These 24 lines form the address bus for memory and I/O exchange. The function is controlled by register CR. CC0-OUT, CC1-OUT, CC2-OUT These signals are the compare outputs of the CAPCOM0, CAPCOM1 and CAPCOM2 modules. AM-OUT This is the output signal of the AM. CEQ This output signal connects to external memory's CEQ pin and reduces its power consumption when CPU operates in SLOW mode. Active LOW. AM-PWM This is the output signal of the 8-bit PWM of the AM. It is intended for testing only. AVDD This is the positive power supply for ADC, P06COMP and ERM. AVDD should be kept at VDD 0.5 V. AVSS This is the negative reference for the ADC and the negative power supply for ADC, P06COMP and ERM. Connect to system ground. CO0, CO1 The signals Clock Out 0 and 1 provide frequency outputs. Both are connected to internal prescaler and multiplexer. They can be hard-wired by HW Option. Refer to section "Hardware Options" for setting the CO0 bytes 00FFABh, 00FFB2h, 00FFB3h, 00FFB6h and the CO1 byte 00FFACh. For testing purposes it is possible to drive clocks and other signals of internal peripheral modules out of CO0 and CO1. Selection is done via register TST2. BE The Bus Enable output signal shows the state of the internal CPU. 1: Internal CPU has bus access. 0: Internal CPU has no bus access. DB0 to DB7 The eight bidirectional Data Bus lines provide the 8-bit data bus for use during data exchanges between the microprocessor and external memory or peripherals. The function is controlled by register CR. BP0 to BP3 These pin functions serve as Backplane drivers for a 4:1 multiplexed LCD. DIGIT-IN This is the receive input line of the DIGITbus module. CAN0-RX, CAN1-RX, CAN2-RX These signals provide the input lines for the CAN0, CAN1 and CAN2 modules. CAN0-TX, CAN1-TX, CAN2-TX These signals provide the output lines for the CAN0, CAN1 and CAN2 modules. DIGIT-OUT This is the transmit output line of the DIGITbus module. EADB0 to EADB23 These 24 lines form the address bus for external memory access on the Emulator Bus. The function is controlled by register CR. EBE The Emulator Bus Enable output signal shows the state of 14 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET the internal CPU. 1: Internal CPU has bus access. 0: Internal CPU has bus no access. GD0 to GD7 These eight bidirectional Graphics IC Data lines provide an 8-bit DMA controlled data link to an external IC. ECEQ Emulator Bus Chip Enable output signal connects to external memory's CEQ pin and reduces its power consumption when CPU operates in SLOW mode. Active LOW. GRDQ This Graphics IC Read line provides the control signal for read accesses via the GD7 to GD0 bus. Active LOW. EDB0 to EDB7 These eight bidirectional Emulator Data Bus lines provide the 8-bit data bus for use during data exchanges between the microprocessor and external memory or peripherals. EOEQ The Emulator Bus Output Enable signal connects to the OEQ pin of external memory for read access. Active LOW. EPH2 This output is the system clock of the Emulator Bus. It provides the timing for external memory access. ESTOPCLK If the Emulator Stop Clock input signal is HIGH, all the peripheral modules are halted (fOSC is stopped), whereas the clock PH2 and the CPU remain active. Thus it is possible to read the registers and memory for debugging purposes. For normal operation connect ESTOPCLK to System Ground or leave it floating (internal pull-down). EVDA The Emulator Bus Valid Data Address output signal shows the state of the internal CPU. It must be considered together with the signal EVPA (Emulator Bus Valid Program Address). Each signal indicates a valid memory address when high. Table 2-1: Valid Memory Address EVDA, VDA EVPA, VPA State 0 0 Internal Operation. Address and data bus available. Address bus may be invalid. 0 1 Valid program address. May be used for program cache control. 1 0 Valid data address. May be used for data cache control. 1 1 Opcode fetch. May be used for program cache control and single step control. EVDD1, EVDD2 These two lines form the positive power supply of the Emulator Bus drivers. EVPA Refer to EVDA. EVSS1, EVSS2 These two lines form the negative supply of the Emulator Bus drivers. Connect to system ground. EWEQ The output signal Emulator Bus Write Enable connects to the external memory's WEQ pin and activates it for write access. Active LOW. Micronas GWRQ This Graphics IC Write line provides the control signal for write accesses via the GD7 to GD0 bus. Active LOW. H0.0 to H3.5 The High Current Ports are intended for use as digital I/O which can drive higher currents than the Universal Ports. Each of the high current ports H0 to H3 is six bits wide. HVDD1, HVDD2 The pins HVDD1 and HVDD2 are the positive power supply of the high current ports H0.0 to H3.5. HVDD1 feeds ports H0 and H1. HVDD2 feeds ports H2 and H3. HVDD1 and HVDD2 should be kept at VDD 0.5 V. Be careful to design the PCB traces for carrying the considerable operating current on these pins. HVSS1, HVSS2 The pins HVSS1 and HVSS2 are the negative power supply for the high-current ports H0.0 to H3.5. HVSS1 feeds ports H0 and H1. HVSS2 feeds ports H2 and H3. Both have to be hard-wired to system ground. Be careful to layout sufficient PCB traces for carrying the considerable operating current on these pins. INT-TEST-IN Test input signal for Interrupt Controller. IRQ IRQ serves as the CPU's IRQ input, provided that flag EXTIR in register SR2 is set. Active LOW. LCD-CLK-IN The Clock input of the LCD module receives the clock of an optional external LCD master driver which is used to extend the LCD driver capability. This input is active if the internal LCD module is configured as slave and the external LCD driver operates as master. LCD-CLK-OUT The Clock output of the LCD module provides a clock signal to optional external LCD slave drivers if the internal LCD module is configured as master and the other LCD drivers are slaves. LCD-SYNC-IN The Synchronization input of the LCD module receives the sync signal from an optional external LCD master driver. This input is active if the internal LCD module is configured as slave and the external LCD driver serves as master. LCD-SYNC-OUT The Synchronization output of the LCD module provides a sync signal to optional external LCD slave drivers if the internal LCD module is configured as master and the other LCD drivers are slaves. MULTI-TEST-IN This is a test input line. It is intended for factory test only. The application should not use this signal. OEQ The Output Enable output signal connects to the OEQ pin of external memory for read access. Active LOW. PH2 The System Clock output signal provides timing for external May 25, 2004; 6251-606-1PD 15 CDC16xxF-E PRELIMINARY DATA SHEET read or write operations. Addresses are valid (after the Address Setup Time) following the negative transition of PH2. The function is controlled by register CR. SEG1.4 to SEG7.3 These pin functions serve as Segment drivers for a 4:1 multiplexed LCD. PINT0-IN, PINT1-IN, PINT2-IN The Port Interrupt 0, 1 and 2 inputs serve as inputs to the PINT. SMA to SME These lines are intended for driving stepper motors. They are the outputs of the SM. Two of these lines together with an external coil form an H-bridge. Thus each of the signals SMA to SME can drive a two-phase bipolar stepper motor. PINT3 The Port Interrupt 3 input serves as input to the PINT. HW option FFC2h has to be set to determine whether U5.6 or U5.7 is the source of PINT3-IN. PINT0-OUT, PINT1-OUT The Port Interrupt 0 and 1 outputs carry the output signals of the PINT. POL Output of the Polling Module. PWM0 to PWM4 These are the outputs of the PWM. Some of these PWM signals are directed to two pins. P0.1 to P0.9 These 9 analog ports are the multiplexed input channels of the ADC. Analog port P0.6 is additionally input to the P06COMP. The analog ports P0.1 to P0.5 can also be used as five digital input lines. The digital function of the analog ports should be disabled (P0DIN in register SR1 set to 0) when operating these ports as analog inputs to avoid leakage currents. RDY This output signal shows the state of the internal CPU. 1: CPU active 0: CPU halted by IR or DMA RESETQ This bidirectional signal is used to initialize all modules and start program execution. Two comparators distinguish three input levels: - A low level resets all internal modules. - A medium level activates all internal modules and starts program execution. An alarm signal is generated which can be directed to the interrupt controller. - A high level keeps all internal modules active and cancels the alarm signal. The RESETQ input signal must be held low for at least two clock cycles after VDD reaches operating voltage. Internal reset sources output their reset request on the RESETQ pin via an internal open drain pull-down transistor. Thus RESETQ can be wire-ored with external reset sources. The internally limited pull-down current allows direct connection to large capacitors. The connection of such a capacitor (e.g. 10 nF) is recommended to reduce the capacitive influence of the neighboring XTAL2 pin. RESETQ must be pulled up by an external pull-up resistor (e.g. 10 k). RWQ This input/output signal controls data exchange in cooperation with DB and ADB. It can be driven from the external CPU if the internal CPU is switched off. 1: CPU reads data. 0: CPU writes data. 16 SMA-COMP to SME-COMP These lines are comparator inputs that connect to one line each of the SMA to SME lines. They serve to distinguish rotation from stand-still during zero detection in each stepper motor. SPI0-CLK-IN, SPI1-CLK-IN The Serial Synchronous Peripheral Interface Clock input receives the bit clock from an external master, to shift data in or out of SPI0 resp. SPI1 in slave mode. This means that the external master controls the bit stream. SPI0-CLK-OUT, SPI1-CLK-OUT The Serial Synchronous Peripheral Interface Clock output supplies the bit clock of SPI0 resp. SPI1 to an external slave, to shift data in or out of SPI0 resp. SPI1 in master mode. This means that the internal SPI controls the bit stream. SPI0-D-IN, SPI1-D-IN These are the data input lines of the SPI0 and SPI1 modules. SPI0-D-OUT, SPI1-D-OUT These are the data output lines of the SPI0 and SPI1 modules. STOPCLK If the input signal Stop Clock is HIGH, all the peripheral modules are halted (fOSC is stopped). But the clock PH2 and the CPU remain active. Thus it is possible to read the registers and memory for debugging purposes. TEST must be held high to enable STOPCLK. TEST The main function of the Test pin is to define the source for the Control Word fetch during reset. If TEST is held low during reset, the Control Word is fetched via the Emulator Bus (from internal Flash program storage in MCM package). If TEST is held high during reset, the Control Word is fetched via the Test Bus. For normal operation with internal code connect TEST to System Ground or leave it floating (internal pull-down). TEST must be held high in active mode to enable STOPCLK. T0-OUT The Timer 0 output is connected to the zero output of T0 by a divide by 2 scaler. The scaler generates a 50% pulse duty factor. T1-OUT, T2-OUT These signals are connected to the zero outputs of T1 and T2. T1-OUT is directed to several pins. UART0-RX, UART1-RX, UART2-RX These are the Receive input lines of UART0, UART1 and UART2. Polarity of the signals is settable by HW options FFB4h, respectively FFB5h. UART0-TX, UART1-TX, UART2-TX These are the data output lines of UART0, UART1 and UART2. Polarity of signals is settable by HW options FFB4h, respectively FFB5h. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET UVDD The pin UVDD is the positive supply voltage for the U-Port output stages (see Fig. 2-4 for external connection). vector location during an interrupt sequence. VPQ is low during the last two interrupt sequence cycles, during which time the CPU reads the interrupt vector. UVSS The pin UVSS is the negative power supply for the U-Port output stages. It has to be connected to system ground (see Fig. 2-4). VREF This pin is the positive reference input for the ADC. The voltage at this pin must be set to a level between 2.56 Volts and AVDD. U1.0 to U7.3 Universal ports are intended for use as digital I/O or as LCD driver outputs. The ports U1 to U6 consist of eight bit lines each. Port U7 is 4 bits wide. VSS The pin VSS is the negative supply terminal of the internal digital modules (see Fig. 2-4 for external connection). WEQ The Write Enable output signals a write access to external memory. Active LOW. VDA The signal Valid Data Address must be considered together with the signal VPA (Valid Program Address). They show the state of the internal CPU. If the internal CPU is switched off, both signals may be driven from the outside. Together they indicate a valid memory address when HIGH (see Table 2-1 on page 15). WP0 to WP9 The Wake Port inputs are inputs to the Port Wake Module inside the Power Saving Module. They serve as Wake Ports during power saving modes and as port interrupt inputs during CPU-active modes. VDD The pin VDD is the positive supply voltage for the internal digital modules (see Fig. 2-4 for external connection). XTAL1 This is the quartz oscillator or clock input pin (see Fig. 2-4 for external connection). VPA Refer to VDA. XTAL2 This is the quartz oscillator output pin for two pin oscillator circuits (see Fig. 2-4 for external connection). VPQ The Vector Pull output indicates that the CPU addresses a 2.5. External Components C = 100 n to 150 n +5 V UVDD EVDD 0 to 1 +5 V 2*C L VDD EVSS 0 to 1 VSS HVDD 0 to 1 System Ground C C = 100 n to 150 n +5 V 2*C 18 p XTAL1 C System Ground HVSS 0 to 1 IC +5 V Analog AVDD +5 V 18 p 4.7 k XTAL2 VREF RESETQ AVSS 10 n 47 n Resetq System Ground C Analog Ground UVSS Fig. 2-4: Recommended external supply and quartz connection for low electromagnetic interference (EMI) To provide effective decoupling and to improve EMC behavior, the small decoupling capacitors must be located as close to the supply pins as possible. The self-inductance of these Micronas capacitors and the parasitic inductance and capacitance of the interconnecting traces determine the self-resonant frequency of the decoupling network. A frequency too low will May 25, 2004; 6251-606-1PD 17 CDC16xxF-E PRELIMINARY DATA SHEET reduce decoupling effectiveness, increase RF emissions and may affect device operation adversely. XTAL1 and XTAL2 traces from other signals by embedding them in a VSS trace. XTAL1 and XTAL2 quartz connections are especially sensitive to capacitive coupling from other PCB signals. It is strongly recommended to place quartz and oscillation capacitors as close to the pins as possible, and to shield the The RESETQ pin adjacent to XTAL2 should be supplied with a 47nF capacitor, to prevent fast RESETQ transients from being coupled into XTAL2, to prevent XTAL2 from coupling into RESETQ, and to guarantee a time constant of 200 s sufficient for proper Wake Reset functionality. 2.6. Pin Circuits VSUPOUT VSUPOUT VSUPIN VSUPIN Input Logic Input Logic GNDIN GNDIN GNDOUT GNDOUT Fig. 2-5: Input Pins Fig. 2-7: Push Pull I/O Pins VSUPOUT VSUPOUT VSUPIN GNDIN VSUPIN Input Logic weak Input Logic GNDIN GNDOUT GNDOUT Fig. 2-6: Input Pins with Pull-Down Fig. 2-8: Open Drain I/O Table 2-2: I/O Supply Catalog Pin Names Figure VSUPOUT GNDOUT VSUPIN GNDIN XTAL1, XTAL2 2-5 UVDD UVSS VDD VSS ESTOPCLK 2-6 H-Ports HVDD HVSS P-Ports AVDD UVSS EDB0 to EDB7, EADB0 to EADB23, ECEQ, EOEQ, EWEQ, EPH2, EVDA, EVPA, EBE EVDD EVSS UVDD UVSS TEST U-Ports RESETQ 18 2-7 2-8 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 3. Electrical Data 3.1. Absolute Maximum Ratings Stresses beyond those listed in the "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only. Functional operation of the device at these conditions is not implied. Exposure to absolute maximum ratings conditions for extended periods will affect device reliability. This device contains circuitry to protect the inputs and outputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than absolute maximum-rated voltages to this high-impedance circuit. Table 3-1: All voltages listed are referenced to ground (UVSS=HVSSn=EVSSn=AVSS=0V), except where noted. All ground pins except VSS must be connected to a low-resistive ground plane close to the IC. 1) Symbol Parameter Pin Name Min. Max. Unit VSUP Core Supply Voltage Port Supply Voltage Analog Supply Voltage SM Supply Voltage 1 SM Supply Voltage 2 Flash Port Supply Voltage 1 Flash Port Supply Voltage 2 VDD UVDD AVDD HVDD1 HVDD2 EVDD1 EVDD2 -0.3 6.0 V VDD Voltage Difference between VDD and AVDD resp. UVDD VDD, AVDD UVDD -0.5 0.5 V ISUP Core Supply Current Port Supply Current Flash Port Supply Current VDD, VSS UVDD, UVSS EVDD1, EVSS1 EVDD2, EVSS2 -40 40 mA IASUP Analog Supply Current AVDD, AVSS -20 20 mA IHSUP SM Supply Current @TCASE=105C, Duty Factor=0.71 1) HVDD1, HVSS1 HVDD2, HVSS2 -380 380 mA Vin Input Voltage U-Ports, XTAL,RESETQ, TEST UVSS-0.5 UVDD+0.7 V P0-Ports VREF UVSS-0.5 AVDD+0.7 V H-Ports HVSS-0.5 HVDD+0.7 V E-Ports EVSS-0.5 EVDD+0.7 V Iin Input Current all Inputs 0 2 mA Io Output Current U-Ports E-Ports -5 5 mA H-Ports -60 60 mA indefinite s toshsl Duration of Short Circuit in Port SLOW Mode to UVSS or UVDD Tj Junction Temperature under Bias -45 115 C Ts Storage Temperature -45 125 C Pmax Maximum Power Dissipation 0.8 W U-Ports except U3.2 in DP Mode This condition represents the worst case load with regard to the intended application Micronas May 25, 2004; 6251-606-1PD 19 CDC16xxF-E PRELIMINARY DATA SHEET 3.2. Recommended Operating Conditions Do not insert the device into a live socket. Instead, apply power by switching on the external power supply. Keep UVDD = AVDD during all power-up and power-down sequences. Failure to comply with the above recommendations will result in unpredictable behavior of the device and may result in device destruction. Functional operation of the device beyond those indicated in the "Recommended Operating Conditions" is not implied and may result in unpredictable behaviour, reduce reliability and lifetime of the device. Table 3-2: All voltages listed are referenced to ground (UVSS=HVSSn=EVSSn=AVSS=0V), except where noted. All ground pins except VSS must be connected to a low-resistive ground plane close to the IC. Symbol Parameter Pin Name Min. Typ. Max. Unit VDD Supply Voltage Port Supply Voltage Analog Supply Voltage Flash Port Supply Voltage 1 Flash Port Supply Voltage 2 VDD UVDD AVDD EVDD1 EVDD2 4.5 5 5.5 V HVDD SM Supply Voltage 1 SM Supply Voltage 2 HVDD1 HVDD2 4.75 5 5.25 V VDD Voltage Difference between VDD and AVDD resp. UVDD VDD, AVDD UVDD -0.2 0.2 V dAVDD AVDD Ripple, Peak-to-Peak AVDD 200 mV fXTAL XTAL Clock Frequency XTAL1 4 12 MHz XTAL Clock Frequency using ERM XTAL1 4 10 MHz Low Input Voltage U-Ports H-Ports P0-Ports TEST 0.51*VDD V E-Ports 0.8 V Vil Vih High Input Voltage U-Ports H-Ports P0-Ports TEST 0.86*VDD V E-Ports 2.2 V RVil Reset Active Input Voltage RESETQ 0.9 V WRVil Reset Active Input Voltage during Power Saving Modes and Wake Reset RESETQ 0.6 V RVim Reset Inactive and Alarm Active Input Voltage RESETQ 1.6 2.1 V RVih Reset Inactive and Alarm Inactive Input Voltage RESETQ 2.9 V WRVih Reset Inactive during Power Saving Modes RESETQ UVDD 0.4V V VREFi ADC Reference Input Voltage VREF 2.56 AVDD V P0Vi P0 ADC Input Port Input Voltage P0-Ports 0 VREFi V 20 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 3-2: All voltages listed are referenced to ground (UVSS=HVSSn=EVSSn=AVSS=0V), except where noted. All ground pins except VSS must be connected to a low-resistive ground plane close to the IC. Symbol Parameter Pin Name Min. Typ. Max. Unit 0.2*VDD V Clock Input from External Generator XVil Clock Input Low Voltage XTAL1 XVih Clock Input High Voltage XTAL1 0.8*VDD DXTAL Clock Input High-to-Low Ratio XTAL1 0.45 V 0.55 3.3. Characteristics Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Symbol Parameter Pin Na. Min. Typ. 1) Max. Unit Test Conditions Package Rthjc Thermal Resistance from Junction to Case 15 C/W Supply Currents CMOS levels on all Inputs, no Loads on Outputs difference between any two VDDs within 0.2 V IDDF VDD FAST Mode Supply Current VDD 15 25 mA IDDS VDD SLOW Mode Supply Current VDD 1.5 2.0 mA all Modules OFF 2), 6) all clocks disabled by hardware option settings 2.5 3.5 mA all Modules OFF 2), 6) all hardware options set to their RESET values IDDD VDD DEEP SLOW Mode Supply Current VDD 0.75 1.0 mA all Modules OFF 2), 6) all hardware options set to their RESET values IDDI VDD IDLE Mode Supply Current VDD 70 135 A fxtal = 4 MHz 6) 180 260 A fxtal = 10 MHz 6) 12 55 A internal RC oscill. 1 50 A 0.3 mA no Output Activity, LCD Module ON 0.2 0.4 mA ADC ON, ERM OFF 1 2 mA ERM ON, IDDW VDD WAKE Mode Supply Current VDD UIDDa UVDD Active Supply Current UVDD AIDDa AVDD Active Supply Current AVDD 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. Micronas May 25, 2004; 6251-606-1PD 21 CDC16xxF-E PRELIMINARY DATA SHEET Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Typ. 1) Max. Unit Test Conditions AVDD 1 10 A ADC and ERM OFF UIDDq UVDD 1 10 A no Output Activity, LCD Module OFF EIDDq EVDD1 EVDD2 1 10 A no Output Activity, LCD Module OFF HIDDq Sum of all HVDD1 HVDD2 1 20 A no Output Activity, SM Module OFF Symbol Parameter Pin Na. AIDDq Quiescent Supply Current Min. Inputs Vilh Low to High Input Threshold Voltage all Inp. except EPorts, XTAL 0.68* VDD 0.76* VDD 0.84* VDD V Vihl High to Low Input Threshold Voltage all Inp. except EPorts, XTAL 0.53* VDD 0.61* VDD 0.69* VDD V Vilh-Vihl Input Hysteresis all Inp. except EPorts, XTAL 0.1* VDD 0.15* VDD 0.2* VDD V 3) Ii Input Leakage Current U-Ports H-Ports P0-Port P06 VREF E-Ports -1 -10 -1 -0.2 -1 -1 1 10 1 0.2 1 1 A 0 < Vi < UVDD 0 < Vi < HVDD 0 < Vi < AVDD 0 < Vi < AVDD 0 < Vi < AVDD 0 < Vi < EVDD Ipd Input Pull-Down Current TEST E-Ports 25 25 80 80 170 170 A Vi = UVDD Vi = EVDD, when unused Ipu Input Pull-Up Current E-DB -170 -80 -25 A Vi = 0, when unused Port Low Output Voltage U-Ports 0.4 V Io = 2 mA E-Ports 0.4 V Io = 0.5 mA Io = 27 mA Io = 40 mA@TCASE = -40 C Io = 30mA@TCASE = 25 C Outputs Vol Vol Spread of Vol Values within one SM Driver Module H-Ports 0.125 0.5 V H-Ports -50 50 mV 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. 22 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Symbol Parameter Pin Na. Min. Voh Port High Output Voltage U-Ports Typ. 1) Max. Unit Test Conditions UVDD- 0.4 V Io= -2 mA E-Ports EVDD- 0.4 V Io= -0.5 mA H-Ports HVDD- 0.5 HVDD- 0.125 V Io = -27 mA Io = -40 mA@TCASE = -40 C Io = -30 mA @TCASE = 25 C Voh Spread of Voh Values within one SM Driver Module H-Ports -50 50 mV LVol LCD Port Zero Output Voltage U-Ports -0.05 0.05 V no load LVo1 LCD Port Low Output Voltage U-Ports 1/3 *UVDD -0.05 1/3 *UVDD +0.05 V no load LVo2 LCD Port High Output Voltage U-Ports 2/3 *UVDD -0.05 2/3 *UVDD +0.05 V no load LVoh LCD Port Full Output Voltage U-Ports UVDD -0.05 UVDD +0.05 V no load LIo1 Internal LCD-Low Supply Short Circuit Current U-Ports 0.3 mA Pin Short to 2/3*UVDD Internal LCD-High Supply Short Circuit Current U-Ports Ishf Port Fast Short Circuit Current U-Ports 6 10 18 mA Pin Short to UVDD or UVSS, Port FAST Mode Ishs Port Slow Short Circuit Current U-Ports 1.3 2.5 5 mA Pin Short to UVDD or UVSS, Port SLOW Mode Ishsd Port Slow Short Circuit Current, DP Mode U3.2 2.6 5 10 mA Pin Short to UVDD, Port SLOW and Double PullDown Modes 1.125 1.25 1.375 V 10 s LIo2 -0.3 0.3 Pin Short to UVSS mA -0.3 Pin short to UVDD Pin short to 1/3*UVDD Comparators VBG Internal Reference Voltage tBG Internal Voltage Reference Setup Time after Power-Up VREFR RESET Comparator Reference Voltage RESETQ 1*VBG 1*VBG V RVlh- RVhl RESET Comparator Hysteresis, symmetrical to VREFR RESETQ 0.25 0.375 V 3) 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. Micronas May 25, 2004; 6251-606-1PD 23 CDC16xxF-E PRELIMINARY DATA SHEET Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Symbol Parameter Pin Na. Min. WRVihl Reset Active high to low Voltage during Power Saving Modes and Wake Reset RESETQ VREFA ALARM Comparator Reference Voltage AVlh- AVhl Typ. 1) Max. Unit 0.6 1.1 V RESETQ 2*VBG 2*VBG V ALARM Comparator Hysteresis, symmetrical to VREFA RESETQ 0.1 0.15 V VREFPOR VDD Power On Reset Threshold VDD 2.88* VBG 2.88* VBG V VREFP06 P06 Comparator Reference Voltage P06 0.49* AVDD 0.51* AVDD V P06Vlh- P06Vhl P06 Comparator Hysteresis, symmetrical to VREFP06 P06 0.1 0.24 V VREFSM SM Comparator Reference Voltage H00, H04, H12, H20, H32 1/9* HVDD -0.07 1/9* HVDD +0.07 V tCDEL RESET, ALARM, P06, SM Comparator Delay Time RESETQ P06 H00 H04 H12 H20 H32 100 ns Test Conditions 3) 3) Overdrive = 50 mV ADC LSB LSB Value VREF /1024 V INL Integral Non-Linearity: difference between the output of an actual ADC and the line best fitting the output function (best-fit line) -3 3 -2.5 2.5 ZE Zero Error: difference between the output of an ideal and an actual ADC for zero input voltage -1 1 LSB VREF = 2.56 V and 5.12 V FSE Full-Scale Error: difference between the output of an ideal and an actual ADC for full-scale input voltage -1 1 LSB VREF = 2.56 V and 5.12 V TUE Total Unadjusted Error: maximum sum of integral non-linearity, zero error and full-scale error -4 4 LSB -3 3 VREF = 2.56 V VREF = 5.12 V LSB VREF = 2.56 V VREF = 5.12 V 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. 24 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Symbol Parameter QE Quantization Error: uncertainty because of ADC resolution AE Absolute Error: difference between the actual input voltage and the full-scale weighted equivalent of the binary output code, all error sources included R Conversion Range A Conversion Result Pin Na. P0-Ports Min. Typ. 1) Max. Unit Test Conditions -0.5 0.5 LSB VREF = 2.56 V and 5.12 V -4.5 4.5 LSB -3.5 3.5 VREF = 2.56 V VREF = 5.12 V AVSS VREF V 2.56 V < VREF < AVDD hex AVSS < Vin < VREF hex Vin < = AVSS hex Vin > = VREF INT (Vin/ LSB) 000 3FF tc Conversion Time 4 s ts Sample Time 2 s Ci Input Capacitance during Sampling Period 15 pF Ri Serial Input Resistance during Sampling Period 5 kOhm RC Oscillator fout Output Frequency 20 35 57 kHz 350 kHz 60 4) ns @Cl = 30 pF, port fast mode 60 4) ns @Cl = 30 pF, port fast mode 3/ fXTAL +60 4) ns @Cl = 30 pF, port fast mode @Cl = 30 pF, port fast mode Clock Supervision fSUP Clock Supervision Threshold Frequency XTAL1 70 SPI (Fig. 3-1, Fig. 3-2) tsoci Data out Setup Time with internal clock U3.0, U6.4 thoci Data out Hold Time with internal clock U3.0, U6.4 tsoce Data out Setup Time with external clock U3.0, U6.4 thoce Data out Hold Time with external clock U3.0, U6.4 2/ fXTAL -60 ns tsi Data in Setup Time with external clock U3.1, U6.5 1/ fXTAL+ 60 4) ns -60 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. Micronas May 25, 2004; 6251-606-1PD 25 CDC16xxF-E PRELIMINARY DATA SHEET Table 3-3: UVSS = HVSS1= HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V< VDD = AVDD = UVDD = EVDD1= EVDD2 < 5.5 V, 4.75 V < HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C, fXTAL= 10 MHz, external components according to Fig. 2-4(unless otherwise noted) Symbol Parameter Pin Na. Min. thi Data in Hold Time with external clock U3.1, U6.5 1/ fXTAL+ 60 4) Typ. 1) Max. Unit Test Conditions ns CAN (Fig. 3-3) tsrx rx-strobe Time CAN rx 0 10 4) ns reference is XTAL1 rising edge tdtx tx-drive Time CAN tx 15 60 4) ns reference is XTAL1 rising edge @Cl = 30 pF, port fast mode The input/output delay time equals to tdtxmax - tsrxmin DIGITbus (Fig. 3-4) tbtj Bit Time jitter DIGITOUT tfed Falling edge delay DIGITOUT 15 5) 10 4) ns rising edges, internal clock master tBIT/64 +60 4) ns reference is nominal falling edge 1) Typical values describe typical behavior at room temperature (25 C, unless otherwise noted), with typical Recommended Operating Conditions applied, and are not 100% tested. 2) Value may be exceeded with unusual Hardware Option setting 3) Design value only, the actually observable hysteresis may be lower due to system activity and related supply noise 4) When the ERM is active, this time value is increased by 0.121/fXTAL, e.g. 15.125 ns @8 MHz. 5) When the ERM is active, this time value is decreased by 0.121/fXTAL, e.g. 15.125 ns @8 MHz. 6) Measured with external clock. Add 100 A at 4 MHz, 115 A at 10 MHz for operation on typical quartz with SR3.XTAL =0 (Oscillator RUN mode). SPI-CLK-OUT tsoci thoci SPI-D-OUT SPI-D-IN Fig. 3-1: SPI: Send and Receive Data with Internal Clock. Timing is valid for inverted clock too (Data valid at positive edge). 26 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET SPI-CLK-IN thi tsi SPI-D-IN SPI-CLK-IN tsoce thoce SPI-D-OUT Fig. 3-2: SPI: Send and Receive Data with External Clock. Timing is valid for inverted clock too (Data valid at positive edge). tcyc XTAL1 tdtx TX tsrx RX Fig. 3-3: CAN I/O Timing. tBIT DIGIT-IN DIGIT-OUT tfed tbtj tbtj nominal pulse tNPL tNPL: Nominal programmed Pulse Length. Depends on programmed phase, Baudrate and transmitted sign (0, 1, T). Should be 1/4 for sign 0, 1/2 for sign 1 and 3/4 for sign T of tBIT. Fig. 3-4: DIGIT bus I/O Timing Micronas May 25, 2004; 6251-606-1PD 27 CDC16xxF-E PRELIMINARY DATA SHEET 3.4. Recommended Crystal Characteristics Table 3-4: UVSS = HVSS1 = HVSS2 = EVSS1 = EVSS2 = AVSS = 0 V, 4.5 V < VDD = AVDD = UVDD = EVDD1 = EVDD2 < 5.5 V, 4.75 V< HVDD1 = HVDD2 < 5.25 V, TCASE = 0 to +70 C Symbol Parameter Min. fP Parallel Resonance Frequency @ CL = 12 pF 4 R1 Series Resonance Res. for 50 ms Oscillation Start-Up time @CL = 12 pF @ fP = 4 MHz CEXT Typ. Max. Unit 12 MHz 380 320 Ohm START-UP RUN @ fP = 6 MHz 230 160 Ohm START-UP RUN @ fP = 8 MHz 150 95 Ohm START-UP RUN @ fP = 10 MHz 100 60 Ohm START-UP RUN 18 External Oscillation Capacitances for CL = 12 pF, connected to VSS Test Conditions pF 3.5. Flash/EMU Port Characteristics Table 3-5: EVDD = VDD = 4.5 V to 5.5 V, TCASE = 0 to 70 C Symbol Parameter tPHD tADS Min. Typ. Max. Unit Test Conditions internal PH2 delay 6 8 ns Address Setup Time 15 + 0.5 20 30 19 + 0.7 26 40 ns ns/pf ns ns CEADB = 0 pF CEADB = 10 pF CEADB = 10 pF CEADB = 30 pF tADH Address Hold Time 8 10 ns tDSR Data Setup Read Time 6 12 ns tDSW Data Setup Write Time 9 +0.5 14 24 14 + 0.7 21 35 ns ns/pf ns ns CEDB = 0 pF CEDB = 10 pF CEDB = 30 pF tDHR Data Hold Time Read 6 8 ns CEDB = 0 pF tDHW Data Hold Time Write 8 10 ns CEDB = 0 pF tWOS Write/Output Enable Setup 6 10 ns CEOQ,EWQ = 0 pF tWOH Write/Output Enable Hold 6 9 ns CEOQ,EWQ = 0 pF tBES Bus Enable Setup 14 24 ns CEBE = 0 pF tBEH Bus Enable Hold 7 10 ns CEBE = 0 pF tVS EVDA, EVPA Setup Time 21 30 ns CEVDA,EVPA = 0 pF 28 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET tcyc XTAL1 tPHD tSCLS tSCLH ESTOPCLK Ph2 EPh2 tEPHD tADS, tVS tADH EADB, EVDA, EVPA tACC tDHR tDSR READ DATA READ DATA tDHW tDSW WRITE DATA WRITE DATA tWOS tWOH EWE, EOE tBEH, tBES EBE, ECE Fig. 3-5: Emu Bus Timing FAST mode SLOW mode fOSC Ph2 RW CE WE OE Fig. 3-6: Memory Access Signals Micronas Emulator ports: CE (=ECEQ) may be used for low power mode. Input data are latched with the rising edge of CE. Test ports: Be careful with CE working in low power mode. May 25, 2004; 6251-606-1PD 29 CDC16xxF-E PRELIMINARY DATA SHEET There are no input data latches at the test ports. Always pull CE down. XTAL1 STOPCLK fOSC Ph2 Fig. 3-7: Stop Clock (only if TEST Pin = 1) STOPCLK is used for emulation and test mode. It is active with TEST input pulled to VDD only. With the stopped fOSC all peripheral modules, such as timers and UARTs, are frozen. But with the runni ng Ph2 clock the CPU is able to read and write the internal registers and memory. The pin ESTOPCLK has an internal pulldown. The pin STOPCLK (H1.5, Test mode) has no internal pulldown, so in test mode an external pulldown is needed. XTAL1 EPh2 RW EADB internal signal external external internal internal Control word Bit 5 = 1 (ext. mem. mode) EDB EOE EWE Control word Bit 5 = 0 (emu mode) EDB EOE EWE Fig. 3-8: Internal/External Memory Access 30 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 4. CPU and Clock System The core basically consists of the CPU, RAM and ROM. A Memory Banking module is included to allow access to more than 64 k memory with an address bus limited to 16 bits. ROM is subdivided in Boot ROM and Flash EEPROM. In normal operation, after RESET, the CPU starts executing boot loader SW code from the Boot ROM and then jumps into the Flash EEPROM. Please find detailed information in section Boot System. In mask-ROM-derivative ICs, the code execution starts in factory-defined mask ROM. 4.1. W65C816 The CPU is fully compatible to WDC's W65C816 microprocessor. This is a processor with 16-bit registers/accumulator, an 8-bit data bus and a 24-bit address bus. A software switch determines whether the processor is in the 8-bit emulation mode, supporting SW compatibility to its 8-bit predecessors, or in the 16-bit native mode. For further information on the CPU core, please refer to the WDC W65C816 Data Sheet. Table 4-1: Major Differences between Processors and Modes Table 4-1: Major Differences between Processors and Modes Item 65C816 Emulation 65C816 Native 65C02 block moves of little use yes none break flag yes no yes break vector FFFE.FFFF FFE6.FFE7 FFFE.FFFF Item 65C816 Emulation 65C816 Native 65C02 direct page indexed wraps crosses page wraps ABS, X ASL, LSR, ROL, ROR with no page crossing 7 cycles 7 cycles 6 cycles flags after interrupt D=0 D=0 D=0 flags after reset D=x D=0 D=0 jump indirect, operand = XXFF 5 cycles index registers 8 bits 8 or 16 bits 8 bits instructions 256 256 178 branch across Page 4 cycles interrupts FFF4.FFFF FFE4.FFEF FFFA.FFFF mnemonics 92 92 64 decimal mode no additional cycle no additional cycle add 1 cycle special page direct page direct page zero page RWQ signal during readmodify-write instructions RWQ=0 during modify and write cycles RWQ=0 only during write cycle RWQ=0 only during write cycle stack page 1 bank 0 page 1 unused opcodes none none NOP abort signal yes yes no accumulator 8/8 bits 16 or 8/8 bits 8 bits addressing modes 25 25 16 address space 16 M 16 M 64 K bank registers yes yes none Micronas 5 cycles 3 cycles 6 cycles 4 cycles May 25, 2004; 6251-606-1PD 31 CDC16xxF-E PRELIMINARY DATA SHEET 4.1.1. Processor Modes 4.1.2. Emulation of 65C02 The 65C816 CPU allows operation in two modes: When using the Emulation mode to design software for a derivative containing only the 65C02 8-bit CPU, care has to be taken to use only the features available with that CPU. Table 4-1 gives a comparing overview. Refer to the WDC W65C816 Data Sheet for more information. - Native mode: 16-bit mode - Emulation mode: 8-bit mode for emulation of 65C02 properties Table 4-1 gives some details on the differences between modes. Refer to the WDC W65C816 Data Sheet for more information and on how to switch between modes. After reset, Emulation mode is active. However, Native mode is recommended for normal use. To make maximum usage of the CPU's 16-bit properties, switch to Native mode after reset. 4.2. Operating Modes To adapt to the large variety of CPU speed and current consumption requirements, the device offers a number of operating modes: - CPU-active modes, where the CPU is clocked at selectable speeds. - Power-saving modes, where the CPU is kept reset and only certain portions of the circuit are powered. Fig. 4-1 shows how the various modes are accessed in an operating modes state diagram. Power up Global Reset with Ports < 50 ms (if 4 ... 12MHz XTAL was off) Global Reset w/o Ports < 50 ms (if 4 ... 12MHz XTAL was off) ~ 0,5 ms @ 8 MHz XTAL (if XTAL stays on) ~ 0,5 ms @ 8 MHz XTAL (if XTAL stays on) RTC, Wake Ports WAKE/IDLE WAKE/IDLE RESETQ All reset sources DEEP SLOW FAST SLOW DEEP SLOW SLOW FAST All reset sources SLOW Fig. 4-1: Operating Modes State Diagram 4.2.1. CPU-Active Modes The CPU can be operated in three different CPU-active modes (Table 4-2). Core modules that are also affected by CPU-active modes are: 1. Interrupt Controller with all internal and external interrupts 3. Watchdog Table 4-2 shows the operability of the peripheral modules in the various CPU-active modes. 2. RAM, ROM/Flash and DMA 32 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 4.2.1.1. FAST Mode After reset the CPU is in FAST mode. The CPU clock and the I/O clock both equal the oscillator frequency fXTAL. 4.2.1.2. SLOW Mode fXTAL/256 will take effect after a maximum delay of 256 fXTAL periods. Returning CPU to FAST mode is done by setting flag CPUFST to HIGH. The CPU clock frequency will immediately change to its normal fXTAL value. To considerably reduce power consumption, the user can reduce the internal CPU clock frequency to 1/256 of the normal fXTAL value. In this CPU SLOW mode, program execution is reduced to 1/256 of the normal speed, but clocking of most other modules remains unaffected. The modules that are affected by CPU SLOW mode are: 4.2.1.3. DEEP SLOW Mode 1. CPU and Interrupt Controller with all internal and external interrupts Only peripheral module clocks f5 and slower are available from the divider chain. T0 can be operated only with this limitation. 2. RAM, ROM and DMA 3. Watchdog Some modules must not be operated during CPU SLOW mode (e.g. CAN). Refer to module sections for details (see Table 4-2 on page 34). CPU SLOW mode is enabled by clearing flag CPUFST in standby register SR1. The CPU clock frequency reduction to To further reduce power consumption beyond SLOW mode, DEEP SLOW mode also disables most of the internal peripheral clocking system. Table 4-2 shows which peripheral modules can be operated in DEEP SLOW mode. To prevent undefined behavior don't switch between DEEP SLOW and FAST mode directly but select SLOW mode in between. Changing to or from DEEP SLOW mode is done by writing SR3.FCLO (see Section 6.3. "Standby Registers" on page 54 for details). 4.2.2. Power-Saving Modes Power-saving modes are activated by the CPU. The complete core logic will immediately terminate operation and power will be reduced. The result is a device current consumption that is greatly reduced, to the amount of leakage currents. The internal SRAM and CAN-RAM keep their programmed data and all U, P, and H-Port registers keep their programmed state. However, a means to leave these modes has to be provided. As the CPU is no longer active, either an external or internal wake signal has to be generated. The external wake necessitates no device current, but to generate an internal wake requires an internal oscillator and a Real Time Clock (RTC) to run, which will cost a small amount of supply current. Please note that inadvertently entering a power-saving mode, e.g. by an external electrical overstress (EOS) condition, when no wake source has been configured previously as recovery path from this state, renders the device locked in this power saving mode. Only a RESETQ pin reset or a complete power removal and reapplication recovers the device from this state. Sufficient external shielding measures must avoid this hazard. 4.2.2.1. WAKE Mode The WAKE mode is the most current-saving operation mode. All device circuits are stopped or powered down except the Port Wake Module (Table 4-3). The Port Wake Module allows the CPU to configure up to ten fixed device ports (see the device pinout for details) as Wake Ports (WP). To prepare for WAKE mode, the CPU has to switch off the RTC and to configure the desired Wake Port(s) (see chapter "Power Saving Module", sections "Port Wake Module" and "RTC Module"). To enter WAKE mode, the CPU sets SR3.WAID. The device will immediately enter WAKE mode by resetting all circuitry, stopping all clocks, and powering down all analog circuitry. As long as all Port inputs - except analog inputs Micronas via P-ports P0.1 to P0.9 - are kept at CMOS input levels (Vil = xVSS 0.3 V and Vih = xVDD 0.3 V), the supply currents will be minimal. The device may be kept in this state indefinitely. To exit WAKE mode, the previously configured Wake Port has to switch. Immediately a Wake Reset sequence will be started internally, which pulls the RESETQ pin low and releases it as soon as all internal reset sources have become inactive. See chapter "Core Logic" for details on internal reset sources. After reset, the CPU starts in FAST mode as usual. 4.2.2.2. IDLE Mode IDLE mode allows to configure an internal wake source that wakes after a preselected period. As clock sources, either a current-saving, but imprecise internal RC oscillator, or the precise, but more current-consuming XTAL oscillator, are selectable. These circuits and the RTC are kept alive (Table 4-3) as well as the Port Wake Module. The RTC allows the CPU to select from one-second to oneday clocks as wake signal (see Section 8.4. "Operation of RTC Module" on page 68 for details). Apart from serving as wake source, the CPU may use the RTC as a real-time clock that is not halted by resets. A Polling Module, driven by a selectable RTC clock, may be configured to generate a polling pulse on H2.5 and sample the Wake Ports immediately after. Thus a periodical polling of Wake Ports may be achieved, with no continuous power consumption in external circuitry. To prepare for IDLE mode, the CPU has to configure the desired RTC wake clock (see Section 8.4. "Operation of RTC Module" on page 68 for details), beside the desired Wake Port(s) (see Section 8.6. "Operation of Port Wake Module" on page 70 for details). To enter IDLE mode, the CPU sets SR3.WAID. The device will immediately enter IDLE mode by resetting all circuitry, stopping the unused clocks, and powering down all May 25, 2004; 6251-606-1PD 33 CDC16xxF-E PRELIMINARY DATA SHEET Table 4-2: CPU-Active Modes and their effect on peripheral modules Module FAST SLOW DEEP SLOW Digital Watchdog IR Interrupt Controller Unit Port Interrupts Port Wake Module Memory Patch Module A/D Converter ALARM, P06 and Comparators 3) LCD Module 2) DMA UART SPI CAN 3) DIGITbus 3) 2) 3) Ports Stepper Motor Module PWM Audio Module Clock Outputs 2) Capture Compare Module 1) 2) 3) Timers 2) RTC/Polling Module Core Analog Communication Input & Output Timers & Counters 1) 2 ) 3 Avoid write access to CCxI Only clocks f5 and slower are available from Clock Divider ) Don't access registers or CAN RAM analog circuitry. As long as all Port inputs - analog inputs via P-ports P0.1 to P0.9 excepted - are kept at CMOS input levels (Vil = xVSS 0.3 V and Vih = xVDD 0.3 V), the supply currents will only amount to leakage and the requirement of the enabled oscillator(s) and the slow-clocked RTC and Polling Modules. releases it as soon as all internal reset sources have become inactive. See chapter "Core Logic" for details on internal reset sources. After reset, the CPU starts in FAST mode, as usual. To exit IDLE mode, the previously configured Wake source has to switch. Immediately a Wake Reset sequence will be started internally, that pulls the RESETQ pin low and 34 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 4-3: Power Saving Modes and related functionality vs. CPU-Active Modes Operating Mode Power Saving Modes Modules which can be activated: SRAM, CAN-RAM Port Registers Available Wake Sources WAKE - Port Wake Module data retained state retained Wake Ports IDLE all WAKE Mode modules plus: - 4 ... 12 MHz XTAL and/or 20..50 k RC Oscillator - Real-Time Clock - Polling Module CPU-Active Modes Wake Ports and RTC in principle all, for limitations see Table 4-2 active active Wake sources usable as interrupt 4.3. Clock System This IC contains a quartz oscillator circuit that only requires external connection of a quartz and of 2 oscillation capacitors. The XTAL Oscillator generates a 4 to 12 MHz reference signal from an external quartz resonator, cf. section "Electrical characteristics" for quartz data. fXTAL = 4 ... 12MHz XTAL Oscillator A reset sets the module to START-UP mode, where, at the expense of a higher current consumption, marginal quartzes receive more drive to ease start-up of oscillation. SR1.CPUFST '1' After start-up of the CPU program, register SR3.XTAL may be cleared by SW to set the XTAL Oscillator to RUN mode, where current consumption is at its standard level. PH2 1/256 Switching between START-UP and RUN modes must not be done @ FQUARZ >= 10 MHz or with the ERM active, as this might lead to unpredictable behavior of the clock system. '0' SR3.FCLO = '1' VDD This module is permanently active except during power saving mode, where continued operation may be selected in register OSC.XM. f0 Divider Chain f1 SR1.CPUFST SR3.FCLO SR3.WAID Table 4-4: Operating Mode Selection and Effect on Clocks 0 0 0 SLOW fXTAL/256 fXTAL 1 0 0 FAST fXTAL fXTAL 0 1 0 DEEP SLOW fXTAL/256 f0 to f4 = VDD 1 0 1 WAKE/ IDLE VDD VDD Micronas Operating Mode PH2 f0 f2 f3 f4 Peripheral Modules . . . fn Fig. 4-2: Clock System The oscillator clock drives a system clock divider that supplies the various modules with its specific clock. Module clock selection is software-defined in some cases, hardware or HW option-defined in other cases. The module descriptions give details. May 25, 2004; 6251-606-1PD 35 CDC16xxF-E PRELIMINARY DATA SHEET Section "HW Options" gives details about HW option controlled clocks, their selection and their activation. Note that specifying 1/1.5 and 1/2.5 prescaled clocks results in clock signals with 33%, respectively 20% duty factor. Table 4-5: HW Options and Ports Signal Two Clock Output signals CO0 and CO1 provide external visibility of internal clocks. HW Options F1Mux0 F1Mux1 F1Mux2 F1Mux3 HW Option Clock Out1 FFAC [4:0] 2 Address Item Setting CO0 Prescaler FFABh CO0 output U5.5 special out FMux0 FFABh FMux1 FFB2h 4:1 Mux FMux2 FFB3h FMux3 FFB6h CO1 Prescaler FFACh CO1 output CO1 U3.1 or U5.0 special out Clock Out FFACh CO1 Interrupt Source SMX Out - HW Option FFAB [6:5] 2 1/1 1/1.5 1/2.5 HW Option CO0 CO0 Interrupt Source 2:1 Mux 1/1 1/1.5 1/2.5 SMXout 2 CO1SEL.CO10 Initialization Item CO0 CO0SEL.CO00, CO0SEL.CO01 HW Options HW Option Clock Out1 FFAC [6:5] CO1 CO0SEL Fig. 4-3: Clock Outputs Diagram w Signal CO0 is the output of a prescaler and a 4 to 1 multiplexer. Prescaler and input for the multiplexer are selectable by HW options (see Table 4-5). The output selection of the multiplexer is done by register CO0SEL, bits CO01 and CO00. The outputs of the prescalers are fed not only to the ports, but may also serve as interrupt source. The U-Ports assigned to function as clock outputs (see Table 4-5) have to be configured Special Out. Clock Out 0 Selection 7 6 5 4 3 2 1 0 x x x x x x CO01 CO00 x x x x x x 0 0 CO00, CO01 Clock Out Bit 0 and 1 w: Clock selection Table 4-6: Clock Out 0 Selection The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. CO01 CO00 0 0 F1Mux0 0 1 F1Mux1 CO0 and CO1 are not affected by CPU SLOW mode. 1 0 F1Mux2 1 1 F1Mux3 CO1SEL w Clock Out 1 Selection 7 6 5 4 3 2 1 0 x x x x x x x CO10 x x x x x x x 0 CO10 w0: w 1: 36 Res May 25, 2004; 6251-606-1PD Res WAKE/IDLE Clock Out SMX Out Micronas CDC16xxF-E PRELIMINARY DATA SHEET 4.4. EMI Reduction Module (ERM) The EMI Reduction Module distributes the electromagnetic energy radiated from VLSI embedded controllers among many spectral lines in the frequency spectrum. Due to its inherent frequency stability the module is fully applicable to ICs containing clocks, timers and synchronous communication links to other systems, e.g., CAN interfaces. The module performs modulation of the quartz clock phase by selecting delay taps in a delay-locked loop in a pseudo random manner, to arrive at the system clock. The individual system clock edges thus appear delayed by pseudo randomly selected time values ranging from 0% to 10% of the quartz signal cycle length. Features - Reduction of Clock Related Electromagnetic Interference - DLL-Based Modulation of Clock Phase - Full Quartz Frequency Stability - Maximum Clock Edge Dislocation +10% of Cycle Differening from PLL-based EMI reduction devices, the maximum dislocation of a system clock edge from its quartz reference is only +10% of the quartz signal cycle length. Delay Locked Loop 1 2 3 13 14 15 16 71 t t t t t t t t delay SR.ERM enable Control clk Random Number Generator 1 3 2 3 4 5 6 7 8 8:1 MUX modulated 1 clock system clock XTAL1 0 ERMC.CLKSEL Fig. 4-4: Block Diagram reduce the influence of supply noise the DLL is operated on AVDD. 4.4.1. Principle of Operation The RNG generates a sequence of pseudo-random values. Three bits serve to select one output from the first eight delay elements. The selected output represents the modulated clock. The selection of the three bits achieves a "high randomness" even for short time intervals. In the worst case the same output is selected three times in succession. 4.4.2. General Remarks The edges of the input clock are discretely delayed by 1/71 to 15/71 (21.1%) of the low time of a clock cycle (see Fig. 4- 5). The selection of the clock edge is done by means of a pseudo-random sequence. 4.4.3. Initialization The integral parts of the ERM are the Delay Locked Loop (DLL) and the Random Number Generator (RNG). After Reset the EMI Reduction Module is in standby mode (inactive). In standby mode, all internal registers are reset. The DLL consists of a chain of 71 controllable delay elements. Within a locked loop, the total delay time of the chain is controlled to equal the low time of the input clock. To Setting the standby bit SR1.ERM activates the ERM. Micronas May 25, 2004; 6251-606-1PD 37 CDC16xxF-E PRELIMINARY DATA SHEET Before entering operation, a setup time of at least 100 s has to elapse. - The output timepoint of clocked output signals is modulated as well. - The sampling time of an ADC is modulated slightly. 4.4.4. Operation Setting register ERMC to 01h immediately selects the phase modulated clock as system clock. Flag ERMC.CLKSEL is readable and indicates the busy state. 4.4.5. Inactivation To deactivate the ERM first deselect the modulated clock by resetting register ERMC to 00h. Then SR1.ERM may be reset to return the whole module to standby mode. 4.4.6. Precautions For all modules using the modulated system clock or derived clocks, the following facts have to be kept in mind: - The maximum operating frequency is reduced. - The sampling time point of clocked inputs is modulated. For this reason, e.g., a CAN or UART module may appear less failure-tolerant. 4.4.7. Results of Application According to product spectrum measurements of supply current and electromagnetic radiation, the EMI Reduction Module is capable of reducing the energy in spectral lines of the frequency spectrum which occur on multiples of the oscillator frequency. The ERM distributes the spectral energy contained in oscillator harmonics over the spectrum between them. Thus the noise level is increased by a slight 1 to 2 dB. The higher the share of system events that are in synchronism with the oscillator (current peaks due to clocking in digital circuits), the more distinct the reduction in the spectrum. The reduction takes effect from the 6th oscillator harmonic up, and reaches values from 6 to12 dB over a wide range of frequencies. OSCCLK OSCCLKM 1/71 15/71 (21,1 %) 1/71 100 % 15/71 (21,1 %) 100 % Fig. 4-5: Timing of modulated clock 4.4.8. Registers ERMC EMI Reduction Module Control Register 7 6 5 4 3 2 1 0 r x x x x x x x CLKSEL w x x 0 0 0 0 0 CLKSEL x x 0 0 1 0 0 0 Res CLKSELClock Select r/w0:System clock is unmodulated r/w1:System clock is modulated Other bits in this register are used for test purposes. They must all be written to zero for proper operation. 38 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 5. Memory and Boot System 5.1. RAM and ROM On-chip RAM is composed of static RAM cells. It is protected against disturbances during reset as long as the specified operating voltages are available. The boot ROM contains up to 2 KB of firmware boot code. The functionality is described in section Boot System. The 100PQFP Multi Chip Module also contains a 256 KB Flash EEPROM of the AMD Am29F200AB type (bottom boot configuration) or Am29F200AT type (top boot configuration). These devices exhibit electrical byte program and sector erase functions. Erase sectors are of various sizes (Fig. 5- 1). Refer to the AMD data sheet for details. Future mask ROM derivatives will contain no Boot ROM and may be specified to contain less internal RAM and ROM than this IC. RAM will always grow upwards from physical address 000000h. ROM will grow down from 00FFFFh to 002000h and then upwards from 010000h. 5.1.1. Address Map Table 5-1: Reserved (physical) Addresses Addresses Mode *) Usage 00FFA0 - C3 Emu & Native HW Options 00FFC4 - E3 Emu & Native Interrupt Controller Vectors 00FFE4 - E5 Native only (reserved) COP 00FFE6 - E7 Native only BRK 00FFE8 - E9 Native only ABORT 00FFEA - EB Native only NMI (expanded by Interrupt Controller) 00FFEC - ED Emu & Native reserved 00FFEE - EF Native only IRQ 00FFF0 - F1 Emu & Native Manufacturer ROM Identification 00FFF2 Emu & Native reserved 00FFF3 Emu & Native Control word 00FFF4 - F5 Emu only (reserved) COP 00FFF6 - F7 Emu & Native reserved 00FFF8 - F9 Emu only ABORT 00FFFA - FB Emu only NMI (expanded by Interrupt Controller) 00FFFC - FD Emu & Native RESET 00FFFE - FF Emu only IRQ/BRK *) depends on setting of processor status flag E: Emulation mode: E=1 Native mode: E=0 Micronas May 25, 2004; 6251-606-1PD 39 CDC16xxF-E phys.addr. EMU CPGA177 PRELIMINARY DATA SHEET MCM PQFP100 MCM PQFP100 Bottom Boot Config. Top Boot Config. 6KB RAM 6KB RAM 6KB RAM Reserved Reserved Reserved 001900 CAN2-RAM CAN2-RAM CAN2-RAM 001A00 CAN1-RAM CAN1-RAM CAN1-RAM 001B00 CAN0-RAM CAN0-RAM CAN0-RAM 001C00 CAN-Regs CAN-Regs CAN-Regs 001D00 Ext. I/O Ext. I/O Ext. I/O Alternative 000000 Native log.addr. log.addr. 0000 000000 001800 001E00 I/O-Reg1 I/O-Reg1 I/O-Reg1 001F00 I/O-Reg0 I/O-Reg0 I/O-Reg0 002000 Sector 0, upper 8 KB Sector 0, upper 56 KB 004000 Sector 1, 8 KB 006000 Sector 2, 8 KB 008000 Sector 3, 32 KB F800 Boot ROM 010000 reserved Bank 0 Bank 0 7FFF 8000 Boot ROM Boot ROM Sector 4, 64k Sector 1, 64k 256KB Flash EEPROM 256KB Flash EEPROM FFA0 Reserved Addr. Bank 1 FFFF 8000 00FFFF 010000 Bank 2 018000 FFFF 8000 Bank 1 Bank 3 020000 Sector 5, 64 KB FFFF 8000 Sector 2, 64 KB 01FFFF 020000 Bank 4 028000 FFFF 8000 030000 FFFF 8000 Bank 2 Bank 5 Sector 6, 64 KB Sector 3, 32 KB 02FFFF 030000 Bank 6 038000 FFFF 8000 Sector 4, 8 KB Sector 5, 8 KB Sector 6, 16 KB 040000 Sector 0, lower 8 KB Bank 3 Bank 7 Flash Boot Loader Sector 0, lower 8 KB FFFF 8000 Bank 8 9FFF 03FFFF 040000 Bank 4 041FFF 042000 mirrored Flash EEPROM mirrored Flash EEPROM FFFFFF Fig. 5-1: Address Map 40 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 5.2. Memory Banking The 24-bit address bus of the 65C816 CPU allows access to 16 MB of memory space. The upper 8 bits of the addresses are delivered as bank address, which is multiplexed with the data value on the internal data/address lines of the CPU. This kind of native banking is supported by the 65C816 internal bank registers (PBR, DBR) by using the processor's native 16-bit instruction set. Alternative Banking Register *D0 ... D7 modified 65C816 The CPU may be used to emulate the behavior of the 8-bit processor W65C02. This CPU only allows access to 64 KB of memory space. To allow access to the expanded memory range above 64 KB, an alternative banking logic is implemented. Alternative Banking Mode = ABM ABA0 ... ABA7 MSB = '0' on A15 ... A23 Native Bank Latch *DBA0 ... DBA7 off NBA0 ... NBA7 LSB = *AD15 Interrupt Controller, DMA Logic A15 ... A23 Address Decoder, Memory, I/O *AD15 A0 ... A14 AD0 ... AD14 A0 ... A14 *Processor internal Bus Fig. 5-2: Block diagram Memory Banking The banking mode is toggled with flag ABM of the SR2 register: By setting ABM to "1" the native banking mode is switched off, and the alternative banking mode is activated instead. ABM = '0': Native Banking mode (default after RESET), 5.2.2. Alternative Banking Mode ABM = '1': Alternative Banking mode. The alternative bank no. is programmed in the Alternative Banking Register = ABR. 5.2.1. Native Banking Mode The bank address is present on the 65C816 data/address lines during the first half of each processor bus cycle. To get the whole address bus available during the second half of the bus cycles, the bank address is demultiplexed with a transparent latch, triggered with the processor clock, PHI2(in). This mode is supported by the native instruction set since it supports the CPU's internal bank registers PBR and DBR, which values are multiplexed on the data/address lines, no matter if the processor is running in native or emulation mode. If the internal bank registers are not supplied, e.g., if only the 8-bit instruction set is applied, the address range is limited to 64 KB, the size of one Native Bank, because the banking registers keep their initial 0-values which they get during RESET. After RESET the native banking mode is active and the whole 65C816 address range of 24 bits is available. Micronas To use the CPU with the 8-bit instruction set of the 65(C)02 and reaching more than the addressable 64 KB, a specific banking hardware is implemented: The physical address range above 32 KB is separated into several banks of which only one at a time is enabled and selected by the 8-bit ABR (Alternative Banking Register), which is programmable like any other standard 8-bit peripheral register by writing the desired value into its specific address. The contents of the ABR are also readable, so the software may check the current bank at any time. The applied software is responsible for programming the ABR with the correct bank number at the right time. Since the upper 32 KB range is switched immediately after programming the ABR, correct function is not guaranteed if its changed by a program sequence running in a switched bank. ABR settings need to be done in the lower 32 KB, which is the non-switchable master bank, resp., alternative bank number 0. With ABR = 0, the lower 32 KB appear as bank 0 in the upper address range, so bank 0 is identical to the non-switchable master bank. Be careful when operating bank 0 in the upper 32 KB area. RAM, I/O pages and reserved addresses may be manipulated unintentionally. RESET initializes ABR = 1, so as to have control byte and reset vector in the same physical addresses as with active native banking mode. Also Interrupt vectors have to reside in May 25, 2004; 6251-606-1PD 41 CDC16xxF-E PRELIMINARY DATA SHEET the alternative bank number 1, because the interrupt controller generates the appropriate address of bank 1, but does not change the contents of the ABR. Interrupt functions have to reside in the non-switchable master bank (alternative bank 0). Otherwise they need to be in each used bank, as after getting the vector, the unchanged contents of the ABR determine the current bank which is valid if A15 is "1". After RESET the alternative banking mode is inactive. By setting ABM to "1", the alternative banking mode is switched on. ABR 7 Alternative Banking Register 6 5 r/w 4 3 2 1 0 0 0 1 Alternative Bank Address 0 0 0 0 0 Res 5.2.3. Memory Banking Mode Selection In the Native Banking Mode the logical address range is identical to the physical one. In the Alternative Banking Mode A15 is lost, because a non-switched address range is necessary. This cuts the addressable space in half. To retain the physical address range without holes as is in Native Banking Mode, the addresses are multiplexed. ABM '0' NBA7 A23 ABA7 NBA6 A22 ABA6 NBA5 A21 ABA5 NBA4 A20 ABA4 NBA3 A19 ABA3 NBA2 A18 ABA2 NBA1 A17 ABA1 NBA0 A16 ABA0 AD15 A15 Fig. 5-3: Physical Address change depending on the Banking Mode 42 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Banking Cross Reference FF0000H ....... 7F0000H ....... ...... FFFFH FFFFH ....... Alternative Bank 3 Alternative Bank 2 Alternative Bank 255 ( also Alternative Bank 0 * ) ....... Native Bank 255 Native Bank 2 Native Bank 1 8000H Alternative Bank 1 ........ Alternative Bank 5 0H Native Bank 0 ........ Alternative Bank 4 * Alternative Bank 2 * Alternative Bank 3 Alternative Bank 1 8000H 0H ( not reachable as Alternative Bank ) Native Bank 1 Native Bank 0 Alternative Bank 254 * Native Bank 2 Alternative Bank 0 * 0H ...... Native Bank 127 ( not reachable as Alternative Bank ) 10000H Alternative Banking Native Bank 255 Alternative Bank 255 20000H Native Banking FFFFH * The logical address range is 8000H ... FFFFH Native Banks: logical addresses = physical addresses Alternative Banks: logical address range = 8000H ... FFFFH Fig. 5-4: Banking Map shown with the max. size of addressable memory (different from the implemented amount) Micronas May 25, 2004; 6251-606-1PD 43 CDC16xxF-E PRELIMINARY DATA SHEET 5.3. Boot System The Boot System offers a very flexible method for the controller to receive and store data and programs, no matter if the Flash memory contains a working or faulty application, or no application at all. With the Boot System it is possible to fill the RAM with data and functions and to start execution from any address. Tasks like flash programming and diagnostic routines may be downloaded and started, either in lab, factory or in system. After RESET, the CPU executes code from the Boot ROM. Its firmware, the Boot Loader, checks whether the application software in the flash memory must be started or if data must be downloaded via one of 6 receivers: 3 UARTs and 3 CANs. RAM RESET Start Boot ROM Boot Loader Termination no data to receive ? yes Download 5.3.1. Principle of operation Flash ROM After RESET the Boot ROM is active, if the Test pin is left vacant or connected to ground. The Boot Loader is started and checks whether there is a wake-up from Power Saving Mode (see Table 6-7 on page 53), i. e., if CSW2.WKID is set. If so, it starts the application software in Flash Memory (or ROM). Otherwise, it tries to detect a download condition. If no appropriate data can be received via either of its 6 interface receivers within a predefined time, the Boot Loader terminates itself by copying a program sequence into the RAM and executing it. This software part switches the Boot ROM off and starts the application software assumed within the Flash Memory. The detour via RAM is necessary because the Boot ROM hides the start-up address area of the flash memory that contains the processor Control Word and RESET Vector of the application. When detecting a download condition, the time-out condition to terminate the boot sequence is extended with the detection of every new appropriate data until the download is completed. The Boot Loader jumps to a start address, which is assumed part of the code-header downloaded before. Neither the Boot ROM is switched off, nor the Control Word or RESET Vector of the flash memory are treated automatically if a download occurs. This leaves a maximum of flexibility during and after the boot procedure. start at downloaded address Start Application Fig. 5-5: Principle of the boot system CR.IROM CR.FLASH & & Application enable 5.3.2. The Boot ROM RESET Vector Control Word Interrupt Vectors The 2 kB Boot ROM covers the address range from 0F800H to 0FFFFH. With Test pin left vacant or pulled to low level at RESET, the Control Word is read out of the Boot ROM and copied into the Control Register. With the flag FLASH of the Control Register set to '0' the Boot ROM stays switched on and its control program, the Boot Loader, is started. In a standard application (no download request) the control program in the flash memory is started after the Boot Loader has set the flag FLASH in the Control Register to '1' to switch the Boot ROM off at the appropriate time, which enables the Flash ROM in the same address range as the Boot ROM before. Boot ROM enable RESET Vector Control Word Interrupt Vectors Flash ROM Start application or downloaded code RAM affected by SW affected by HW Fig. 5-6: Boot ROM Selection 44 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 5.3.3. The Boot Loader RESET yes CSW2.WKID = '1' init. Watchdog no init. UART and CAN receivers refresh Watchdog refresh Watchdog init time-out = 6ms @ fXTAL = 8 MHz Download Header Data Length yes no no Boot Identifier yes Boot Identifier no no time-out yes no download data yes no time-out yes yes no time-out yes reset UART and CAN interfaces Application force RESET Start downloaded code Fig. 5-7: Boot Loader flow-chart During the first 480000 clock cycles (= 6 ms at 8 MHz processor clock) after reset, the Boot Loader tries to detect a start of the download condition, the so-called Boot Identifier, at one of the receivers of the 3 UARTs and 3 CANs. If the complete Boot Identifier has been received within the appropriate time, the watchdog is initialized (with the value 6 for effective 6.144 ms at fXTAL = 8 MHz) to supervise further time-out conditions. This is not only to increase security, but also because the Boot Loader could have been started by a reset other than power-on, from a running application in which the watchdog was programmed before. Therefore the Boot Loader has to program it, too, otherwise it generates a reset after the max. WD time-off, which is default after reset. Within further time-out conditions additional Boot Identifiers may occur, followed by the Download Header and the Download Data including separate Check Sums. At the end of the procedure the processor executes a jump to the start address which is part of the Download Header. If a time-out condition is met, an unexpected byte has been received or if a Check Sum error occurs, a reset is forced by the watchdog to start the Boot Loader again. This subsequently will start the application because of absence of the Boot Identifier. Micronas If the Boot Loader does not detect the Boot Identifier within the time limit, the application software assumed in the Flash ROM is started. For this purpose a software part is copied into RAM and started. It toggles the flag FLASH of the Processor Control Register to switch the BOOT ROM off and reads the Control Word out of the Flash ROM, which is accessible now, and programs the processor's Control Register with that value. Last, it starts the application by a jump to the address defined in the RESET Vector of the Flash ROM. The application can program its own watchdog value, as it was not treated by the Boot Loader before. May 25, 2004; 6251-606-1PD 45 CDC16xxF-E PRELIMINARY DATA SHEET 5.3.4. Used Resources UART and CAN busses work asynchronously, target response would result in bus collisions. 5.3.4.1. RAM 5.3.6. Interface Protocol The Boot Loader uses and thus overwrites the contents of addresses 200H to 20DH in any case, i. e. also if CSW2.WKID is set, which means that there is a wake-up from Power Saving Mode (see Table 6-7 on page 53). If no wake-up is detected, zero page addresses F5H to FFH and stack page addresses 100H to 10AH and 1E8H to 1FFH are used in addition. The interface protocol falls into three sections: 1. Boot Identifier. It is continuously transmitted by the host. After reset, the Boot Loader waits for the Boot Identifier. 2. Download Header. It contains the start address, target address and data length. 3. Download Data. After the Download Header, the announced number of data bytes are transmitted by the host. The first byte is stored in the address defined in target address, the next one in target address + 1, and so on. After reception of the last byte the processor immediately executes a jump to the address in start address. Because the watchdog is treated during download, the downloaded program must also refresh it with the same value (= 6 for effective 6.144 ms at fXTAL = 8 MHz), starting with 06H, followed by its complement 0F9H, 06H, 0F9H, ... and so on. 5.3.4.2. Watchdog The Boot Loader restores the RESET states of used modules before it ends, but the once programmed watchdog can not be disabled again. The watchdog gets initialized after the Boot Loader has been started by a RESET that was no wake-up, but not before the Boot Identifier has been detected (as shown in "Fig. 5-7 Boot Loader flow-chart"). Downloaded programs have to refresh the watchdog correspondingly (see "5.3.6. Interface Protocol" for details). No more than 6 ms (at fXTAL = 8 MHz) delay is allowed as delay between the single telegrams during boot identification and download, otherwise the Boot Loader stops reception and starts the application in Flash. Time-out value (6 ms) and baud rate of UART and CAN relate to the processor clock (fXTAL). 5.3.5. Interfacing to a Download Source Either one of the UARTs or CANs can be used to activate a download. The Boot Loader assumes a single-bus line as connection to the host. So either wired-or Rx/Tx interfaces or separate driver circuits may be used. As start of a download, the host has to keep generating Boot Identifiers while the targets get a reset. After a minimum of time, when the target running is stable, the host sends the Download Header, followed by the Download Data. To allow download to several targets connected to the same bus, the Boot Loader does not generate a receipt. Since the 5.3.6.1. UART Protocol and Timing n bytes of Boot Identifier in correct order Boot Identifier to Rx or or to to to to to A3H A3H 26H D6H A3H 26H D6H 26H D6H A3H 26H D6H A3H D6H A3H 26H D6H A3H 26H RESET Download Header, Data to to to SOH to <= 6ms @ fXTAL = 8 MHz Fig. 5-8: UART Timing The expected telegram format is: 1 Start bit, 8 Data bits, 1 even parity bit and 1 Stop bit at a rate of 9600Bd at 8 MHz processor clock. To use standard K-bus drivers the UART transmitter inverters are switched on. bigger delay being detected, stops the Boot ID detection and starts the application. Download Header Boot Identifier After reset the Boot Loader tries to detect the Boot ID which consists out of 3 bytes with the values 26H, D6H and A3H respectively, of which each is expected within 6 ms (at fXTAL = 8 MHz) after the preceding one. The telegram may start with any value out of this queue, but the bytes have to appear in the right order. Any other value or the event of a 46 The Download Header has to follow the last byte of the Boot ID, the A3H, and starts with an ASCII SOH = 01H. It is followed by the start and target addresses of the download program and its length as 16-bit values of which the low bytes are transmitted first. The Download Header terminates with a 16-bit Check Sum, low byte transmitted first, which is the 2's complement of the sum, calculated from SOH up to and May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET including Data Length. The sum of all bytes in the Download Header (including the Check Sum) should be zero. Table 5-2: Download Header Field Size Meaning SOH 8 bit start of Download Header Start Address 16 bit Boot Loader jumps to this address after download. Target Address 16 bit Boot Loader writes data to this address. Data Length 16 bit Number of data bytes transmitted after Download Header (Check Sum excluded). Check Sum 16 bit 16-bit Check Sum from SOH to data length Download Data As many data bytes as defined in Data Length are expected, plus a 16-bit Check Sum, low byte transmitted first, which is the 2's complement of the sum, calculated over all data. The sum of all bytes (including the Check Sum) should be zero. 5.3.6.2. CAN Protocol and Timing Boot Identifier to Rx 7FF RESET n Boot Identifiers to Download Header to 7FF 7FF 627 DLC = 0 DLC = 0 DLC = 6 Download Data to Download Data to 626 DLC = 1 ... 8 626 DLC = 1 ... 8 to <= 6ms @ fXTAL = 8 MHz Fig. 5-9: CAN Timing target addresses of the download program and its length as 16-bit values with low bytes first. The Boot Loader expects CAN telegrams in standard format (11 bit identifier) at a bit rate of 125kBd at 8 MHz processor clock with control parameters set as follows: BPR = 7, TSEG1 = 3, TSEG2 = 2, SJW = 3, rx not inverted. Table 5-3: Download Header Field Size Meaning Start Address 16 bit Boot Loader jumps to this address after download. Target Address 16 bit Boot Loader writes data to this address. Data Length 16 bit Number of data bytes transmitted after Download Header (Check Sum excluded). Boot Identifier (ID = 7FFH, DLC = 0) After reset the Boot Loader expects the Boot Identifier within 6ms (@ fXTAL = 8 MHz), what consists out of a telegram with ID = 7FFH and DLC = 0. As the transmitter is not active, at least one additional working CAN node has to work correctly on the bus, to generate the CAN bus acknowledge bits! If the Boot ID can not be detected in time, the Boot Loader starts the application. Download Header (ID = 627H, DLC = 6) Download Data (ID = 626H, DLC = 1 ... 8) The Download Header telegram has to follow within 6 ms (@ fXTAL = 8 MHz) after the Boot ID. It contains the start and As many data bytes as defined in Data Length are expected, plus a 16-bit Check Sum, low byte transmitted first, which is the 2's complement of the sum, calculated over all data. The sum of all bytes (including the Check Sum) should be zero. Micronas May 25, 2004; 6251-606-1PD 47 CDC16xxF-E PRELIMINARY DATA SHEET 6. Core Logic 6.1. Control Register CR The Control Register CR serves to configure the ways, by which certain system resources are accessed during operation. The main purpose is to obtain a variable system configuration during IC test. Upon each HIGH transition on the RESETQ pin internal hardware reads data from address location 00FFF3h and stores it to the CR. The state of the TEST and ESTOPCLK pins at this point in time, specifies which program storage source is accessed for this read. Table 6-1: Control byte source TEST Control byte source 0 or NC internal BOOT ROM (standard for stand-alone operation) 1 external via Multifunction pins in Bus mode (for test purposes only) 6 r/w RESLNG TSTTOG 5 4 x MFM r/w RESLNG TSTTOG EBTRI MFM 3 2 TSTROM IROM FLASH IROM 1 Table 6-2: TSTTOG and MFM usage in mask ROM parts TSTTOG MFM TEST pin Multifunction Pins 0 0 x Bus mode 1 0 0 Bus mode 1 normal mode x normal mode 1 Table 6-3: TSTTOG, EBTRI and MFM usage in Flash and EMU parts Control Register 7 Multifunction pin Mode (Tables 6-2 and 6-3) x The system will thus start up according to the configuration defined in address location 00FFF3h, automatically copied to register CR. CR MFM TSTTOG EBT RI MFM TEST pin Multifunction Pins Emulator Bus Pins 0 x 0 x Bus mode Flash mode 1 x 0 0 Bus mode Flash mode 1 normal mode x normal mode 0 IRAM ICPU ROM IRAM ICPU Emu Value of 00FFF3h Res x 0 1 1 RESLNG Reset Pulse Length r/w1: Pulse length is 16/FXTAL r/w0: Pulse length is 4096/FXTAL This bit specifies the length of the reset pulse which is output at pin RESETQ following an internal reset. If pin TEST is 1 the first reset after power on is short. The following resets are as programmed by RESLNG. If pin TEST is 0 all resets are long. Eulator mode Flash mode TSTROM TestROM (Table 6-4) FLASH FLASH EEPROM (Table 6-5) IROM Internal ROM (Tables 6-4 and 6-5) Table 6-4: TSTROM and IROM usage in mask ROM parts TSTTOG TEST Pin Toggle (Tables 6-2 and 6-3) This bit is used for test purposes only. If TSTTOG is true in IC active mode, pin TEST can toggle the multifunction pins between Bus mode and normal mode. TSTROM IROM selected program storage 1 1 internal ROM EBTRI 0 Emulator Data Bus Tristate (Table 6-3) x 48 May 25, 2004; 6251-606-1PD internal TestROM 0 external via Multifunction pins in Bus mode Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 6-5: FLASH and IROM usage in FLASH and EMU parts FLASH IROM selected program storage 1 1 internal FLASH EEPROM resp. Emulator Bus 0 x IRAM r/w1: r/w0: 0 ICPU r/w1: r/w0: Internal CPU Enable internal CPU. Disable internal CPU. Table 6-6: Some commonly used settings for address location 00FFF3h. A copy is automatically transferred to the CR during IC start-up. internal BOOT ROM Code TEST Pin Operation Mode external via Multifunction pins in Bus mode FFh 0 Stand-alone with internal ROM or Flash ABh 1 External program storage connected to Multifunction pins in Bus mode DFh 0 Emulator mode (CPGA177 package) Internal RAM Enable internal RAM. Disable internal RAM. 6.2. Reset Logic 6.2.1. Alarm Function An alarm comparator on the pin RESETQ allows the detection of a threshold higher than the reset threshold. An alarm interrupt can be triggered with the output of this comparator. The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. The intended use of this function is made, when a system uses a 5 V regulator with an unregulated input. In this case, the unregulated input, scaled down by a resistive divider, is fed to the RESETQ pin. With falling regulator input voltage this alarm interrupt is triggered first. Then the reset threshold is reached and the IC is reset before the regulator drops out. The time interval between the occurrence of the alarm interrupt and the reset may be used to save process data to nonvolatile memory. In addition, power saving steps like turning off stepper motor drivers may be taken to increase the time interval until reset. The alarm interrupt is a level triggered interrupt. The interrupt is active as long as the voltage on pin RESETQ remains between the two thresholds of alarm and reset (see Fig. 6-1 on page 50). 6.2.2. Internal Reset Sources This IC contains three internal circuits that are able to generate a system reset: watchdog, supply supervision and clock supervision. All three internal resets are directed to the open drain output of pin RESETQ. Thus a "wired or" combination with external reset sources is possible. The RESETQ pin is current limited and therefore large external capacitances may be connected. All internal reset sources initially set a reset request flag. This flag activates the pull-down transistor on the RESETQ pin. An internal reset prolongation counter starts, as soon as no internal reset source is active any more. It counts 4096 FXTAL periods (for alternative settings refer to register CR) and then resets the reset request flag, thus releasing the RESETQ pin. Micronas As long as the reset input comparator on the pin RESETQ detects the low level, all IC registers are held in reset state. 6.2.2.1. Supply Supervision An internal bandgap reference voltage is compared to VDD. A VDD level below the Supply Supervision threshold VREFPOR will permanently pull the pin RESETQ low and thus hold the IC in reset (see Fig. 6-2 on page 51). With HW Option FFB8h, bit6 = 0, this reset source can be enabled/disabled by flag CMA in register CSW0 (see Section 6.2.2.2. on page 49). 6.2.2.2. Clock Supervision The Clock Supervision monitors the frequency at the oscillator input XTAL1. A frequency level below the clock supervision threshold of fSUP (see chapter 3.3.Characteristics) will permanently pull the pin RESETQ low and thus hold the IC in reset (see Fig. 6-2 on page 51). With HW Option FFB8h, bit6 = 0, this reset source can be enabled/disabled by flag CMA in register CSW0. A frequency exceeding the specified IC frequency is not detected. There are two general operation options which can be selected in the HW Options field (address FFB8h): 1. Bit6 = 1: Clock and Supply Supervision are permanently active. They can not be deactivated. The Watchdog must be serviced by SW. This mode is recommended for all stand-alone applications requiring high operational reliability. 2. Bit6 = 0: Clock and Supply Supervision are active after reset, but can be enabled/disabled by the clock monitor active flag CMA of register CSW0. The Watchdog must be serviced only after a first write access to register CSW1. This mode is recommended for test and evaluation purposes only. May 25, 2004; 6251-606-1PD 49 CDC16xxF-E PRELIMINARY DATA SHEET VBG SR3.WAID en 1 VDD 1,25V 10% VBG Generator RESETQ VREFA en ALARM Comp. VREFR en RESET/ ALARM Interrupt Source + + RES RESET Comp. VREFPOR + - POR en Supply Supervision UVDD SR0.LCD en + 2/ 3UVDD + 1/ 3UVDD LCD Supply VSS XTAL1 SR3.XTAL DBG.DSC run 1 ON 1 en XTAL Oscillator XTAL2 RTCCLK OSC.XM '1' OSCCLK '0' VDD Fig. 6-1: Analog core logic block diagram 6.2.2.3. RESET Comparator During power saving mode, the comparator function is not available and is bypassed by a simple CMOS Schmitt input. Full CMOS levels are thus required on this input in this mode. 50 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET DBG.DCS SR3.WAID & VREFR 1 core reset & port reset RES + RESETQ & WAKE_RES WDRES reset in Watchdog HW option CSW0.CMA VDD Reset extension 16 or 4096 fXTAL clocks >1 RESIR 0 1 fXTAL fSUP clock supervision & 1 SR3.WAID S Q R & RESINTOUT 1 CLS power on POR & wr CSW2 wr CSW2.FHR D R 1 Q SQ R SQ R SQ R SQ R SQ R core reset & wr CSW1 res CSW2 CSW2.FHR CSW2.CLM CSW2.POR CSW2.PIN CSW2.WKID 1 SQ R CSW1.WDRES Fig. 6-2: Reset Logic Block Diagram 6.2.2.4. Watchdog The Watchdog module serves to monitor undisturbed program execution. A failure of the program to retrigger the Watchdog within a preselectable time will pull the pin RESETQ low and thus reset the IC (Fig. 6-2 and 6-3). With HW Option FFB8h, bit6 = 0, this reset source is only enabled after a write access to register CSW1 (see Section 6.2.2.2. on page 49). Micronas May 25, 2004; 6251-606-1PD 51 CDC16xxF-E 2.write & even PRELIMINARY DATA SHEET CSW1 3.write & odd Trigger Reg1 CSW1 Trigger Reg2 8 CSW1 1. write Timer Register 8 8 1. write = 1 & load CPUFST=1: fosc * 2-13 CPUFST=0: fosc * 2-13 * 2-8 clk zero 8-Bit-Counter & 2.write & even 3.write & odd D Q C S 1 reset in HW Option 1. write power on wr CSW1 S Q R & reset out VDD S Q R 1 CSW1.WDRES Fig. 6-3: Watchdog Block Diagram The Watchdog contains a down-counter that generates a reset when it wraps from zero to FFh. It is reloaded with the content of the watchdog timer register, when, on a write access to register CSW1, watchdog trigger registers 1 and 2 contain bit complemented values. An IC reset resets the watchdog timer register to FFh, thus forcing the Watchdog to create a maximum reset interval. 6.2.2.5. Forced Hardware Reset The Watchdog is controlled by register CSW1. The first write access to it loads the timer register value setting the Watchdog's unretriggered reset interval. The desired interval can be programmed by setting the CSW1 value to: Entering power saving mode by setting SR3.WAID sets CSW2.WKID, but does not pull RESETQ low. However, wake-up from one of the power saving modes (signal WAKE_RES in Fig. 6-2) does pull RESETQ low. Setting flag CSW2.FHR immediately forces the RESETQ pin low. This allows the SW to restart the whole system by HW reset. 6.2.2.6. Wake-Up Reset 6.2.3. External Reset Sources Interval x f CPU --1 Value = ----------------------------------8192 As long as the reset input comparator on the pin RESETQ detects the low level, the overall IC is reset. On this pin, external reset sources may be wire-ored with the IC internal reset sources, leading to a system-wide reset signal combining all system reset sources. The resolution of the Watchdog is 8192/fCPU. The second and all following even-numbered write accesses load watchdog trigger register 1, the third and all following odd numbered write accesses load watchdog trigger register 2. In all future, the SW has to write alternatingly to register CSW1 value and bit complement value, thus retriggering the up-counter. Failure to retrigger will result in an overflow of the up-counter generating a Watchdog reset. It is not allowed to change a chosen value. Writing a wrong value to CSW1 immediately sets the flag WDRES in register CSW1 and prohibits further retriggering of the watchdog counter. WDRES is true after a Watchdog reset. Only a Supply Supervision reset or a write access to register CSW1 clears it. 52 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 6.2.4. Summary of Module Reset States write a value (not necessarily the former time value) and its bit complemented value. Using other values or changing the order of both values will cause the watchdog to generate a RESET. After reset the IC modules are set to the reset state (Fig. 6-7) Table 6-7: Status after Reset Status CPU FAST mode (fOSC). Interrupt Controller Interrupts are disabled. Priority registers, request flip flops and stack are cleared. CSW2.FHR *)CSW2.CLM *)CSW2.PIN *)CSW2.POR CSW1.WDRES Reset Source CPU *)CSW2.WKID Table 6-8: Source of last Hardware Reset Module U-Ports Normal mode. Output is tristate. 0 0 0 1 0 0 external from RESETQ pin High current ports Normal mode. Output is low. 0 0 0 1 0 1 internal Watchdog 0 0 1 1 0 0 internal Clock Supervision LCD module Registers are reset. No display. 0 0 1 1 1 0 internal Supply Supervision Watchdog Depends on mask option. EMU option: Switched off. SW activation is possible. Stand-alone option: Permanently active. 0 1 0 1 0 0 internal Forced Hardware 1 x x 1 x x wake-up from WAKE/IDLE Clock monitor The registers sum up the source of all HW resets that occurred since the last write to register CSW2. *)Any write access to CSW2 resets these flags to 0. Depends on mask option. EMU option: Active. SW may toggle. Stand-alone option: Permanently active. The RTC can not be reset. 6.2.5. Reset Registers CSW0 w CSW2 7 6 5 4 3 2 1 0 x x x x x x x CMA x x x x x x x 1 CMA Clock and Supply Monitor Active w1: w0: Both Enabled. Both Disabled. CSW1 5 4 r TST x WKID FHR w x x x TST x 0 3 2 1 0 CLM PIN POR x 0 FHR x x x x 0 0 0 0 0 x Res* Res Clock, Supply & Watchdog Register 1 7 6 5 4 3 2 1 0 x x x x x x x WDRES 1 1 w Watchdog Time and Trigger Value 1 6 Clock, Supply & Watchdog Register 0 This register controls the Supply and Clock Supervision modules. r Clock, Supply & Watchdog Register 2 7 1 1 1 1 1 Res This register controls the Watchdog module. Only values between 1 and 255 are allowed. *The Reset state in the register frame above describes the state after a write to register CSW2. Refer to Table 6-8 on page 53 for the state after a hardware reset. TST r1: r0: TEST Pin State TEST is 1. TEST is 0. WKID Wake Reset from WAKE/IDLE Mode (Table 6-8) FHR r0: r1: w1: w0: Forced Hardware Reset (Table 6-8) (Table 6-8) force Reset no action CLM Clock Supervision Reset (Table 6-8) PIN RESETQ Pin Reset (Table 6-8) POR Supply Supervision Reset (Table 6-8) WDRES Watchdog Reset Source r1: Watchdog was reset source. Any write access to CSW1 resets this flag. First write the desired watchdog time value to this register. On further writes, to retrigger the Watchdog, alternatingly Micronas May 25, 2004; 6251-606-1PD 53 CDC16xxF-E PRELIMINARY DATA SHEET 6.3. Standby Registers UART0 r/w1: r/w0: UART 0 Module active. Module off. For details about enabling and disabling procedures and the standby state refer to the specific module descriptions. ADC r/w1: r/w0: ADC Module Module active. Module off. The minimum IC current consumption is obtained with SR0, SR1, SR2 and SR3 set to 00h. P0DIN r/w1: Port 0 Digital Input Enable digital inputs on analog ports P0.1 to P0.5 Disable digital inputs on analog ports P0.1 to P0.5. The Standby Registers SR0, SR1, SR2 and SR3 allow the user to switch on/off power or clock supply of single modules. With these flags it is possible to greatly influence power consumption and its related electromagnetic interference. r/w0: SR0 r/w Standby Register 0 7 6 5 4 3 2 1 0 SM PWM1 PWM0 UART2 SPI1 CAN0 CCC SPI0 0 0 0 0 0 0 0 0 SM r/w1: r/w0: Stepper Motor Module active. Module off. PWM1 r/w1: r/w0: Pulse Width Modulator 1 Module active. Module off. PWM0 r/w1: r/w0: Pulse Width Modulator 0 Module active. Module off. UART2 r/w1: r/w0: UART 2 Module active. Module off. SPI1 r/w1: r/w0: SPI 1 Module active. Module off. CAN0 r/w1: r/w0: CAN Module 0 Module active. Module off. CCC r/w1: r/w0: Capture Compare Counter Module active. Module off. SPI0 r/w1: r/w0: SPI 0 Module active. Module off. Res TIM1 r/w1: r/w0: Timer 1 Module active. Module off. ERM r/w1: r/w0: EMI Reduction Module Module active. Module off. SR2 r/w SR1 Standby Register 1 7 r/w LCD 0 6 5 CPUFST PSLW 1 0 4 3 2 1 0 UART0 ADC P0DIN TIM1 ERM 0 0 0 0 0 LCD r/w1: r/w0: LCD Module Module active. Module off. CPUFST r/w1: r/w0: CPU FAST Mode FAST mode: FCPU = FXTAL SLOW mode: FCPU = FXTAL / 256 PSLW r/w1: r/w0: Port Slow Mode Slow mode. Fast mode. 54 Res Standby Register 2 7 6 5 4 3 2 1 0 TIM2 PWM3 PWM2 UART1 PWM4 DGB EXTIR ABM 0 0 0 0 0 0 0 0 TIM2 r/w1: r/w0: Timer 2 Module active. Module off. PWM3 r/w1: r/w0: Pulse Width Modulator 3 Module active. Module off. PWM2 r/w1: r/w0: Pulse Width Modulator 2 Module active. Module off. UART1 r/w1: r/w0: UART 1 Module active. Module off. PWM4 r/w1: r/w0: Pulse Width Modulator 4 Module active. Module off. DGB r/w1: r/w0: DIGITbus Master Module active. Module off. EXTIR r/w1: External Interrupt Enable functions IRQ on pin U5.4 and ABORTQ on pin U5.5 Disable functions IRQ on pin U5.4 and ABORTQ on pin U5.5 r/w0: ABM r/w1: r/w0: May 25, 2004; 6251-606-1PD Res Alternative Banking Mode Alternative Banking mode enabled Native Banking mode enabled. Micronas CDC16xxF-E PRELIMINARY DATA SHEET SR3 r/w Standby Register 3 7 6 5 4 3 2 1 0 x x x XTAL WAID FCLO CAN2 CAN1 x x x 1 0*) 0 0 0 XTAL r/w1: r/w0: Quartz Oscillator Mode Start-Up Mode active (default after Reset). Run Mode active. WAID WAKE/IDLE *)Reset with pin reset || VDD power on Res r/w 0 : r/w 1: WAKE/IDLE mode off WAKE/IDLE mode on FCLO r/w 0 : r/w 1: Fast Clock off Fast clock on Fast clock off CAN1 r/w1: r/w0: CAN Module 1 Module active. Module off. CAN2 r/w1: r/w0: CAN Module 2 Module active. Module off. 6.4. Test Registers Test registers are for factory test only. They must not be written by the user with values other than their reset values (00h). They are valid independent of the TEST input state. In all applications where a hardware reset may not occur over long times, it is good practice to force a software reset on these registers within appropriate intervals. TST1 7 Test Register 1 6 5 w 4 3 2 1 0 0 0 0 2 1 0 0 0 0 2 1 0 0 0 0 For testing purposes only 0 0 TST2 7 0 0 0 Res Test Register 2 6 5 w 4 3 For testing purposes only 0 0 TST3 7 0 0 0 Res Test Register 3 6 5 w 4 3 For testing purposes only 0 Micronas 0 0 0 0 Res May 25, 2004; 6251-606-1PD 55 CDC16xxF-E PRELIMINARY DATA SHEET 7. Multiplier The Multiplier provides the following function: Features - Calculation of 8 bits x 8 bits = 16 bits. - needs no wait states It is fully supported by the WDC C-compiler WDC816CC. - no status signals necessary to be checked separately by the application program - for the application program the result is immediately available after writing into the multiplier register - the registers for multiplicand and multiplier are not only writable but also readable Data Bus 8 8 multiplier 16 product multiplicand 8 8 16 2-bit counter load sh2 double shift right bit 10 & 8 8 8 + SUMA[0] COA, SUMA[7:1] & 8 8 + SUMB[0] COB, SUMB[7:1] clck latch 8 Result LSByte Result MSByte 16 Fig. 7-1: Block diagram of the multiplier 56 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 7.1. Functional Description To obtain a 16-bit product, the application program first has to write the first factor into the 8-bit multiplicand register and then the second factor into the multiplier register. Writing the multiplier starts the multiplication. The execution of the multiplication takes 4 CPU clock (PH2) cycles. CPU instructions with absolute addressing modes take at least 4 cycles to access the product register. According to this, immediately after writing into the multiplier register, the result is available for the application program. 7.2. Registers Two 8-bit registers serve as input and a 16-bit register delivers the result: MULCAND 7 6 Multiplicand 5 r/w 4 MULPROD 3 2 1 0 7 multiplicand x x x x Writing into the Multiplier register starts the execution of the multiplication. x x x x Res 6 Multiplication Product 5 4 3 7 6 r/w 4 0 Offs Product high byte 1 r Product low byte 0 Res The Product register MULPROD holds the result of the multiplication after 4 CPU clock (PH2) cycles have elapsed. Multiplier 5 1 r x MULPLIER 2 3 2 1 0 x x x multiplier x x x x x Res 7.3. Operation of the Multiplier Since the execution of a multiplication takes less CPU cycles than an application program needs to access the result register, multiplications are done by simply writing the multiplicand followed by the multiplier and reading the product. Precautions have to be taken in application programs using the multiplier, and in application programs which may be interrupted by a service routine also using the multiplier. If the procedure of writing the multiplicand and multiplier until reading the result register is interrupted, and the interrupt service routine overwrites the multiplier input registers, the result read by the background program is wrong. To solve this problem, the multiplier input registers have to be saved before and restored after a multiplication takes place in the interrupt service routine. Micronas May 25, 2004; 6251-606-1PD 57 CDC16xxF-E PRELIMINARY DATA SHEET 8. Power-Saving Module (PSM) Features To reduce the power consumption one of two Power-Saving Modes (WAKE and IDLE) can be selected. Non-power-saving modes are DEEP SLOW, SLOW and FAST, which differ from Power-Saving Modes by having the CPU running instead of a stopped CPU clock during WAKE/IDLE active. Most of the core logic is switched off in a Power-Saving Mode. Only hardware necessary for WAKE/IDLE is supplied. - Power reduction down to leakage current of wake mode possible - Real-Time Clock (RTC) Module - Clock source: Built-in RC oscillator or XTAL - Up to 10 edge and level triggered Wake Ports - Wake sources: RTC Module and/or Wake Ports - Polling Module for cyclic scan of the Wake Ports - Interrupt outputs of RTC Module and Port Wake Module Polling Module H2.5 Core Logic enable RC Oscillator 20..50kHz RTC Module RTC wake-up AVDD, UVDD Analog Sections IR RTC 4 ... 12MHz 1 Up to ten Wake Ports Port Wake Module & Port wake-up WAKE_RES Reset Logic IR WAPI Fig. 8-1: Power-Saving Module The major task of the Power-Saving Module is to supply a wake-up signal (WAKE_RES) for the main system or to generate an interrupt, as shown in Fig. 8-1. WAKE_RES is necessary to get the IC out of a Power-Saving Mode. Apart from WAKE_RES, a Power-Saving Mode can only be left by activating RESETQ at pin or by a power on reset. WAKE_RES is generated by a Port Wake Module for an event-driven wakeup, combined with an RTC Module for a cyclic wake-up. The Power-Saving Module is active all the time, during power-saving mode as well as during non-power-saving mode (CPU active modes). The WAKE_RES output signal can be generated during power-saving mode only. The RTC Module has to provide the time of the day accurately down to a second, and generate an output signal, which can be used to trigger an interrupt or a wake-up signal. The RTC Module can be clocked by the on-chip quartz oscillator or by the Power-Saving Module built-in RC oscillator. The Polling Module cyclically outputs a high pulse of programmable duration at port H2.5. Some of the RTC Module taps are connected to the Polling Module for deriving the pulse period and duration. The Port Wake Module merges several Wake Ports and outputs a signal that can be used to trigger an interrupt or a wake-up signal. 58 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET OSC.PRE 4...12MHz OSC.XM 20..50kHz OSC.RC OSC.SRC XTAL Oscillator SMX.MUX RTCCLK 1/8 VDD 1/2 wake-up fPP en Poll Clk fSS RC Oscillator en SMX_out Mux fS RTC Module 20-Bit Rel Reg SSR Sub Sec Cnt SSC 3 7 10 14 10..19 load fm fh fd SEC MIN HR 1 2 4 8 16 32 1 2 4 8 16 32 1 2 4 8 16 24 1Hz SMX.BYP RTCC.SEL Mux RTC out CLK Mux IR_RTC POL.PER Mux fPC poll period fPP POL.OE Poll Clk & POL.ENA Delay Counter POL.DEL poll out & wake out S Q R Polling Module & WSC.RTC WAID & WSC.P WAKE_RES 1 wake-up WSC.AST WPMx.MOD CMOS Threshold UPort wake in PPort CANx-RX H2.5 WUS.RTC & Edge/Level Trigger Mode & Enable trigger SQ R 1 1 IR_WAPI WUS.WPx 10x Port Wake Module Fig. 8-2: Power-Saving Module Block Diagram 8.1. Functional Description The power-saving logic combines all wake-up sources. It contains an RC oscillator, a 20-bit sub second counter, an RTC, multiplexers to select different taps of the sub second counter or of the RTC, a Polling Module and the logic for up to ten Wake Ports. The RTC Module output can generate an interrupt or a wakeup signal. All Wake Ports can generate a collective interrupt or a wake-up reset. The Polling Module drives an H-Port and Micronas generates a strobe signal to enable a Wake Port to trigger on a dedicated input level. Several internal clock signals can be output via CO1 (SMX_out). 8.1.1. RTC Module To work as real-time counter, a sub-second counter (SSC) with its reload register (SSR) and a seconds, minutes and hours counter are part of the Power-Saving Module. As input May 25, 2004; 6251-606-1PD 59 CDC16xxF-E PRELIMINARY DATA SHEET for the sub second counter (fSS), either a clock of the quartz oscillator divided by 8 or 16 or that of the module built-in RC oscillator can be selected. The SSR has to be programmed with a value that yields a one Hertz beat fS as output signal of the SSC to clock the seconds. fS is the reload signal for SSC as well as the input clock to the seconds counter (RTC.SEC). An underrun of the down-counting SSC triggers the seconds counter to count up. 60 seconds trigger a minutes up-count (RTC.MIN), followed by the hours (RTC.HR). Due to the adjustment mechanism by the 20-bit reload register, the polling period is not always constant. Depending on the reload value, the polling period may vary between 0.5 and 1.5 nominal polling periods at the point of reloading. All stages of the three up-counters can be selected to generate an interrupt or a wake-up signal. There is a trigger mode logic (level or edge sensitive) and a wake source flag for each Wake Port. The Wake Out input is a signal from the Polling Module. The falling edge generates a strobe pulse which is used to sample the level of the Wake In input and sets the corresponding wake source flag if necessary. Instead of the strobe signal, WSC.AST may be used, e.g., if no RTC subsystem (with Polling Logic) is implemented. The corresponding WPx flag in register WUS will be forced to high as long as the programmed condition (high or low level) is met at the Wake Port. Please see Fig. 8-2 for details. The selected strobe signal source is valid for all Wake Ports. Mixing of the strobe signal sources (polling and alternative) is not possible. As opposed to other internal clocks, the RTC can not be stopped (during emulation) by ESTOPCLK. 8.1.2. Polling Module The polling logic periodically activates the output signal Wake Out which can be enabled by SW to drive port H2.5 (Poll Out). The rising edge of the Polling Period input (fPP) defines the start and the Polling Clock (fPC). Together with the delay counter, it defines the duration of the high time. This can be used to cyclically flash a LED or drive external circuitry. The falling edge of the Wake Out signal is used to scan the input levels of that Wake Ports (WPx) which are configured for high or low level trigger mode. Those configured ports will set the corresponding WPx flag in register WUS with the falling edge of the strobe signal. Please refer to Fig. 8-6 for timing details about the Wake Out and the strobe signals. The control unit is designed for a polling period to be set equal to or greater than four times the polling delay. 8.1.3. Port Wake Module The wake flags of all Wake Ports are located in the wake-up source register WUS. The trigger events which can set the wake flags can be configured in the wake-up pin mode registers WPM0 to 8 either in field MOD0 or MOD1. Please refer to Table 8-9 for details about allocation of mode registers and Wake Ports. The output of each Wake Port is connected to an or gate, whose output can generate a Wake Port interrupt as well as a wake-up signal. 8.2. Registers OSC r/w RC r/w1: r/w0: Oscillator Source Register 7 6 5 RC XK XM 1 0 1 4 x 3 2 LD PRE 1 0 SRC Offs 0 No HW reset Res RC oscillator enable disable XK External 32kHz XTAL (not available) r/w1: enable r/w0: disable Write to zero for future compatibility. XM r/w1: r/w0: 4 ... 12MHz XTAL always enabled disabled during power-saving mode LD r: w1: w0: Load SRC and SSC Always read as zero Immediately selects the oscillator source according to SRC and loads SSC with SSR. No action PRE r/w1: r/w0: 4 ... 12MHz XTAL / 8 or / 16 4 ... 12MHz XTAL / 16 4 ... 12MHz XTAL / 8 60 SRC Oscillator Source Select r/w0: 4 ... 12MHZ XTAL (divided by 8 or 16) r/w1: Don't use, factory test only r/w2: RC oscillator r/w3: Ground With OSC.LD set, writing to SRC selects a new oscillator source immediately. When OSC.LD is not set, a new oscillator source does not get valid before the next reload of the SSC. Consider that a read access returns the current source select, not a possibly requested one by a write with OSC.LD not set! SSR Sub Second Reload Register 7 6 5 4 r/w x x x x r/w x x x x 3 x 2 x 1 x Bit 19 to 16 0 x Offs 3 2 r/w Bit 15 to 8 1 r/w Bit 7 to 0 0 No HW reset Res For typical settings, please refer to Tables 8-1 to 8-3. The values 0 and 1 are not allowed. To avoid programming values not expected, never write single bytes of the SSR on their own, but always all 3 bytes without an interrupt by SSC May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET read. This is necessary, as for reading SSC the register hardware (master/slave) uses the same buffer registers as for writing SSR. Single bytes could still be filled with intermediate SSC values of a previous read. Writing SSR does not load the SSC immediately. This will be done automatically together with the next reload of the SSC. It can be forced immediately by setting OSC.LD. WUS Wake-Up Source Register 7 6 5 4 3 r/w RTC x x x x r/w WP7 WP6 WP5 WP4 WP3 2 1 0 x WP9 WP8 1 WP2 WP1 WP0 0 No HW reset SSC 6 5 4 r x x x x r x x x x 3 2 x x 1 x 0 x Bit 19 to 16 Offs 3 2 r Bit 15 to 8 1 r Bit 7 to 0 0 No HW reset Res A read access to byte 0 of the SSC latches the bytes 1 and 2. This mechanism grants consistent read access to the SSC. RTC Real Time Counter 7 6 5 4 r/w x x x x r/w x x x r/w x x MIN 1 r/w x x SEC 0 3 2 x x 1 x 0 x HR Offs Hours Counter MIN r/w0 to 59: Minutes Counter SEC r/w0 to 59: Seconds Counter Real Time Clock RTC was trigger source No trigger Clear No modification WPx r1: r0: w1: w0: Wake Port x Wake Port was trigger source No trigger Clear No modification For proper interrupt generation some peculiarities in operating this register have to be considered. All set bits must be cleared by writing back the whole pattern that was read before. Always read and clear (write back) the whole register, byte 0 first, which will become valid when writing byte 1, even if only flags in byte 0 are in use. Every write access to byte 1 will produce an interrupt, as long as WUS contains a one. WPMx 7 r/w Wake Port x Mode Register 6 x 5 4 3 MOD1 Res Reading SEC latches MIN and HR. Writing HR simultaneously saves MIN and SEC in the corresponding counters. This mechanism allows consistent read and write access. Since read and write use the same latches, don't mix these access types. HR r/w0 to 23: RTC r1: r0: w1: w0: 3 2 No HW reset 2 x 1 MOD0 7 6 5 x x x 4 3 2 SEL No HW reset Select RTC Output (Table 8-4) 1 0 Offs 0 Res 0 MODy Trigger Mode (Table 8-5) Trigger mode for Wake Port WPx+y. For assignment of Wake Port and mode field please refer to Table 8-9. POL RTC Control Register Offs Res r/w x r/w ENA Polling Register 6 5 CLK OE 4 3 2 x 1 PER x DEL 0x00 RTCC 0 No HW reset 7 SEL Res Sub Second Counter 7 r/w Offs CLK Select Polling Clock (Table 8-7) PER Select Polling Period (Table 8-6) ENA r/w1: r/w0: Enable Polling Module enable disable OE r/w1: r/w0: Enable Polling Output enable disable 0 Offs 1 0 Res DEL Select Polling Delay Time r/w1 to 31: Delay time = DEL/fPC r/w0: Delay time = 32/fPC A write access to DEL immediately loads the 5-bit down counter. The delay time defines the duration of the Wake Out signal (Fig. 8-6). Micronas May 25, 2004; 6251-606-1PD 61 CDC16xxF-E WSC r/w PRELIMINARY DATA SHEET Neither WUS.WPx nor the WAPI interrupt source output are affected. Wake Source Control 7 6 5 4 x x x x 3 x 2 1 AST RTC 0x00 after VDD power on 0 P Offs SMX 0 Alternative to Strobe Alternative input Wake out signal from Polling Logic 6 5 4 BYP x x x 3 2 1 0 x MUX Offs 0 0x00 RTC RTC Wake-up Enable r/w1: enable r/w0: disable Neither WUS.RTC nor the RTC interrupt source output are affected. P r/w1: r/w0: 7 Res r/w AST r/w1: r/w0: Signal Multiplexer Register BYP r/w1: r/w0: Res Bypass SSC RTC is clocked by fSS (test) RTC is clocked by fS (1Hz) MUX Signal Multiplexer (Table 8-8) Defines a signal which is output as SMX_out. Port Wake-up Enable enable disable Table 8-1: SSR values for fs = 1Hz with XTAL and XTAL/8 (Maximum adjusted resolution) XTAL [MHz] XTAL/8 [KHz ] Period [us] Reload Value Resolution [ppm] Per Day [ms] 4 500 2.00 500000 1.00 86.40 5 652 1.60 625000 0.80 69.12 6 750 1.33 750000 0.67 57.60 8 1000 1.00 1000000 0.50 43.20 Table 8-2: SSR values for fs = 1Hz with XTAL and XTAL/16 (Maximum adjusted resolution) XTAL [MHz] XTAL/16 [KHz ] Period [us] Reload Value Resolution [ppm] Per Day [ms] 4 250 4.00 250000 2.00 172.80 5 313 3.20 312500 1.60 138.24 6 375 2.67 375000 1.33 115.20 8 500 2.00 500000 1.00 86.40 10 625 1.60 625000 0.80 69.12 12 750 1.33 750000 0.67 57.60 Table 8-3: SSR values for fs = 1Hz with RC (Maximum adjusted resolution) RC [KHz] 62 Period [us] Reload Value Resolution [ppm] Per Day [ms] 20 50.00 20000 25.00 2160 32,768 30.52 32768 15.26 1318 50 20.00 50000 10.00 864 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 8-4: SEL Usage Table 8-5: MOD Usage RTCC. SEL Tap# Activation WPMx. MODy Trigger Modes 0 Gnd Never 2 1 0 1 Every second x 0 0 Disabled 2 2 Every 2 seconds 0 0 1 Rising edge 4 Every 4 seconds 0 1 0 Falling edge 8 at second 8, 16, 24, 32, 40, 48, 56 0 1 1 Rising and falling edge 16 at second 0, 16, 32, 48 1 0 1 High level 1) 32 at second 0, 32 1 1 0 Low level 1) 7 1 Every minute 1 1 1 Both levels (every strobe signal) 1) 8 2 Every 2 minutes 1) In WAKE mode with alternative strobe only. 4 Every 4 minutes 8 at minute 8, 16, 24, 32, 40, 48, 56 16 at minute 0, 16, 32, 48 32 at minute 0, 32 13 1 Every hour 14 2 Every 2 hours 4 Every 4 hours 8 Every 8 hours 16 at hour 0, 16 24 Every day 6 9 10 11 18 hour counter taps 12 19..31 Don't use 15 16 17 Table 8-6: PER Usage POL. PER 0 1 2 : 9 SEL = 4, 5, 6, 10, 11, 12 and 17 do not produce isochronous intervals. TAP# Sub Second Counter 5 10 fPP fSS/2TAP# 11 12 : 19 10 1 1Hz 11 2 0.5Hz 12 4 0.25Hz 8 at second 8, 16, 24, 32, 40, 48, 56 16 at second 0, 16, 32, 48 32 at second 0, 32 13 14 15 Second Counter 4 minute counter taps 3 second counter taps 1 Isochronous intervals can only be achieved by PER = 10, 11 or 12. Micronas May 25, 2004; 6251-606-1PD 63 CDC16xxF-E PRELIMINARY DATA SHEET POL. CLK Sub Sec Tap# fPC Name Basic Funct. 0 3 fSS/2TAP# 1 7 2 10 WP0 U3.4 3 14 WP1 U6.6 WP2 U1.6 WP3 U6.0 WP4 U6.1 WP5 U6.2 WP6 U5.6 WP7 U4.0 WP8 U4.4 WP9 H2.4 Table 8-8: MUX Usage SMX. MUX Name 0 VDD 1 fSS SSC input (calibration) 2 fS (1Hz) SSC output (adjustment) 3 (wake-up) Test (Factory use only) 4 (wake-up) 5 wake-up 6 fPP 7 Poll Clk WPMx.MODy Table 8-9: Wake Ports WPMx Table 8-7: CLK Usage 0 0 1 2 0 1 4 0 1 6 0 1 8 0 1 8.3. Operation of Power-Saving Module Before entering a Power-Saving Mode, the necessary wakeup sources have to be configured carefully. The reset/wakeup reason in register CSW2 and the wake-up source register WUS have to be cleared. Please see section "CPU and Clock System" for information on entering a power-saving mode. 8.3.2. Configuration of Interrupts During CPU active modes, the RTC Module and the Port Wake Module can be operated as interrupt sources. The interrupts have to be configured according to section "Interrupt Controller (IR)". 8.3.1. Configuration of Wake Sources 8.3.1.1. Port Wake Module If an external event-driven wake-up is necessary, the Port Wake Module has to be configured according to section 8.6. The register WUS has to be cleared. Flag WSC.P has to be set, enabling the Port Wake Module output signal to generate a wake-up signal by setting signal WAKE_RES. If a Wake Port is to be operated in polling mode (level triggered), configuration of RTC Module and Polling Module is necessary as described in sections 8.4. and 8.5. 8.3.1.2. RTC Module If a cyclic wake-up is necessary, the RTC Module has to be configured according to section 8.4. Flag WUS.RTC has to 64 be cleared. Flag WSC.RTC has to be set, enabling the WUS.RTC output signal to generate a wake-up signal by setting signal WAKE_RES. 8.3.3. WAKE/IDLE With setting SR3.WAID (mode = WAKE/IDLE) a core reset signal is generated immediately. A wake-up signal sets WAKE_RES to one, immediately pulling pin RESETQ to low. This sets SR1.CPUFST and disables the WAKE_RES output of the Power-Saving Module. When VDD and PH2 are detected as stable, the signal CLS is cleared and the reset extension is started. After the reset extension has finished, the pin RESETQ is released. The Core reset signal gets inactive and CSW2.WKID is set. The CPU starts execution at the reset vector address and can read the reset/wake-up reason in registers CSW1 and May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET CSW2. The wake-up source can be read in register WUS and should be cleared thereafter, otherwise Wake Port interrupts are not possible. 8.3.4. Precautions The SW has to guarantee the ability of wake-up. In the best case, a stable initialization and configuration of the wake logic is executed immediately after RESET to prevent malfunctions by an unintentionally activated power-saving mode that was not yet initialized before. The necessary Wake Ports have to be configured as inputs. Enabling wake-up by pin only is dangerous. Inadvertently or accidentally entering a power-saving mode with no wake source enabled, e. g. by a software bug, or if a flag is modified by electrical overstress (EOS) in a power-saving mode, a status may be reached which can only be terminated by a manually generated reset with low level at pin RESETQ or with a power on reset. Neither the watchdog nor the clock supervision or any other internal reset source terminates a power-saving mode. Because neither the VBG generator nor the RESET comparator are enabled during power-saving mode, proper CMOS input levels (Vil=VSS0.3 V and Vih=VDD0.3 V) are required on pin RESETQ during a wake-up reset. The external circuitry must allow the device to establish WRVil on that pin. The specified power-saving mode current consumption values are only obtainable with CMOS input levels (Vil=xVSS0.3 V and Vih=xVDD0.3 V) applied to all ports analog inputs via P-ports P0.1 to P0.9 excepted - not only the Wake ports. If an RTC-/Polling module is not used, it is advisable to switch it off to reduce current consumption. Its outputs should be disabled (see Section 8.4.3. on page 69). 8.3.5. Debug Register To allow debugging during an active power-saving mode, e.g., read or change the contents of the RAM, or read or change the contents of I/O or processor registers, the system clock must not be switched off as done normally when a Power-Saving Mode is switched on. By setting DBG.DCS the CPU keeps on running in a power-saving mode. DBG r/w Debug Register 7 6 5 4 x x x x x x x DCS x x x x x x x 0 DCS r/w1: r/w0: Micronas 3 2 1 0 Offs 0 POR DISABLE CPU STOP Disabled CPU stop (clock off) during power-saving mode (debugging) Stop CPU during power-saving modes (standard, no debugging) May 25, 2004; 6251-606-1PD 65 CDC16xxF-E PRELIMINARY DATA SHEET 8.3.6. Timing UVDD RESETQ WAKE_RES SR3.WAID ON PH2 RESPORT RESCORE POR CLS RESIR RESINTOUT 16 or 4096 XTAL cycles Fig. 8-3: Power-on Reset 66 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET UVDD wake-up logic RESETQ WAKE_RES CPU SR3.WAID ON DBG.DCS PH2 RESPORT RESCORE POR CLS RESIR RESINTOUT 16 or 4096 XTAL cycles Fig. 8-4: Switching to WAKE/IDLE with DBG.DCS inactive and Wake-up Micronas May 25, 2004; 6251-606-1PD 67 CDC16xxF-E PRELIMINARY DATA SHEET UVDD wake-up logic RESETQ WAKE_RES CPU SR3.WAID ON DBG.DCS PH2 RESPORT RESCORE POR CLS RESIR RESINTOUT 16 or 4096 XTAL cycles Fig. 8-5: Switching to WAKE/IDLE with DBG.DCS active and Wake-up 8.4. Operation of RTC Module 8.4.1. Reset With the exception of the oscillators, which are enabled by every reset (OSC.RC = OSC.XM = 1), most parts of the logic will never be reset. Therefore, the oscillator not required has to be switched off after every reset. Furthermore, the whole logic has to be initialized after a power-on reset. 8.4.2. Oscillator Source and Sub Second Counter The Sub Second Counter SSC generates a 1 Hz output signal at underflow (0x000000 to 0xFFFFFF). This signal loads the SSC with the content of the SSR register and switches the oscillator source select multiplexer to the desired oscillator according to the SRC field in the OSC register. This load signal can be forced by writing a one to flag LD in register OSC. On three occasions it is necessary to change SSR and OSC.SRC: - Starting the SSC for the first time (after power-on). 68 As OSC.SRC is not reset by HW, an oscillator source must be selected and enabled. The SSR has to be loaded with the reload value necessary for a 1 Hz output frequency. Writing the desired oscillator source in field SRC, enabling it if necessary and setting flag LD in register OSC immediately selects the new oscillator source and loads SSR to SSC. - Changing the SSR Due to temperature or other dependencies of the oscillator it may be necessary to adjust the reload value in the SSR register from time to time. This can be done within the RTC interrupt service routine (RTC-ISR). Write the new reload value to the SSR register. Make sure that this will be completed before the next underflow of the SSC which happens to each second and simultaneously loads SSC with the new SSR value and switches the oscillator source. - Changing the oscillator source Due to switching to a Power-Saving Mode it may be necessary to change the oscillator source. This can be done May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET within the RTC-ISR. Select the desired oscillator source in OSC.SRC and write the corresponding reload value to the SSR register. Make sure that this will be completed before the next underflow of the SSC which happens to each second and simultaneously loads SSC with the new SSR value and switches the oscillator source. Precaution: Changing the oscillator source may cause a fragmentary clock pulse. This may result in wrong SSC and/ or RTC values and unwanted interrupt or wake pulses. Changing the oscillator source makes it necessary to: 1. Disable all output signals of the Power-Saving Module (POL.OE = WSC.RTC = WSC.P = 0) and disable RTC and WAPI interrupts. 2. Switch to the new oscillator source. 3. Initialize SSC, RTC and POL. 8.4.5. RTC Output Multiplexer All the taps of the second, minute and hour counters are connected to a multiplexer (Table 8-4) and can be selected as output by register RTCC.SEL. The output of this multiplexer can generate an RTC interrupt as well as a wake-up signal. 8.4.6. RTC Interrupt The IR has to be initialized as described above. The RTC has its own interrupt vector, thus further investigation of the interrupt source is not necessary. After an interrupt, the flag WUS.RTC is set. The register WUS.RTC is not necessary for the RTC ISR, and does not have to be handled by the RTC ISR. Precaution: Please be aware that modifying RTC or RTCC may result in addtional negative edges on RTC Out. If no measures are taken, these edges will generate unwanted interrupts. 4. Clear WUS (WUS = 0xFFFF). 5. Enable the output signals again. 8.4.3. Disabling the RTC Module This has to be done by selecting the RC oscillator (OSC.SRC=2) and disabling this source (OSC.RC=0). Selecting ground (OSC.SRC=3) disables the 32 kHz subsystem too, but this should be avoided to be compatible with future extensions. A solution that would not affect the intended interrupts is reading SSC and modifying RTC or RTCC only if sufficient time is available to intercept the unwanted interrupt before the next 1 Hz clock pulse occurs. In this situation, the RTC interrupt may safely be temporarily disabled. 8.4.7. Signal Multiplexer 8.4.4. Access to SSC and RTC SSC and RTC are periodically altered by clock pulses. Even if the 32 kHz subsystem is clocked by the 4 ... 12 MHz oscillator, a CPU access to SSC and RTC can be corrupted by a clock pulse. Because this situation can't be avoided, the SSC or the RTC register have to be read twice. If there is a difference between the two accesses the read has to be repeated. After a write to register RTC it has to be read and compared to the desired value. If there is a difference, write, read and compare have to be repeated. Since the RTC is clocked not faster than in second distance, a read or write access to register RTC can be done in the RTC-ISR. Such an access is safe and guarantees a correct result as long as the RTC-ISR is finished before the next clock alters the RTC. Various internal signals can be switched to SMX_out. The internal signal can be selected via register SMX.MUX. The possible signals are shown in Table 8-8. Only the signals fSS and fS are of general interest. The remaining signals may be used, but are intended for testing purposes. The signal fSS is useful to measure the quartz frequency and calculate the corresponding reload value for the sub-second counter with external equipment. The signal fS is useful for re-adjustment of the sub second counter, with the help of, e.g., an XTAL-driven CAPCOM counter, when driven by the internal RC oscillator. The bypass switch (SMX.BYP) allows to bypass the SSC and directly feed fSS into the second counter. This feature is intended for testing purposes only. Applications normally keep SMX.BYP cleared. 8.5. Operation of Polling Module 8.5.1. Reset The whole logic is cleared by every kind of reset, even wakeup from power-saving mode resets the Polling Module. This means that the logic has to be initialized after every reset. 8.5.2. Initialization and Start The Polling Module needs the RTC Module running, because the Polling Clock fPC is derived from sub-second counter taps, and the Polling Period fPP is derived from subsecond counter taps or second counter taps. See section 8.4. for RTC Module initialization. Micronas The enable input (POL.ENA) and the output (POL.OE) has to be disabled. The port H2.5 has to be configured as normal, out, low for operation as polling output. Select fPC (POL.CLK) and fPP (POL.PER). Enable input and output (POL.ENA, POL.OE) and load the delay counter reload register (POL.DEL) with a non-zero value. May 25, 2004; 6251-606-1PD 69 CDC16xxF-E PRELIMINARY DATA SHEET poll period Poll Clk fpp poll delay wake out 0 3 2 1 0 0 3 strobe Fig. 8-6: Polling Timing 8.5.3. Stop 8.5.4. Restart Disable all inputs and outputs (POL.ENA=0, POL.OE=0). Set POL.ENA and POL.OE to one. Initialize the delay counter reload register (POL.DEL). 8.6. Operation of Port Wake Module WPMx.MOD 2 1 0 delay & wake in (from port) rising & delay & falling 1 & Delay trigger strobe wake in & wake out (from Polling Module) WSC.AST high strobe strobe 1 wake in alt. strobe & low Fig. 8-7: Edge/Level Trigger Logic 8.6.1. Reset Neither the wake-up source register (WUS) nor the WakePort Mode registers (WPMx) are reset to a defined value by any reset source. 8.6.2. Initialization The corresponding ports must be configured as inputs. For every Wake Port which is to generate a wake-up signal, the trigger mode in the WPMx register has to be programmed. For every Wake Port which must not generate a wake-up signal, the trigger mode in the WPMx register has to 70 be disabled. The source of the strobe signal has to be selected with WSC.AST if a level triggered mode must be used. The whole register WUS has to be cleared. 8.6.3. Operation The Port Wake Module can be operated by polling. It can generate an interrupt (IR_WAPI) or a wake-up signal to leave the Power-Saving Mode. To use a level-triggered mode of a Wake Port the RTC Module and the Polling Module have to be configured to provide May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET the necessary Wake Out signal. The signal Wake Out is necessary for a strobe pulse at the falling edge of Wake Out. If no RTC-/Polling module is available or is not to be used, an alternative strobe signal can be used by setting flag WSC.AST to one. As long as WSC.AST is set and the programmed trigger level is applied to the corresponding pin, the flag WUS.WPx is set and can't be reset by the SW. If more than one Wake Port is operated with the alternative strobe signal, WPMx.MOD has to be disabled before WUS.WPx can be cleared. Only clearing WSC.AST during the WUS clearing procedure does not help in this case. Interrupts of other Wake Ports can be lost if the high or low time is too short. The selected strobe signal source is valid for all Wake Ports. Mixing of the strobe signals sources (polling and alternative) is not possible. If only the edge-triggered mode is used, the RTC Module and the Polling Module are not necessary for correct operation of the Port Wake Module. 8.6.4. Wake-up from Power-Saving Mode Following the initialization described above, it is necessary to enable the Port Wake Module as wake-up source by register WSC flag P. After wake-up the reason can be read in register WUS. It should be cleared after reading, as otherwise neither wakeup nor Wake Port interrupt via IR_WAPI is possible. 8.6.5. Wake Port Interrupt Following the initialization described above, the IR has to be initialized. All Wake Ports are directed to an interrupt vector. After an interrupt the source can be read in register WUS. It should be cleared after reading, as otherwise no further Wake Port interrupts via WAPI are possible. Micronas May 25, 2004; 6251-606-1PD 71 CDC16xxF-E PRELIMINARY DATA SHEET 9. Memory Patch Module The Memory Patch Module allows the user to modify up to ten hardwired ROM locations by external means. This function is useful if faulty parts of software or data are detected after the ROM code has been cast into mask ROM. Software loads addresses and the corrected code, e.g., from external non-volatile memory into the respective registers of the module. The module will then replace faulty code upon address match. Single ROM locations are directly replaced. Longer faulty sequences may be repaired by introducing a jump to a new subroutine in RAM (e.g. opcode JSR requires 3 consecutive bytes to be patched). The RAM subroutine then may consist of any number of instructions, ending with a return to the next correct instruction in ROM. Thus it is possible to also include complex software modules. ICs which are derived from the Emulator IC may have less patch cells. In this case the upper patch cells are not available. Features - patching of read data from up to 10 different ROM locations (24-bit physical address) - automatic insertion of 1 CPU wait state for each patched access ADB[23:0] DB[7:0] Write/Compare Enable PA[7:0] Patch Address Register PA[15:8] Patch Data Register PA[23:16] Output Enable PATOE DBP[7:0] PH2 PSEL9...0 Patch Enable Register PMEN Patch Cell 0 1 Sequencer RDY & ROMEN Patch Cells 1...9 RWQ ROMACC Fig. 9-1: Block Diagram 9.1. Principle of operation 9.1.1. General Remarks 9.1.2. Initialization The logic contains ten patch cells (see Fig. 9-1 on page 72), each consisting of a 24-bit compare register (Patch Address Register, PARn), a 24-bit address comparator, a Patch Enable Register (PERn) bit and an 8-bit Patch Data Register (PDR). After reset, as bit PER0.PMEN is reset to 0, all patch cell registers are in write mode and patch operation is disabled. The current address information for a ROM access is fed to a bank of ten patch cells. In case of a match in one patch cell, and provided that the corresponding Patch Enable Register bit is set, a wait cycle for CPU is included by pulling down the RDY input of CPU for one cycle (see Fig. 9-2 on page 73). In the meantime, the module's logic disables the ROM data bus drivers, and instead places the data information from the corresponding Patch Data Register on the data bus. 72 To initialize a patch cell, first set the corresponding PSEL bit in register PER0 or PER1 as a pointer. Then enter the 24-bit address to registers PAR2 (high byte), PAR1 (middle byte) and PAR0 (low byte) and the desired patch code to register PDR. If desired, repeat the above sequence for other patch cells. Only set one PSEL pointer bit at a time in registers PER0 and PER1. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 9.1.3. Patch Operation 9.1.4. Reconfiguration To activate a number of properly initialized patch cells for ROM code patching, set all the corresponding PSEL bits in registers PER1, then PER0, setting bit PER0.PMEN to 1. To reconfigure the Memory Patch Module, first set PER0.PMEN to 0. The module will immediately terminate patch operation. The Memory Patch Module will immediately start comparing the current address with the setting of the enabled patch cells. In case of a match, the ROM data will be replaced by the corresponding patch cell data register setting. Then proceed as described in "Initialization" on page 72. PH2 ADB[23:0] A1 A2 D1 DB[7:0] A2 D2 A3 A3 PD2 D3 PD3 RDY PATOE ROMEN Fig. 9-2: Timing 9.2. Registers PAR0 w Patch Address Register 0 7 6 5 4 3 2 1 0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 1 1 1 1 1 1 1 1 Res Note PAR1 w PAR2 w Patch Address Register 1 Patch Address Register 2 7 6 5 4 3 2 1 0 PA23 PA22 PA21 PA20 PA19 PA18 PA17 PA16 1 1 1 1 1 1 1 1 Res Note PDR 7 6 5 4 3 2 1 0 PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 1 1 1 1 1 1 1 1 Micronas Note w Res Patch Data Register 7 6 5 4 3 2 1 0 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 0 0 0 0 0 0 0 0 May 25, 2004; 6251-606-1PD Note Res 73 CDC16xxF-E PER0 w PRELIMINARY DATA SHEET Patch Enable Register 0 7 6 5 4 3 2 1 0 PSEL6 PSEL5 PSEL4 PSEL3 PSEL2 PSEL1 PSEL0 PMEN 0 0 0 0 0 0 0 0 Res Note PER1 w Note Patch Enable Register 1 7 6 5 4 3 2 1 0 x x x x x PSEL9 PSEL8 PSEL7 x x x x x 0 0 0 Res PA23 to 0 Patch Address Upon occurrence of this address the patch cell replaces ROM data with data from PDR. PD7 to 0 Patch Data Data to replace false ROM data at certain address. PSEL0 to 9 Select Patch Cell w1: select cell for write or enable for patch w0: disable patch cell Before writing compare address or replace data of a patch cell, only one cell must be selected. In compare mode one or more patch cells can be selected. PMEN w1: w0: 74 Patch Mode Enable enable patch mode of all cells enable write mode of all cells May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 10. Interrupt Controller (IR) The Interrupt Controller has 16 input channels. Each input has its own interrupt vector pointing to an interrupt service routine (ISR). One of 15 priority levels can be assigned to each input or the input can be disabled. The Interrupt Controller is connected to the NMI input of the CPU. However, despite the non-maskable interrupt input, it is possible to disable all interrupt sources together in the Interrupt Controller. Features - 16 interrupt inputs. - 16 interrupt vectors. - 15 individual priority levels. - Global/individual disable of interrupts. - Single interrupt service mode. 10.1. Principle of Operation 10.1.1. General Remarks Interrupt requests are served in the order of their programmed priority level. Interrupt requests of the same priority level are served in descending order of interrupt input number. Each of the 16 interrupt inputs clears a flag in the interrupt pending register (IRRET and IRP), which can be read by the user. A pending interrupt enables the output of the corresponding priority register (IRPRI10 to IRPRIFE) which is connected to a parallel priority decoder together with the other priority registers. The decoder outputs the highest priority and its input number to a latch. The latched priority is compared with the top entry of the priority stack. The top entry of the priority stack contains the priority of the currently served interrupt. Lower entries contain interrupts with lower priority whose interrupt service routines were started but interrupted by the higher priority interrupts above. If the latched priority is lower or equal than the top of stack priority, nothing happens. If the latched priority is higher than the top of stack priority, a NMI is sent to the CPU and the latched priority is pushed on the stack. The Interrupt Controller signals an interrupt to the CPU via NMI input . After the current instruction is finished the CPU starts an interrupt sequence. First it puts the program bank register, the program counter high byte, the program counter low byte and the program status register into the stack. Then the CPU writes the vector address low byte (FFFA in 6502 mode, FFEA in 816 mode) to the bus. The Interrupt Controller recognizes this address and stops the CPU by the RDY signal. Now the Interrupt Controller writes the vector address low and high byte of the corresponding interrupt number to the bus and releases the CPU by releasing RDY. The CPU now operates with the new vector of the interrupt service routine. When the Interrupt Controller writes the new vector to the address bus, the interrupt pending flag of this vector is set, indicating that no interrupt is pending. The software must pull the top entry from the priority stack at the end of an interrupt service routine. This happens with the write access to the interrupt return register IRRET. Then the next entry (with lower priority) is visible at top of stack and is compared with the priority latch. The Interrupt Controller and related circuitry is clocked by the CPU clock and participates in CPU FAST and SLOW mode. According to Section 10.3. some of the Interrupt Controller inputs allow selection of a source by HW option (cf. Table 10-3). This configuration has to be done prior to operation. Refer to "HW Options" for setting them. 10.1.3. Initialization After reset, all internal registers are cleared but the Interrupt Controller is active. When an interrupt request arrives, it will be stored in the respective pending register IRP/IRRET. But it will not trigger an interrupt as long as its interrupt priority register IRPRIxy is set to zero. The interrupt sources in peripheral modules have to be properly SW configurated prior to operation. Before enabling individual inputs, make sure that no previously received signal on that input has cleared its pending flag which may trigger the Interrupt Controller. Clear all pending interrupts with the flag IRC.CLEAR to avoid such an effect. 10.1.4. Operation Activation of an interrupt input is done by writing a priority value ranging from 1h to Fh to the respective IRPRIxy register. Upon an interrupt request, pending or fresh, the Interrupt Controller will immediately generate an interrupt. During operation, changes in the priority register setting may be made to obtain varying interrupt servicing strategies. Flags IRC.DAINT, IRC.DINT and IRC.A1INT allow some variation in the Interrupt Controller response behavior. 10.1.5. Inactivation There are two possibilities to disable an interrupt within the Interrupt Controller. Changing the priority of an interrupt input to zero disables this interrupt locally. Interrupts are globally disabled by writing a zero to flag IRC.DINT of register IRC. During the evaluation period (see also Section 10.4.: Interrupt Timing) it is not possible to suppress an interrupt by changing priority. A zero in the flag IRC.DINT of register IRC prevents the Interrupt Controller from pulling the signal NMI low. However, if this flag is set after the falling edge of NMI, the corresponding interrupt cannot be cancelled. 10.1.2. Hardware settings Micronas May 25, 2004; 6251-606-1PD 75 76 May 25, 2004; 6251-606-1PD Q Q Q Q Q Q Clear Request S R S R S R S R S R S R Fig. 10-1: Block Diagram Int-Input 16 Int-Input 15 Int-Input 4 Int-Input 3 Int-Input 2 Int-Input 1 Pending Register 4 4 4 4 16 IRPRIFE IRPRI32 4 4 prio IRPRI10 Priority Registers Parallel Priority Decoder clke 4 input # 4 priority Priority Latch clke 4 Interrupt Vector Table 16 Ctrl clke Priority Stack 15 x 4 A>B pull push B A enable FFFA or FFEA B A A=B Ph2 DMAE PATCH & NMI A0...A15 RDY DMAE IRRET write clke CDC16xxF-E PRELIMINARY DATA SHEET Micronas CDC16xxF-E PRELIMINARY DATA SHEET 10.1.6. Precautions ished before critical data access and no further ISR can interrupt it. 10.1.6.1. Return from Interrupt As it is now possible that an ISR (Interrupt Service Routine) can lengthen the time between the disable interrupt instruction (DI) and the enable interrupt instruction (EI) indefinitely, it is necessary that an ISR first saves registers and enable interrupt flags and then enables interrupts. After interrupt execution enable flags and registers must be restored. This guarantees that other interrupts are not locked out during interrupt execution. The write access to the IRRET must be performed just before the RTI command at the end of the interrupt service routine. After a write access to this location it is guaranteed that the next command (should be RTI) will be processed completely before a new interrupt request is signalled to the CPU. If the RTI command does not immediately follow the write to IRRET, an interrupt with the same priority may be detected before the corresponding RTI is processed. A stack underflow may occur because this may happen several times. Save Registers An interrupt with a higher priority than the one actually served, may interrupt between the write access to IRRET and the belonging RTI command. Now an interrupt request from the interrupted low priority interrupt may occur during service of the high priority interrupt. This one will be served after the RTI command of the high priority interrupt and before the RTI command of the first interrupted low priority interrupt. In this case, the return address and the PSW of the same interrupt are stored twice on the stack. This may happen several times and can cause a problem if the stack size is calculated without sufficient buffer or if the interrupt load is too high, which means that there is no time for the background loop. Save Interrupt Enable Flags Enable Interrupts Execute Interrupt Restore Interrupt Enable Flags Restore Registers 10.1.6.2. Disable Interrupt If an opcode fetch of a disable interrupt instruction (DI) happens one clock cycle after the falling edge of NMI (see Section 10.4.1. on page 81), it is possible, that an interrupt service routine (ISR) is active, though the corresponding interrupt is disabled. That is why after disabling an interrupt, and before accessing critical data, at least one uncritical instruction is necessary. This guarantees that the ISR is fin- Write to IRRET RTI 10.2. Registers IRC w1: Cancel this feature. w0: Disable Interrupt Controller after interrupt. This is the enable flag for the flag A1INT function. Interrupt Control Register 7 6 5 4 3 2 1 0 r x x x x DAINT DINT x x w x x x RESET DAINT DINT A1INT CLEAR x 1 1 x x Res RESET w1: w0: Reset No action. Momentary reset of the Interrupt Controller, all internal registers are cleared. The reset of the Interrupt Controller happens with writing zero to this Flag. It is not necessary to write a one to finish the reset. The standard Interrupt Controller function is performed by setting all flags to one. A hardware reset of the Interrupt Controller is performed by setting RESET low and the other flags to high. DAINT r1: r0: Micronas DINT r1: r0: w1: w0: Disable interrupt Interrupts are enabled. All interrupts are disabled. Enable interrupts according to priority setting. Disable all interrupts. A1INT Allow one interrupt w1: No action. w0: Serve one interrupt. This is a momentary signal. With DAINT = 0, only one interrupt (with the highest priority) will be served. The Flags DAINT and A1INT must be considered in common. They provide the possibility to serve interrupts one by one, only when the main program has enough time (see Table 10-1 on page 78). CLEAR w1: w0: Clear all requests No action. Momentarily clears all interrupt requests. Disable after interrupt Don't disable after interrupt. Disable Interrupt Controller after interrupt. May 25, 2004; 6251-606-1PD 77 CDC16xxF-E PRELIMINARY DATA SHEET IRPRI54 Table 10-1: Single Interrupt Service 7 DAINT A1INT Resulting function 0 1 Disable after current interrupt. 0 0 Serve one interrupt request. 1 x Normal interrupt mode. Interrupt Priority, Inputs 4 and 5 6 r/w 0 0 w 6 5 4 3 2 1 IRE 0 0 0 0 0 0 0 7 Res Enabling interrupts using this register take effect not before the execution of the command, following the write access to IRE. IRPRIBA 7 Interrupt Return Register 6 5 4 3 2 1 0 IPF7 IPF6 IPF5 IPF4 IPF3 IPF2 IPF1 IPF0 1 1 1 1 1 7 Res 6 A write access to this memory location signals to the Interrupt Controller that the current request has been served. 7 r/w 5 3 2 PRIO1 0 0 7 0 0 0 0 Res 3 2 1 0 0 0 0 0 0 Res 0 0 0 4 3 2 0 0 0 0 0 0 Res Interrupt Priority, Inputs 10 and 11 6 5 0 4 3 2 1 0 0 0 PRIO10 0 0 0 0 Res Interrupt Priority, Inputs 12 and 13 6 5 0 4 3 2 1 0 0 0 PRIO12 0 IRPRIFE 0 0 0 Res Interrupt Priority, Inputs 14 and 15 6 r/w 5 4 3 2 PRIO15 0 0 PRIO8 PRIO13 7 1 0 1 0 0 0 PRIO14 0 0 0 0 Res Res Interrupt Priority, Inputs 2 and 3 6 r/w 5 4 3 2 PRIO3 0 1 PRIO0 0 IRPRI32 78 4 0 PRIOn Priority of input number n r: Priority of the corresponding interrupt input. w: Priority of the corresponding interrupt input. Priority zero prevents the Interrupt Controller from being triggered, but the pending register is not affected. All incoming Interrupt Priority, Inputs 0 and 1 6 5 0 r/w 0 IPF0 to 7 Interrupt Pending Flag of Input 0 to 7 r1: No interrupt is pending. r0: Interrupt is pending. w: Current request is finished. For interrupt pending flags 8 to 15, please refer to the description of register IRP. IRPRI10 0 IRPRIDC A write access signals to the Interrupt Controller that the current request has been served 1 4 PRIO11 0 7 1 0 Interrupt Priority, Inputs 8 and 9 r/w 1 0 PRIO9 0 w 0 PRIO6 0 r/w A write access to this memory location enables interrupts according to priority setting (same effect as setting IRC.DINT). r 5 IRPRI98 Enable Interrupts IRRET 0 PRIO7 0 1 0 A write access enables interrupts according to priority setting (same effect as setting IRC.DINT) 0 2 Interrupt Priority, Inputs 6 and 7 6 r/w 7 3 PRIO4 0 IRPRI76 Interrupts Enable Register 4 PRIO5 7 IRE 5 0 1 0 0 0 PRIO2 0 0 0 0 Res May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET requests are stored in the pending registers. Of two inputs with the same PRIO setting, the input with the higher number has priority (see Table 10-2 on page 79). Table 10-2: PRIOn usage IRP r PRIOn resulting function 0h Interrupt input is disabled 1h Interrupt input is enabled with lowest priority : : Fh Interrupt input is enabled with highest priority Interrupt Pending Register 7 6 5 4 3 2 1 0 IPF15 IPF14 IPF13 IPF12 IPF11 IPF10 IPF9 IPF8 1 1 1 1 1 1 1 1 Res IPF8 to 15 Interrupt Pending Flag of Input 8 to 15 r1: No interrupt is pending. r0: Interrupt is pending. For interrupt pending flags 0 to 7, please refer to description of register IRRET. 10.3. Interrupt Assignment While most interrupt assignments are hard-wired, some are configured via HW option (see Fig. 10-3 on page 81). Table 10-4: INT-MUX 1 = HW Option addr. FFC0H Table 10-3: Interrupt assignment bit 1 bit 0 selects 0 0 CC0 COMP 0 1 Timer 2 1 0 CAN 2 1 1 Timer 1 Interrupt Input Interrupt Vector Address Interrupt Source HW Option 0 00FFE2-E3 INT-MUX 7 FFC1h 1 00FFE0-E1 INT-MUX 8 FFC1h 2 00FFDE-DF Timer 0 3 00FFDC-DD PINT0 4 00FFDA-DB PINT1 5 00FFD8-D9 INT-MUX 1 FFC0h bit 3 bit 2 selects 6 00FFD6-D7 INT-MUX 2 FFC0h 0 0 UART 2 7 00FFD4-D5 INT-MUX 3 FFC0h 0 1 P06 COMP 8 00FFD2-D3 CC2OR 1 0 SPI 0 9 00FFD0-D1 CAN 0 1 1 Timer 1 10 00FFCE-CF INT-MUX 9 11 00FFCC-CD UART 0 TX/RX 12 00FFCA-CB RESET/ALARM 13 00FFC8-C9 INT-MUX 4 FFC0h bit 5 bit 4 14 00FFC6-C7 INT-MUX 5 FFC1h 0 0 PINT3-IN 15 00FFC4-C5 INT-MUX 6 FFC1h 0 1 SPI 1 1 0 UART 1 1 1 CC1 COMP Micronas Table 10-5: INT-MUX 2 = HW Option addr. FFC0H FFC2h Table 10-6: INT-MUX 3 = HW Option addr. FFC0H May 25, 2004; 6251-606-1PD selects 79 CDC16xxF-E PRELIMINARY DATA SHEET Table 10-7: INT-MUX 4 = HW Option addr. FFC0H Table 10-11: INT-MUX 8 = HW Option addr. FFC1H bit 7 bit 6 selects bit 7 bit 6 selects 0 0 CAN 2 0 0 CC1OR 0 1 SPI 0 0 1 PINT2-IN 1 0 DMA 1 0 IR-RTC 1 1 PINT3-IN 1 1 IR-WAPI Table 10-8: INT-MUX 5 = HW Option addr. FFC1H Table 10-12: INT-MUX 9= HW Option addr. FFC2H bit 1 bit 0 selects bit 1 bit 0 selects 0 0 Timer 2 0 0 CAN 1 0 1 UART 1 0 1 UART 1 1 0 SPI 1 1 0 IR-RTC 1 1 DMA 1 1 IR-WAPI 10.3.1. Interrupt Multiplexer Table 10-9: INT-MUX 6= HW Option addr. FFC1H bit 3 bit 2 selects 0 0 Timer 2 0 1 DIGITbus 1 0 UART 2 1 1 PINT2-IN Ten interrupt inputs are directly connected to the respective module's interrupt output. Six interrupt inputs, 4 to 6 and 13 to 15, allow source selection via multiplexers. The multiplexers are configured by HW Option. Please refer to section HW Options for details. Table 10-10: INT-MUX 7 = HW Option addr. FFC1H 80 bit 5 bit 4 selects 0 0 CC0OR 0 1 UART 1 1 0 IR-RTC 1 1 IR-WAPI May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Interrupt sources of peripheral modules 16 Interrupt inputs Mux 1 Mux 2 Interrupt Controller Mux 3 Assignment is implementation specific Mux 4 Mux 5 Assignment is implementation specific Mux 6 3 Mux 7 Mux 8 Mux 9 Programming of multiplexer in HW Option field Fig. 10-3: Interrupt Assignment and Multiplexer 10.4. Interrupt Timing 10.4.1. Interrupt Response Time The interrupt response time is calculated from the interrupt event up to the first interrupt vector on the address bus. After an interrupt event, the Interrupt Controller starts evaluation with the first falling edge of Phi2. Evaluation requires one clock cycle until the Interrupt Controller pulls the signal NMI low. Micronas After the falling edge of NMI the CPU finishes the actual command. If the falling edge of NMI occurs one clock cycle before an opcode fetch, the following command will be finished too. Then PC and status will be saved on stack before the low byte of the interrupt vector is written to the address bus. May 25, 2004; 6251-606-1PD 81 82 May 25, 2004; 6251-606-1PD Fig. 10-4: Timing Diagram DMAE Interrupts enabled Clear Request RDY A0...A15 NMI Interrupt Request Ph2 Interrupt FFFA or FFEA 1) DMA Access Vector first Byte Finish actual command and save status. (Save status = 5 clocks (+ 1 clock if in Native Mode)). Opcode ISR FFEA in 816 mode 1) FFFA in 6502 mode Second Byte CDC16xxF-E PRELIMINARY DATA SHEET Micronas CDC16xxF-E PRELIMINARY DATA SHEET 10.5. Port Interrupt Module Port interrupts are the interface of the Interrupt Controller to the external world. Four U-Port pins are connected to the module via their special input lines. Port interrupt 0 and 1 can scale down the interrupt load by prescalers. Port interrupt 2 and 3 share the interrupt input with signals from other sources. HW Option programmable multiplexers define which signal is actually connected to the Interrupt Controller. U5.7 PINT0-OUT SO IRPP.P0INT4 0 PINT0-IN U6.0 SI 1/4 PINT0 Interrupt Source 1 U6.6 PINT1-OUT SO IRPP.P1INT32 0 PINT1-IN U6.1 U6.2 PINT2-IN U5.6 PINT3-IN SI 1/32 PINT1 Interrupt Source 1 IRPM0 HW Option SI Mux6 HW Option HW Option 0 SI Mux4 1 U5.7 PINT3-IN INT-MUX 6 Interrupt Source INT-MUX 4 Interrupt Source HW Option SI Mux3 INT-MUX 3 Interrupt Source Fig. 10-5: Port Interrupts The user can define the trigger mode for each port interrupt by the interrupt port mode register. The Port interrupt prescaler can be switched by the interrupt port prescaler register. The pulse duty factor of the prescaler output is 50%. The Trigger Mode defines on which edge of the interrupt source signal the Interrupt Controller is triggered. The triggering of the Interrupt Controller is shown in Fig. 10-6 and Fig. 10-7 for port prescaler active (P1INT32 or P0INT4 = 1). Table 10-13: Module-specific settings Module Name HW Options Item Initialization Address PINT0 PINT1 Item Setting PINT0-IN U6.0 special in PINT0-OUT U5.7 special out PINT1-IN U6.1 special in PINT1-OUT U6.6 special out PINT2 Interrupt multiplexer 6 FFC1h PINT2-IN U6.2 special in PINT3 Input pin selection FFC2h PINT3-IN U5.6 or U5.7 special in Interrupt multiplexer 4 FFC0h Interrupt multiplexer 3 FFC0h Micronas May 25, 2004; 6251-606-1PD 83 CDC16xxF-E PRELIMINARY DATA SHEET Table 10-14: PITn usage IRPM0 7 w Interrupt Port Mode Register 0 6 5 PIT3 0 4 3 PIT2 0 0 2 1 PIT1 0 0 0 PIT0 0 0 0 Res PITn Port interrupt trigger number n This field defines the trigger behavior of the associated port interrupt (Table 10-14). IRPP w Interrupt Port Prescaler Register 7 6 5 4 3 2 x x x x x x 1 0 P1INT32 P0INT4 0 0 Res PITn Trigger Mode 0h Interrupt source is disabled 1h Rising edge 2h Falling edge 3h Rising and falling edges P1INT32 w1: w0: Port 1 interrupt prescaler Indirect mode, 1:32 prescaler Direct mode, bypass prescaler P0INT4 w1: w0: Port 0 interrupt prescaler Indirect mode, 1:4 prescaler Direct mode, bypass prescaler Port U6.0 1 2 3 4 1 2 3 4 1 2 3 4 1/4 prescaler output Independent of trigger mode Interrupt (low active) Falling edge Interrupt (low active) Rising edge Interrupt (low active) Falling and rising edge trigger mode Fig. 10-6: Interrupt Timing (1/4 Prescaler On) Port U6.1 32 1 2 15 16 17 18 31 32 1/32 prescaler output Independent of trigger mode Interrupt (low active) Falling edge trigger Interrupt (low active) Rising edge trigger Interrupt (low active) Falling and rising edge trigger mode Fig. 10-7: Interrupt Timing (1/32 Prescaler On) 84 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 11. Ports Three kinds of ports exist. The analog input port, Port 0, serves as input for the analog-to-digital converter. The universal ports, U1 to U7, serve as digital I/O and can be config- ured as LCD drivers. The high current ports, H0 to H3, serve as digital I/O and can be configured as stepper motor drivers. 11.1. Analog Input Port 0 The 9-bit-wide analog input port is called Port 0. Five of these analog input pins can additionally be configured as digital inputs. One pin is connected to a comparator, which can be selected as interrupt source. P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 P0.8 P0.9 3 2 Features - 9-bit analog input multiplexer. - 5 bits additionally usable as digital input ports. 1 4 5 To A/D converter 6 7 8 9 To Alarm Comparator SR1.P0DIN 7 rd x 6 5 4 3 2 1 x 0 x P0PIN Fig. 11-1: Port 0 with Input Multiplexer and Undervoltage Alarm Comparator The nine analog input lines are connected to a multiplexer. The output of this multiplexer is connected to a 10-bit A/D converter. P1 to P5 r1: r0: Port 0 Digital Input 1 to 5 High level at input pin. Low level at input pin. Port P0.6 is input of an undervoltage alarm comparator which is described in the A/D converter section. Five of the analog input pins (P0.1 to P0.5) may be used as digital inputs if enabled by setting the flag P0DIN in the Standby Register SR1. The digital value of the input pins can be read in the Port 0 Pin register P0PIN. These ports should either be used as analog or digital inputs. P0PIN r Port 0 Pin Register 7 6 5 4 3 2 1 0 x x P5 P4 P3 P2 P1 x x x x x x x x x Micronas Res May 25, 2004; 6251-606-1PD 85 CDC16xxF-E PRELIMINARY DATA SHEET 11.2. Universal Ports U1 to U7 There are 52 Universal Port pins. The universal ports U1 to U6 are 8 bits wide. The universal port U7 is 4 bits wide. Features - SW selectable as digital I/O or LCD driver. - LCD mode: 1:4 multiplex, 5 V supply. - I/O mode: Tristate output, current limited. - Individually programmable to deliver constant current (slew rate). - Schmitt hysteresis input buffer. UxM.PMODE Special In VDD UxD read 0 DBy 1 VSS slow/fast UVDD 1 Special Out 1 Ux.y 0 0 Q D DATA UVSS OR Q D N/S Q D TRI UxD write UxSEG.Sy UxSEG.Ty From LCD module x: Port number 1 to 7 y: Port pin number 0 to 7 Fig. 11-2: Universal Port Circuit Diagram Universal ports can be operated in different modes: Table 11-1: Universal Ports Operating Modes Modes Port Mode LCD Mode 86 Function Normal Input and Special Input The SW uses the ports as digital input. Normal Output The SW uses the ports as latched digital tristate output. Special Output The output signals of specific hardware modules are directly port output source. The port input is additionally connected to specific hardware modules. The port bit serves as backplane/segment driver for an LC Display. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET The Universal Port bits can be switched to LCD or Port mode in groups of two. The flag PMODE must be cleared to use port pins in LCD mode. If PMODE is set, they serve as I/O ports. The output sequence timing on backplane and segment output ports in LCD Mode is controlled by the LCD module. Please refer to section LCD Module for information about operation of this module. In both LCD and Port mode, the Port Slow mode may be defined for each individual Universal port bit. It reduces the current drive capability of the output stage. As generation of the backplane port output sequence is fully done by the LCD module, no segment setting is necessary for these ports. After reset, all Universal Ports are in port, tristate condition. Port bits in LCD mode will always read as logical 0 as the port input buffer is turned off. 11.2.1. Port Mode Each port bit can be individually configured to several port modes. The output driver of each pin can be disabled (tristated) by setting the flag UxSEG.Ty. Set the S flag to select the source of the output value. For Port mode, the UxM registers have to be set for mode selection, the UxSEG registers have to be properly set for individual port bit configuration and the UxD registers serve as I/O registers. Table 11-2 shows configurations of flags if the corresponding flag PMODE is true (Port mode) 11.2.3. Port Slow Mode The output drivers of all port pins together can be configured to operate in Fast or Slow mode by the Port Slow mode flag PSLW in register SR1. All U-Ports exhibit two operating regions in the DC output characteristic (see Fig. 11-3). Near zero output voltage the internal driver transistors operate non-limited, to offer a low on-resistance. With larger output voltages, however, a limit is imposed on the output current. This measure helps to fight supply current transients and related EMI noise during port switching. Table 11-2: Port Mode Register Settings Io Mode S T D Function Normal Input x 1 x READ of register UxD returns port pin input levels to data bus. Normal Output 0 0 Data WRITE to register UxD changes level of port pin output drivers. READ of register UxD returns the UxD register setting to the data bus. Special Input x x x Port pin input level is presented to special hardware. Special Output 1 0 x Special hardware drives port pin. READ of register UxD returns port pin input levels to data bus. In Port Mode, Special Input mode is always active. This allows manipulating the input signal to the special hardware through Normal Output operations by software. As the Special Output mode allows reading the pin levels, the output state of the special hardware may be read by the CPU. 11.2.2. LCD Mode For LCD Mode, the UxM registers have to be cleared for mode selection and the UxSEG registers serve as segment output data registers. Micronas Nonlimited region Limited region Ishf Port Fast Mode Ishs Port Slow Mode 0 1V 2V 3V 4V 5V Vol Fig. 11-3: Typical U-Port pull-down DC output characteristic (pull-up characteristic is complementary). In this limited operating region, Port Fast mode and Port Slow mode select two different current limits Ishf and Ishs. Port Slow mode reduces the output current to a value where the output may even be shorted continuously to either supply rail. Thus, wired or-configurations can be put into practice. The external load resistance should be greater than 5 kOhms in Port Slow mode. Please note that in Port Normal Output mode, a READ of register UxD returns the UxD register setting, not the pin levels. May 25, 2004; 6251-606-1PD 87 CDC16xxF-E PRELIMINARY DATA SHEET With PSLW = 0 all ports are in Fast Mode. Only port bits that are enabled via HW option will switch to Port Slow Mode with PSLW = 1. A port pin is in Fast Mode all the time if a zero is programmed to the appropriate HW option bit. It is not possible to switch this pin to Slow Mode. If a one is programmed, the pin can be toggled between Fast and Slow Mode by the flag PSLW. Please refer to section HW Options for information on port/option assignment. It is recommended to place all LCD ports in the Port Slow mode. 11.3. Universal Port Registers Universal Port Data Registers UxD contain input/output data of the corresponding port. The "x" in UxD means the number of the port. Thus UxD stands for U1D to U7D. Remember that port U7 is only 4 bits wide. For this reason not all of the described registers and flags are available for U7. UxSEG32 w Universal Port x Segment Register of Ux.3 and Ux.2 7 6 5 4 3 2 1 0 x S3 T3 x x S2 T2 x Port w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD UxD r/w Universal Port x Data Register 0 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 0 UxM32 Universal Port Segment registers UxSEG together with the Universal Port Mode registers UxM are used to configure the appropriate ports in Port Mode. In LCD Mode the registers UxSEG contain the data for two segments each. For instance, register U2SEG76 and U2M76 control port U2, bits 7 and 6. w w 7 6 5 4 3 2 1 0 x S1 T1 x x S0 T0 x 1 0 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Universal Port x Segment Register of Ux.5 and Ux.4 7 6 5 4 3 2 1 0 x S5 T5 x x S4 T4 x 0 0 UxM54 Universal Port x Segment Register of Ux.1 and Ux.0 0 Port w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD Registers U1SEG10, U1SEG32, U1M10, U1M32 and U3SEG32 differ from the corresponding control registers of other ports in LCD mode. Please refer to the special description of these registers at the end of this section. UxSEG10 0 7 UxSEG54 w 0 Universal Port x Mode Register of Ux.3 and Ux.2 Res D0 to 7 Universal Port Data Input/Output r: Read pin level resp. data latch. w: Write data to data latch. To use a port pin as software output, the appropriate driver must be activated and the S flag must be programmed to Normal Mode. 1 w 1 0 0 0 1 0 Res Universal Port x Mode Register of Ux.5 and Ux.4 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Port w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 0 UxM10 1 0 0 0 1 0 Res Universal Port x Mode Register of Ux.1 and Ux.0 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 UxSEG76 w 7 6 5 4 3 2 1 0 x S7 T7 x x S6 T6 x 88 Port w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 w Universal Port x Segment Register of Ux.7 and Ux.6 0 1 0 0 0 1 0 Res Res May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET UxM76 w Universal Port x Mode Register of Ux.7 and Ux.6 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 U1SEG10 7 w Res S0 to S7 Normal/Special Mode Flag 0 to 7 w1: Special Mode. Special hardware drives pin. w0: Normal Mode. Data latch drives pin. The corresponding Port Mode flag PMODE must be true to make this flag valid. The S flag defines from which source the port pin is driven if its output driver is active (T = 0). T0 to T7 Tristate Flag 0 to 7 w1: Output driver is tristate w0: Output driver is active The corresponding Port Mode flag PMODE must be true to make this flag valid. SEGh.0 to .3 LCD Segment Driver High, Bits 0 to 3 SEGl.0 to .3 LCD Segment Driver Low, Bits 0 to 3 In LCD Mode each port pin is controlled by a field of four LCD Segment bits. Each segment register UxSEG contains two fields of segment data, each four bit wide. "h" stands for the high, "l" for the low pin number. For instance, U2SEG76.SEG7.3 to U2SEG76.SEG7.0 control LCD segments driven by port U2.7. Please refer to Pin Assignment and Description for segment/ pin number assignment. Information about the usage of the LCD Segment field will be found at the functional description of the LCD Module. x Universal Port 1Segment Register of U1.1 and U1.0 6 5 S1 T1 4 x 3 x 2 1 0 S0 T0 x w LCDSLV Port LCD 0 0 1 0 0 0 1 0 Res LCDSLV LCD Module is Slave Select the mode of the LCD module. w1: LCD module is slave. w0: LCD module is master. A write access to this memory location simultaneously loads all segment information of all universal ports in LCD mode into the display. The flag LCDSLV is available only in LCD mode. This flag is not available in other universal port registers. U1SEG32 w Universal Port 1Segment Register of U1.3 and U1.2 7 6 5 4 3 2 1 0 x S3 T3 x x S2 T2 x Port 0 0 1 0 0 0 1 0 Res 11.3.2. Special Register Layout of Universal Port 3.2 U3.2, in Port Special Output mode, provides the DIGITbus connection. For this purpose it can be switched into a Double Pull-down Mode (DPM) by setting U3SEG32.DPM2, where PMODE Port Mode Flag Select the mode of the corresponding port pins. w1: The two port pins are in Port mode. w0: The two port pins are in LCD mode. 11.3.1. Special Register Layout of Universal Port 1 Universal Port 1 pins U1.0 to U1.3 provide backplane signals in LCD Mode. To operate any ports as LCD segment driver it is necessary to switch these ports to LCD mode. All four pins will be switched together (not in groups by two) to LCD Mode by clearing the flag PMODE in register U1M30. - the short circuit current Ishs is doubled (with Port Slow Mode enabled for U3.2 by HW Option, and SR1.PSLW set to 1) - the output configuration is pull-down, not the standard push-pull. By these means, this port may be configured to operate as connection to the wired-or, single-wire DIGITbus with external pull-up resistor. Thus, U1M30 replaces U1M10 and U1M32. U3SEG32 U1M30 w Universal Port 1 Mode Register of U1.3 to U1.0 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 w 7 6 5 4 3 2 1 0 x S3 T3 x DPM2 S2 T2 x Port w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 Res As backplane ports U1.0 to U1.3 require no segment data setting, SEG bits are not available in register U1SEG10 and U1SEG32. Micronas Universal Port 3 Segment Register of U3.3 and U3.2 DPM w1: w0: May 25, 2004; 6251-606-1PD 0 1 0 0 0 1 0 Res Double Pull-Down Mode Output driver is pull-down, Ishs (Port Slow mode) doubled. Standard. 89 CDC16xxF-E PRELIMINARY DATA SHEET 11.4. High Current Ports H0.0 to H3.5 Features The High Current Ports 0, 1, 2 and 3 are used to drive coils of stepper motors. Each port is 6 bits wide. They are similar to universal ports, but as the name says, they can drive higher currents. H-Ports can be operated via software like Universal Ports (Port Mode). Their Special Out connections are connected with the stepper motor module, or with the PWM output. - Tristate output. - 30 mA output current. - Schmitt hysteresis input buffers. - Reduced slew rate of current and voltage for driving resistive, capacitive or inductive loads. HxD read VDD DBy VSS Special In HVDD 1 Hx.y Special Out High 0 Q D DATA HxD write HVSS Q D N/S HxNS.Sy Q D TRI HxTRI.Ty x: Port number 0 to 3 y: Port pin number 0 to 5 Fig. 11-4: High Current Port Circuit Diagram The H-Ports H0 and H1 are supplied by the power supply pins HVDD1 and HVSS1. The H-Ports H2 and H3 are supplied by the power supply pins HVDD2 and HVSS2. HxTRI.Ty is used to switch the output driver on and off, and HxNS.S defines the mode of each port pin. Table 11-3 shows the various selectable modes. Table 11-3: Register Settings Mode S T D Function Special Input x x x Port pin input level is presented to special hardware. Special Output 1 0 x Special hardware drives port pin. Table 11-3: Register Settings Mode S T D Function Normal Input x 1 x READ of register HxD returns port pin input levels to data bus. Normal Output 0 0 Data WRITE to HxD changes level of output, READ of HxD reads pin level 90 READ of register HxD returns port pin input levels to data bus. The Special Outputs of high current ports are connected to the Stepper Motor module or some PWMs. Please refer to Pin Assignment and Description for information on assignment of PWMs to H-Port pins. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Twenty of the twenty-four high-current ports are connected to the stepper motor control module. Two high-current ports, together with a coil, form an H-Bridge. Two H-Bridges are necessary to operate a stepper motor. The twenty stepper motor outputs can thus drive five stepper motors. The N-channel and the P-channel transistor of the output driver are controlled separately. Thus crossover currents are eliminated. The output levels of the ports during and after reset are low, to avoid floating coils. 11.5. High Current Port Registers High Current Port Data registers are used to input/output digital values. The "x" means the number of the port. Thus HxD stands for H0D, H1D, H2D or H3D. HxD r/w High Current Port x Data Register 7 6 5 4 3 2 1 0 x x D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res D0 to 5 H-Port Data Input/Output r: Read pin level . w: Write data to data latch. To use a port pin as output, the appropriate driver must be activated and its S flag must be set to normal mode (S = 0). The High Current Tristate and Normal/Special registers (HxTRI and HxNS) are used to configure the corresponding port. HxTRI w High Current Port x Tristate Register 7 6 5 4 3 2 1 0 x x T5 T4 T3 T2 T1 T0 0 0 0 0 0 0 0 0 HxNS w Res High Current Port x Normal/Special Register 7 6 5 4 3 2 1 0 x x S5 S4 S3 S2 S1 S0 0 0 0 0 0 0 0 0 Res S0 to S5 Normal/Special Mode Flag 0 to 5 w1: Special Mode. Special hardware drives pin. w0: Normal Mode. Data latch drives pin. The S flag defines from which source the port pin is driven if its output driver is active (T = 0). T0 to T5 w1: w0: Micronas Tristate Flag 0 to 5 Output driver is tristate Output driver is active May 25, 2004; 6251-606-1PD 91 CDC16xxF-E PRELIMINARY DATA SHEET 12. A/D Converter (ADC) Features This 10-bit analog-to-digital converter allows the conversion of an analog voltage in the range of 0 to URef, into a digital value. A multiplexer connects the ADC to one of 9 analog input ports. A sample and hold circuit holds the analog voltage during conversion. The duration of the sampling time is programmable. The A/D conversion is done by a charge balance A/D converter using successive approximation. - A/D converter with 10-bit resolution. - Successive approximation, charge balance type. - Input multiplexer with 9 analog channels. - Sample and hold circuit. - 4/8/16/32 s conversion selectable for optimum throughput/accuracy balance. - 2.5 V to 5 V external reference input. - Zero standby current, 300 A active current. SR1.ADC 0 AVDD 1 VREF P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 P0.8 P0.9 AVSS 4 3 2 1 4 A 5 S&H 6 10 D 7 8 9 2 AD1 AD0 TSAMP CHANNEL x r 7 6 9 5 8 4 7 3 6 2 5 1 4 0 3 7 2 6 x 5 x 4 w x 3 r 2 1 0 1 0 EOC CMPO CMPO interrupt source Fig. 12-1: Block Diagram 92 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 12.1. Operation 12.1.1. ADC After reset, the module is off (zero standby current). The module is enabled by the flag SR1.ADC. The user must be sure that the flag End of Conversion (EOC) in register AD0 is true, before he starts to operate the module. A write access to register AD0 indicating sample time and channel number starts the conversion. The flag EOC signals the end of conversion. The 10-bit result is stored in the registers AD1 (8 MSB) and AD0. The conversion rate depends on the software, the oscillator frequency, and the programmed sample time. The module may be operated in CPU FAST or SLOW mode. 12.1.1.1. Conversion Law The result of A/D conversion is described by the following formula: U In DV = INT -------------- 1LSB where U Ref 1LSB = ----------1024 DV = Digital Value; INT = Integer part of the result The voltage on the reference input pin VREF can be set to any level in the range from 2.56 V to AVDD. 12.1.1.2. Measurement Errors The result of the conversion mirrors the voltage potential of the sampling capacitance (typically 15 pF) at the end of the sampling time. This capacitance has to be charged by the source through the source impedance within the sampling time period. To avoid measurement errors, system design has to make sure that at the end of the sampling period, the potential error on the sampling capacitance is less than 0.1 LSB. Measurement errors can occur, when the voltage of high impedance sources has to be measured: - To reduce these errors, the sampling time may be increased by programming the field TSAMP in register AD1. - In cases where high impedance sources are only rarely sampled, a 100 nF capacitor from the input to AVSS is a sufficient measure to ensure that the potential on the sampling capacitance reaches the full source potential, even with the shortest sampling time. - In some high impedance applications a charge pumping effect may noticeably influence the measurement result: Charge pumping from a high potential to a low potential source will occur when such two sources are measured alternatingly. It results in a DC current that appears as flowing from the high potential source through the IC into the low potential source. This current is explained by the fact that during the sampling periods the high potential source always up-charges the sampling capacitance while the low potential source always discharges it. DV 3FF 3FE 3FD 12.1.2. P0.6 Comparator In addition to the A/D converter the module contains a comparator. The level on port P0.6 is compared to AVDD/2. The state of the comparator output can be read at flag CMPO in register AD0. 03 02 01 00 1 2 3 1021 1023 UIn [LSB] Fig. 12-2: Characteristic Curve The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. The CMPO interrupt source is gated with an internal clock. This is the reason why interrupts are generated as long as the level at P0.6 is lower than the internal reference. 12.2. Registers A write access to register AD0 starts the A/D conversion of the written channel number and sampling duration. The flag EOC signals the end of conversion. The result is stored in register AD1 (bit 9 to 2) and in register AD0 (bit 1 and 0). Micronas May 25, 2004; 6251-606-1PD 93 CDC16xxF-E AD0 r reset, CHANNEL is set to zero. No channel is selected in this case. ADC Register 0 7 6 5 4 3 2 1 0 EOC CMPO x x x x AN1 AN0 w TSAMP 0 Table 12-2: ADC Input Multiplexer CHANNEL 0 AD1 r PRELIMINARY DATA SHEET x x 0 0 0 0 Res ADC Register 1 7 6 5 4 3 2 1 0 AN9 AN8 AN7 AN6 AN5 AN4 AN3 AN2 EOC End of Conversion r1: End of conversion r0: Busy EOC is reset by a write access to the register AD0. EOC will be set after the module has been enabled by setting SR1.ADC. Wait until EOC is set before starting the first conversion. CMPO Comparator Output r1: P0.6 is lower than reference. r0: P0.6 is higher than reference. Zero means that the voltage at P0.6 is higher than the comparator reference voltage. CHANNEL Port Pin 1H P0.1 2H P0.2 3H P0.3 4H P0.4 5H P0.5 6H P0.6 7H P0.7 8H P0.8 9H P0.9 AN 9 to 0 Analog Value Bit 9 to 0 The 10-bit analog value is in the range of 0 to 1023. The 8 MSB can be read from register AD1. The two LSB can be read from register AD0. The result is available until a new conversion is started. TSAMP Sampling Time TSAMP adjusts the sample time and the conversion time. The total conversion time is 20 clock cycles longer than the sample time. Table 12-1: Sampling Time Adjustment TSAMP tSample tConversion 0H 20 TOSC 40 TOSC 1H 60 TOSC 80 TOSC 2H 140 TOSC 160 TOSC 3H 300 TOSC 320 TOSC Sampling starts one clock cycle after completion of the write access to AD0. CHANNEL Channel of Input Multiplexer CHANNEL selects from which pin of port P0 the conversion is done. The MSB of CHANNEL is bit 3. No port pin is connected to the ADC, if values are selected which are not recommended by Table 12-2. In this case the result is not defined because the input of the A/D converter is open. After 94 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 13. Timers (TIMER) Three general-purpose timers are implemented. T0 is a 16bit timer, T1 and T2 are 8-bit timers. 13.1. Timer T0 Timer T0 is a 16-bit auto-reload down counter. It serves to deliver a timing reference signal to the IR, to output a frequency signal or to produce time stamps. Features - 16-bit auto-reload counter - Time value readable - Interrupt source output - Frequency output w HW Option TIM0 Reload-Reg. 1/2 tclk clk tclk 16 r clk T0 Interrupt Source 16 bit Auto-reload Down counter TIM0 & underflow 1/2 T0-OUT res Fig. 13-1: Timer T0 Block Diagram 13.1.1. Principle of Operation Controller" for the actually selectable sources and how to select them. 13.1.1.1. General Remarks The state of the down-counter is readable by reading the 16bit register TIM0, low byte first. Upon reading the low byte, the high byte is saved to a temporary latch, which is then accessed during the subsequent high byte read. Thus, for time stamp applications, read consistency between low and high byte is guaranteed. The timer's 16-bit down-counter is clocked by the input clock and counts down. Falling below zero, it generates an output pulse (underflow) to get reloaded with the value in its reload register which is counted down subsequently. T0 is not affected by CPU SLOW mode. 13.1.1.3. Precautions 13.1.1.2. Operation The clock input frequency can be set via HW option (see Table 13-1 on page 96). Prior to entering active mode, the U-Ports assigned to function as T0-OUT outputs have to be properly SW initialized (Table 13-1). The ports have to be configured Special Out. Refer to "Ports" for details. T0 is always active (no standby mode). After reset, the timer starts counting with reload value FFFFh generating a maximum period output signal. 16-bit CPU commands do not generally keep to a certain order in addressing high and low bytes of a register. Make sure that the command used performs reading a 16-bit value low byte first and writing high byte first. In case of uncertainty use 8-bit commands. A load with a new value within a time period of < tclk/2 before a scheduled Interrupt Source output signal, can no longer cancel this signal. It will appear at the Interrupt Source output anyway (See fig. 13-2 for details). A new time value is loaded by writing to the 16-bit register TIM0, high byte first. Upon writing the low byte, the reload register is set to the new 16-bit value, the counter is reset, and immediately starts down-counting with the new value. Falling below zero, the counter generates a reload signal, which can be used to trigger an interrupt. The same signal is connected to a divide-by-two scaler to generate the output signal T0-OUT with a pulse duty factor of 50%. The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Micronas May 25, 2004; 6251-606-1PD 95 CDC16xxF-E PRELIMINARY DATA SHEET clk tclk 2 counter 1 0 Reload Value Reload Value - 1 underflow critical period for loading interrupt Fig. 13-2: Timer0 Timing Table 13-1: Module specific settings Module Name HW Options T0 Initialization Enable Bit Item Address Item Setting Input clock FFA0h T0-OUT output U3.4 special out 13.1.2. Registers TIM0L T0 low byte 7 6 5 4 3 2 1 r Read low byte of down-counter and latch high byte w Write low byte of reload value and reload down-counter 1 1 1 TIM0H 1 1 0 1 1 1 2 1 0 1 1 Res T0 high byte 7 6 5 4 3 r Latched high byte of down-counter w High byte of reload value 1 1 1 1 1 1 Res TIM0 has to be read low byte first and written high byte first. Table 13-2: Reload Register Programming Reload value Output interrupt source frequency is divided by Output T0-OUT is divided by 0000h 1 2 0001h 2 4 0002h 3 6 : : : FFFFh 65536 131072 96 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 13.2. Timer T1 and T2 Features Timer T1 and T2 are 8-bit auto-reload down counters. They serve to deliver timing reference signals to the IR or to output frequency signals. - 8-bit auto-reload counter - Interrupt source output Table 13-3 describes implementation-specific HW Option addresses and enable flags of T1 and T2. w HW Option - Frequency output TIMx Reload-Reg. clk tclk 8 & clk 8 bit Auto-reload Down counter Tx Interrupt Source 1/2 tclk underflow & 1/2 Tx-OUT res enable Fig. 13-3: Timer T1 and T2 Block Diagram 13.2.1. Principle of Operation The state of the down-counter is not readable. 13.2.1.1. General Remarks 13.2.1.3. Precautions The timer's 8-bit down-counter is clocked by the input clock and counts down. Falling below zero, it generates an output pulse (underflow) to get reloaded with the value in its reload register which is counted down subsequently. A load with a new value within a time period of < tclk/2 before a scheduled Interrupt Source output signal, can no longer cancel this signal. It will appear at the Interrupt Source output anyway (See fig. 13-4 for details). Tx is not affected by CPU SLOW mode. Furthermore, disabling the timer within a time period of < tclk/ 2 before a scheduled Interrupt Source output signal, will immediately generate an extra Interrupt Source output signal. Reenabling the timer afterwards will lead to generation of the previously scheduled Interrupt Source output signal, because it was stored internally. This latter Interrupt Source output signal will be generated even if a new time value is loaded during the inactive time. 13.2.1.2. Operation The clock input frequencies can be set via HW options (see Table 13-3 on page 98). After reset, the 8-bit timer is in standby (inactive) mode. Prior to entering active mode, proper SW initialization of the U-Ports assigned to function as Tx-OUT outputs has to be made (Table 13-3). The ports have to be configured Special Out. Refer to "Ports" for details. To initialize a timer, reload register TIMx can be set to the desired time value already in standby mode. To enter active mode, set the corresponding enable bit in the standby registers (see Table 13-3 on page 98). The timer will immediately start counting down from the time value present in register TIMx. During active mode, a new time value is loaded by simply writing to register TIMx. Upon writing, the counter is reset, and immediately starts counting down from the new time value. Falling below zero, the counter generates a reload signal, which can be used to trigger an interrupt. The same signal is connected to a divide-by-two scaler to generate the output signal Tx-OUT with a pulse duty factor of 50%. The interrupt source output of this module can be, but need not be, connected to the interrupt controller directly or via multiplexer. This is a HW option which is done by the factory only. Please refer to section Interrupt Controller. Returning Tx to standby mode by resetting its respective enable bit will halt its counter and will set its outputs LOW. The register TIMx remains unchanged. Micronas May 25, 2004; 6251-606-1PD 97 CDC16xxF-E PRELIMINARY DATA SHEET clk tclk 2 counter 1 0 Reload Value Reload Value - 1 underflow critical period for disabling/enablig and/or loading interrupt Fig. 13-4: Timer1 and 2 Timing Table 13-3: Module-specific settings Module Name HW Options Initialization Enable Bit Item Address Item Setting T1 Input clock FFA7h T1-OUT output U6.2 or U6.5 special out SR1.TIM1 T2 Input clock FFA8h T2-OUT output U3.7 special out SR2.TIM2 13.2.2. Registers TIM1 Timer 1 7 6 5 w 4 3 2 1 0 0 0 0 0 3 2 1 0 0 0 0 Reload value 0 0 TIM2 0 0 Res Timer 2 7 6 5 w 4 Reload value 0 0 0 0 0 Res Table 13-4: Reload Register Programming Reload value Output interrupt source frequency is divided by Output Tn-OUT is divided by 00h 1 2 01h 2 4 02h 3 6 : : : FFh 256 512 98 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 14. Pulse Width Modulator (PWM) A PWM is an 8-bit reload down-counter with fixed reload interval. It serves to generate a frequency signal with variable pulse width or, with an external low pass filter, as a digital-to-analog converter. Features - 8bit pulse width modulator - Wide range of HW option selectable cycle frequencies The number of PWMs implemented is given in Table 14-1. The "x" in register names distinguishes the module number. PWMx w Pulse Width Register 0 HW Option period 1 8 0 HW Option clock clk load 1 1 S 8 bit down counter zero Q PWMx R 0 SR.PWMx Fig. 14-1: PWM Block Diagram 14.1. Principle of Operation 14.1.1. General Remarks 14.1.4. Operation A PWM's 8-bit down-counter is clocked by its input clock and counts down to zero. Reaching zero, it stops and sets the output to LOW. A period input pulse reloads the counter with the content of the PWM register, restarts it and sets the output to HIGH. After reset, a PWM is in standby mode (inactive) and the output signal PWMx is LOW. A PWM is not affected by CPU SLOW mode. 14.1.2. Hardware settings The clock and period input frequencies can be set via HW option (Table 14-1). For full resolution a clock-to-period frequency ratio of 256 is recommended. Should other ratios be used, make sure that the combination of clock, period and pulse width setting allow the PWM to generate an output signal with a LOW transition. Some of the PWM outputs share pins with outputs of other modules. The output multiplexer is controlled by HW option (Table 14-1). For entering active mode, set the respective enable bit (Table 14-1). Then write the desired pulse width value to register PWMx. Each PWM will start producing its output signal immediately after the next subsequent input pulse on its period input. During active mode, a new pulse width value is set by simply writing to the register PWMx. Upon the next subsequent input pulse on its period input the PWM will start producing an output signal with the new pulse width value, starting with a HIGH level. Returning a PWM to standby mode by resetting its respective enable flag will immediately set its output LOW. The state of the down-counters is not readable. 14.1.3. Initialization Prior to entering active mode, proper SW initialization of the H-Ports and U-Ports assigned to function as PWMx outputs has to be made (Table 14-1). The ports have to be configured Special Out. Refer to "Ports" for details. Micronas May 25, 2004; 6251-606-1PD 99 CDC16xxF-E PRELIMINARY DATA SHEET Table 14-1: Module specific settings Module Name HW Options Initialization Enable Bit Item Address Item Setting Clock and period FFA1h FFA2h PWM0 output H1.0 or H2.4 special out SR0.PWM0 H1.0 SME/PWM0 output multiplexer FFC2h PWM1 Clock and period FFA3h FFA4h PWM1 output H3.0 special out SR0.PWM1 PWM2 Clock and period FFA5h FFA6h PWM2 output H1.1 or U5.6 special out SR2.PWM2 H1.1 SME/PWM2 output multiplexer FFC2h PWM3 Clock and period FFA1h FFA2h PWM3 output H3.1 special out SR2.PWM3 PWM4 Clock and period FFA3h FFA4h PWM4 output H2.5 special out SR2.PWM4 PWM0 14.2. Registers PWMx 7 PWMx Register 6 5 w 4 3 2 1 0 0 0 0 Pulse width value 0 0 0 0 0 Res Table 14-2: Pulse Width Programming Pulse width value Pulse duty factor 00h 0% (Output is permanently low) 01h 1/256 02h 2/256 : : FEh 254/256 FFh 100% (Output is permanently high) 1) 1) 100 Pulse duty factor 255/256 is not selectable. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 15. Capture Compare Module (CAPCOM) The Capture Compare Module (CAPCOM) is a complex relative timer. It comprises a free-running 16-bit Capture Compare Counter (CCC) and a number of Subunits (SU). The timer value can be read by SW. - 16-bit free running counter with read out. A SU is able to capture the relative time of an external event input and to generate an output signal when the CCC exceeds a predefined timer value. Three types of interrupts enable interaction with SW. Special functionality provides an interface to the asynchronous external world. - Input trigger on rising, falling or both edges. HW Option fclk - 16-bit capture register. - 16-bit compare register. - Output action: toggle, low or high level. - Three different interrupt sources: overflow, input, compare - Designed for interface to asynchronous external events clk CCCOFL Interrupt Source CCC Timer Value ofl 16 SR0.CCC 2 2 CC0I 1 CC0-IN CC0-OUT 0 7 0 0 0 1 1 0 1 1 Input Action Logic 3 CC0M CAP CMP OFL LAC RCR 6 5 4 X 3 X 2 X 1 MCAP MCMP MOFL 0 7 6 5 FOL 4 OAM 3 IAM 2 1 0 & >1 & & 2 LOW 0 0 TOGGLE 0 1 1 0 1 1 Output Action Logic CC0OR Interrupt Source >1 16 A reset load Subunit 0 16-Bit Capture-Register r 16-Bit Compare-Register w CC0 = B CC0COMP Interrupt Source 16 Timer Value ofl 16 CC1-IN CC1-OUT CC1OR Subunit 1 CC1COMP Timer Value ofl 16 CC2-IN CC2-OUT CC2OR Subunit 2 CC2COMP Fig. 15-1: CAPCOM Module Block Diagram Micronas May 25, 2004; 6251-606-1PD 101 CDC16xxF-E PRELIMINARY DATA SHEET 15.1. Principle of Operation Table 15-1: Unit specific settings 15.1.1. General Remarks The Capture Compare Module (CAPCOM, Fig. 15-1) contains one common free-running 16-bit counter (CCC) and a number of capture and compare subunits (SU). More details are given in Table 15-1. The timer value can be read by SW from 16-bit register CCC. The CCC provides an interrupt on overflow. Subunit SU0 Each SU is able to capture the CCC value at a point of time given by an external input event processed by an Input Action Logic. A SU can also change an output line level via an Output Action Logic at a point of time given by the CCC value. Thus, a SU contains a 16-bit capture register CCx to store the input event CCC value, a 16-bit compare register CCx to program the Output Action CCC value, an 8-bit interrupt register CCxI and an 8-bit mode register CCxM. Two types of interrupts per SU enable interaction with SW. HW Options Initialization Item Address Item Setting Input clock FFA9h CC0OUT U5.1 special out CC0-IN U5.0 special in CC1OUT U4.6 & U3.6 special out CC1-IN U4.7 special in CC2OUT U3.3 special out CC2-IN U4.6 special in SU1 SU2 For limitations on operating the CAPCOM module in CPU SLOW mode, see section 15.1.5.3. Enable Bit SR0. CCC 15.1.2. Hardware Settings The CCC clock frequency must be set via HW option (Table 15-1). Refer to "HW Options" for setting them. 15.1.3. Initialization After system reset the CCC and all SUs are in standby mode (inactive). In standby mode, the CCC is reset to value 0000h. Capture and compare registers CCx are reset. No information processing will take place, e.g., update of interrupt flags. However, the values of registers CCxI and CCxM are only reset by system reset, not by standby mode. Thus it is possible to program all mode bits in standby mode and a predetermined startup out of standby mode is guaranteed. Prior to entering active mode, proper SW configuration of the U-Ports assigned to function as Input Capture inputs and Output Action outputs has to be made (Table 15-1). The Output Action ports have to be configured as special out and the Input Capture ports as special in. Refer to "Ports" for details. The state of the counter is readable by reading the 16-bit register CCC, low byte first. Upon reading the low byte, the high byte is saved to a temporary latch, which is then accessed during the subsequent high byte read. Thus, for time stamp applications, read consistency between low and high byte is guaranteed. The CCC is free-running and will overflow from time to time. This will cause generation of an overflow interrupt event. The interrupt (CCCOFL) is fed directly to the Interrupt Controller and also to all SUs where further processing takes place. 15.1.5. Operation of Subunit 15.1.5.1. Compare and Output Action To activate a SUs compare logic the respective 16-bit compare register CCx has to be programmed, low byte first. The compare action will be locked until the high byte write is completed. As soon as CCx setting and CCC value match, the following actions are triggered: - The flag CMP in the CCxI register is set. - The CCxCOMP interrupt source is triggered. 15.1.3.1. Subunit For a proper setup the SW has to program the following SU control bits in registers CCxI and CCxM: Interrupt Mask (MCAP, MCMP, MOFL), Force Output Logic (FOL, 0 recommended), Output Action Mode (OAM), Input Action Mode (IAM), Reset Capture Register (RCR, 0 recommended), and Lock After Capture (LAC). Refer to section 15.2. for details. Please note that the compare register CCx is reset in standby mode. It can only be programmed in active mode. 15.1.4. Operation of CCC For entering active mode of the entire CAPCOM module set the enable bit (Table 15-1). - The CCxOR interrupt source is triggered when activated. - The Output Action logic is triggered. Four different reactions are selectable for the Output Action signal: according to field CCxM.OAM (Table 15-2) the equal state will lead to a high or low level, or toggling or inactivity on this output. Another means to control the Output Action is bit CCxM.FOL. E.g. rise-mode and force will set the output pin to high level, fall-mode and force to low level. This forcing is static, i.e., it will be permanently active and may override compare events. Thus it is recommended to set and reset shortly after that, i.e., to pulse the bit with SW. Toggle mode of the Output Action logic and forcing leads to a burst with clock-frequency and is not recommended. The CCC will immediately start up-counting with the selected clock frequency and will deliver this 16-bit value to the SUs. 102 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 15.1.5.2. Capture and Input Action The Input Action logic operates independently from the Output Action logic and is triggered by an external input in a way defined by field CCxM.IAM. As shown in Table 15-3 it can completely ignore events, trigger on rising or falling edge or on both edges. When triggered, the following actions take place: - Flag CCxI.CAP is set. - The CCxOR interrupt source is triggered when activated. - The 16-bit capture register CCx stores the current CCC value, i.e., the "time" of the external event. Read CCx low byte first. Further compare action will be locked until the subsequent high byte read is completed. Thus a coherent result is ensured, no matter how much time has elapsed between the two reads. Some applications suffer from fast input bursts and a lot of capture events and interrupts in consequence. If the SW cannot handle such a rate of interrupts, this could evoke stack overflow and system crash. To prevent such fatal situations the Lock After Capture (LAC) mode is implemented. If bit CCxI.LAC is set, only one capture event will pass. After this event has triggered a capture, the Input Action logic will lock until it is unlocked again by writing an arbitrary value to register CCxM. Please make sure that this write only restores the desired setting of this register. Programming the Input Action logic while an input transition occurs may result in an unexpected triggering. This may overwrite the capture register, lock the Input Action logic, if in LAC mode, and generate an interrupt. Please ensure that SW is prepared to handle such a situation. For testing purposes, a permanent reset (FFFFh) may be forced on capture register CCx by setting bit CCxI.RCR. Please make sure that the reset is only temporary. 15.1.5.3. Interrupts come possible problems, the Input Capture Interrupt flag CCxI.CAP is double-buffered. If a second or even more input capture interrupt events occur before the interrupt flag is cleared (i.e. SW was not able to keep track), the flag goes to a third state. Two consecutive writes to this bit in register CCxI are then necessary to clear the flag. This enables SW to detect such a multiple interrupt situation and eventually to discard the capture register value, which always relates to the latest input capture event and interrupt. The internal CAPCOM module control logic always runs on the oscillator frequency, regardless of CPU SLOW mode. Avoid write accesses to the CCxI register in CPU SLOW mode since the logic would interpret one CPU access as many consecutive accesses. This may yield unexpected results concerning the functionality of the interrupt flags. The following procedure should be followed to handle the capture interrupt flag CAP: 1. SW responds to a CAPCOM interrupt, switching to CPU FAST mode if necessary and determining that the source is a capture interrupt (CAP flag =1). 2. The interrupt service routine is processed. 3. Just before returning to main program, the service routine acknowledges the interrupt by writing a 1 to flag CAP. 4. The service routine reads CAP again. If it is reset, the routine can return to main program as usual. If it is still set an external capture event overrun has happened. Appropriate actions may be taken (i.e. discarding the capture register value etc.). 5. go to 3. 15.1.6. Inactivation The CAPCOM module is inactivated and returned to standby mode (power down mode) by setting the enable bit to 0. Section 15.1.3. applies. CCxI and CCxM are only reset by system reset, not by standby mode. Each SU supplies two internal interrupt events: 1. Input Capture event and 15.1.7. Precautions 2. Comparator equal state. As previously explained, interrupt events will set the corresponding flags in register CCxI. In addition to the above mentioned two, the CCC Overflow interrupt event sets flag CCxI.OFL in each SU. Thus, three interrupt events are available in each SU. The corresponding flags are masked with their mask bits in register CCxM and passed to a logical or. The result (CCxOR) is fed to the interrupt controller as a first interrupt source. In addition, the Comparator equal (CCxCOMP) interrupt is directly passed to the interrupt controller as second interrupt source. Thus a SU offers four types of interrupts: CCC overflow (maskable ored), input capture event (maskable ored) and comparator equal state (maskable ored and non-maskable direct). All interrupt sources act independently, parallel interrupts are possible. The interrupt flags enable SW to determine the interrupt source and to take appropriate action. Before returning from the interrupt routine, the corresponding interrupt flag should thus be cleared by writing a 1 to the corresponding bit location in register CCxI. The interrupts generated by internal logic (CCC Overflow and Comparator equal) will trigger in a predetermined and known way. However, as explained in 15.1.5.2. erroneous input signals may cause some difficulties concerning the Input Capture input, as well as interrupt handling. To over- Micronas 16-bit CPU commands do not generally keep to a certain order in addressing high and low bytes of a register. Make sure that the command used performs reading and writing a 16-bit value low byte first. In case of uncertainty use 8-bit commands. 15.2. Registers The CAPCOM module counter has to be read low byte first to avoid inconsistencies. CCC 7 CAPCOM Counter low byte 6 r 5 4 3 2 1 0 0 0 Read low byte and lock CCC 0 May 25, 2004; 6251-606-1PD 0 0 0 0 0 Res 103 CDC16xxF-E CCC CAPCOM Counter high byte 7 6 r 5 4 3 2 CCxI 1 0 Read high byte and unlock CCC 0 0 CCxM r/w PRELIMINARY DATA SHEET 0 0 0 0 r/w 0 0 Res CAPCOM x Mode Register 7 6 5 4 MCAP MCMP MOFL FOL 0 0 0 0 MCAP r/w1: r/w0: Mask CAP Flag Enable. Disable. MCMP r/w1: r/w0: Mask CMP Flag Enable. Disable. MOFL r/w1: r/w0: Mask OVL Flag Enable. Disable. 3 2 1 OAM 0 0 IAM 0 0 0 Res FOL Force Output Action Logic r/w1: Force Output Action logic. r/w0: Release Output Action logic. This flag is static. As long as FOL is true neither comparator can trigger nor SW can force, by writing another "one", the Output Action logic. After forcing it is recommended to clear FOL unless Output Action logic should not be locked. OAM r/w: Output Action Mode Defines behavior of Output Action logic. 6 5 4 3 2 1 0 CAP CMP OFL LAC RCR x x x 0 0 0 0 0 0 0 0 CAP r1: r0: w1: w0: Capture Event Event. No Event. Clear flag. No change. CMP r1: r0: w1: w0: Compare Event Event. No Event. Clear flag. No change. OVL r1: r0: w1: w0: Overflow Event Event. No Event. Clear flag. No change. Output Action Logic Modes 00 Disabled, ignore trigger, output low level. 01 Toggle output. 10 Output low level. 11 Output high level. IAM r/w: RCR r/w1: r/w0: Reset Capture Register Reset capture register permanently to FFFFh. Release capture register. CCx CAPCOM x Capture/Compare Register low byte 7 6 5 4 3 2 1 r Read low byte of capture register and lock it. w Write low byte of compare register and lock it. 1 1 CCx 1 1 1 1 1 0 1 Res CAPCOM x Capture/Compare Register high byte 7 Input Action Mode Defines behavior of Input Action logic. Res LAC Lock After Capture r/w1: Enable. r/w0: Disable. Refer to section 15.1.5.2. Table 15-2: OAM usage Bit 32 CAPCOM x Interrupt Register 7 6 5 4 3 2 1 r Read high byte of capture register and unlock it. w Write high byte of compare register and unlock it. 1 1 1 1 1 1 1 0 1 Res Table 15-3: IAM usage Bit 10 Input Action Logic Modes 00 Disabled, don't trigger. 01 Trigger on rising edge. 10 Trigger on falling edge. 11 Trigger on rising and falling edge. 104 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 16. Stepper Motor Module (SMM) The SMM serves to control air-cored movements or stepper motors that are directly coupled in H-bridge formation to HPorts. Upon CPU programming it creates all waveforms necessary to position the drive pointer as desired. Features The number of motors that are controllable by subunits (control units) of the module is given in Table 16-4. - Four quadrant operation - Multichannel pulse width modulated output - Outputs offset for improved EMC properties - 8-bit resolution - HW Option selectable output cycle frequency 16.1. Functional Description An 8-bit, free-running counter FRC (see Fig. 16-2) operates on the fSM input clock (generally 4MHz) and creates an 8-bit counter word that is fed to a number of control units SMx. control unit supplies two H-bridges with signals SMx1+, SMx1-, SMx2+ and SMx2- to function as variable pulse width modulator outputs with selectable polarity. A control unit (Fig. 16-2) contains 8-bit sine and cosine compare registers. One comparator each is associated with these registers and creates a compare signal when register content and FRC word are equal. An output flip-flop associated with each comparator is set when the FRC word is zero and reset by the respective compare signal. A delay stage associated with each control unit delays the flip-flop output signals by a fixed number of fSM cycles to achieve non-synchronism between the output signals of the various control units, thus achieving an improved EMC behavior of the SMM (cf. Fig. 16-1). According to the setting of a quadrant register associated with each control unit, each of a unit's two output signals is multiplexed to signals SMxn+ and SMxn- so as to properly control 2 individual H-Ports that form an H-bridge together with the connected motor coil. By these means, a Summing up: when the compare registers are set to the sine and cosine value of a desired rotor angle and the quadrant register is set to the desired quadrant, an air-cored movement or a stepper motor connected to the unit's 4 H-Ports will carry the proper average coil currents of proper polarity so that its rotor will assume the desired rotary angle. Three registers control readjustment of a rotor to a new angle. Sine, cosine and unit/quadrant registers serve as temporary storage of new sine, cosine, related quadrant and unit selection values. A scheduler logic times the synchronous downloading of the three buffered words to the respective unit's sine, cosine and quadrant registers, so as to avoid inconsistencies among them. A busy bit may be read out, signalling completion of the downloading. 1/ftrig ftrig =fSM /28 SMA1+ SMA1- Example: SMA in 1st quadrant SMA2+ tdA = 0/ fSM SMA2- SMB1+ SMB1- Example: SMB in 4th quadrant SMB2+ tdB = 1/ fSM SMB2- Fig. 16-1: Timing Diagram of Output Signals Micronas May 25, 2004; 6251-606-1PD 105 CDC16xxF-E PRELIMINARY DATA SHEET SMVC SR0.SM w x x SEL x QUAD 3 fSM fSM /256 Busy 8bit FRC Scheduler OVFL 5 R S Comparator sin A "=" sin A comp. latch (reload register) DELAY Q 0/f SM sin Load R S Comparator cos A "=" cos A comp. latch (reload register) DELAY Q 0/f SM SMA1+ SMA1- Quadrant register and decoder Load A SMA2+ cos SMA2- SMA 4 SMB1+ SMB1DELAY 1 / fSM sin B / cos B Load B SMB2+ SMB2- SMB w SMVCOS Cosine register SMVSIN r x x x x x x x B Sine register w ftrig fCLK 3 SMC1+ SMC1DELAY 2 / fSM sin C / cos C Load C SMC2+ SMC2- SMC 2 SMD1+ SMD1DELAY 3 / fSM sin D / cos D Load D SMD2+ SMD2- SMD 1 HW Option SME1+ Load E DELAY 4 / fSM sin E / cos E SME1SME2+ SME SME2- PWM2-OUT PWM0-OUT Fig. 16-2: Block Diagram of Output Generation Circuit 106 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 16.2. Registers SMVC w SMVSIN SMM Control Register 7 6 x x x x 5 4 3 2 SEL 0 0 1 x 0 x 7 0 r QUAD 0 0 SEL Control unit Selection field (Table 16-1) QUAD Quadrant selection field (Table 16-2) SMM Sine Register Res 6 x x selected control unit 000 SMA 001 SMB 010 SMC 011 SMD 100 SME x w 3 2 1 0 x x x BUSY 0 0 0 2 1 0 0 0 0 8bit Sine Value 0 0 7 SEL 4 x 0 SMVCOS Table 16-1: SEL usage 5 0 0 Res SMM Cosine Register 6 5 w 4 3 8bit Cosine Value 0 0 BUSY r0: r1: 0 0 0 Res Scheduler Busy Flag Scheduler not busy Scheduler busy, do not write registers SMVC, SMVCOS, SMVSIN Table 16-3: Usage of SMVSIN and SMVCOS registers Value Duty factor 00h 0/256 (continuously low) 01h 1/256 02h 2/256 Control unit output signal function : : SMx1+ SMx1- SMx2+ SMx2- FEh 254/256 00 sine VSS cosine VSS FFh 255/256 1) 01 sine VSS VSS cosine 10 VSS sine VSS cosine 11 VSS sine cosine VSS No other values are permitted. Table 16-2: QUAD setting and resulting control unit output Pulse Diagram signal function QUAD 1) 256/256 (continuously high) is not available. 16.3. Principle of Operation The SMM may only be operated in CPU FAST mode. 16.3.1. Hardware settings Prior to entering active mode, the fSM input clock has to be set by HW Option (see Table 16-4 on page 108). A frequency value of 4 MHz is recommended, resulting in a pulse width modulator cycle frequency of 4 MHz/256. Some H-Ports may receive the output signals either of the SMM or of PWM modules as an alternative. Refer to Table 16-4 for the necessary settings. 16.3.2. Initialization Prior to entering active mode, proper SW initialization of the H-Ports assigned to function as H-bridge outputs SMxn+ and SMxn- has to be made (Table 16-4). The H-Ports have to be configured Special Out. Refer to "Ports" for details. 16.3.3. Operation After reset, the SMM is in standby mode (inactive). The output lines to the H-Ports are low. Refer to section "HW Options" for details. Micronas May 25, 2004; 6251-606-1PD 107 CDC16xxF-E PRELIMINARY DATA SHEET Table 16-4: Unit specific settings Contr. Unit HW Options Item Initialization Address Enable Bit Item Setting SMA SMAn+/- outputs H0.0 to H0.3 special out SMB SMBn+/- outputs H1.2 to H1.5 special out SMC SMCn+/- outputs H2.0 to H2.3 special out SMD SMDn+/- outputs H3.2 to H3.5 special out SMEn+/- outputs H0.4 to H1.1 special out SME SME/PWM selection FFC2h All Input clock selection FFAEh SR0.SM For entering active mode, set bit SR0.SM. The FRC will immediately start counting but the control units' output lines will still be low. download, flag BUSY is reset and the respective unit will immediately start producing the output signals with the desired timing (see Table 16-3) on the proper pins (see Table 16-2). 16.3.3.1. Generating Output The above procedure for loading values to a first unit is repeated for all others. Make sure that the BUSY flag is 0 before rewriting registers SMVC, SMVCOS and SMVSIN. After entering active mode, the SMM's control units are ready to receive sine, cosine and quadrant values. First load the unit/quadrant information to register SMVC, then the cosine value to register SMVCOS and at last the sine value to register SMVSIN. Upon writing SMVSIN, the scheduler logic will set flag SMVSIN.BUSY and load the buffered values to the respective unit's sine, cosine and quadrant registers on the next zero transition of the FRC, after a maximum of 256 fSM input clock cycles. After completing the 16.3.4. Inactivation Returning the SMM to standby mode by resetting bit SR0.SM will immediately halt the FRC, return all output signals to 0, reset all internal registers. 16.4. Rotor Zero Position Detection (RZPD) In addition to above descriptions this module supports the Rotor Zero Position Detection by supplying motor blockage information. The Rotor Zero Position Detection capability is protected by a patent from Siemens VDO Automotive (SV) and may only be used with SV's prior approval. 16.4.2. Registers SMVCMP r/w 16.4.1. Functional Description Each control unit contains circuitry to detect an induced voltage resulting from the rotation of the connected motor's rotor (Fig. 16-3). A comparator compares the input voltage from one of the unit's H-Ports to 1/9th of the supply voltage. A capture logic opens a capture window and samples the comparator output. The capture result signal supplies a rotor blockage information necessary for the Rotor Zero Position Detection in all cases where the CPU has lost track of the display angle of a pointer that is driven by the motor via a mechanical transmission. SMM Comparator Register 7 6 5 4 3 2 1 0 x x ACRD ACRB x ACRE ACRC ACRA x x 0 0 x 0 0 0 ACRA to E r0: r1: w0: w1: Res Analog Comparator Control and Result for SMA to SME Capture result: no induced voltage detected Capture result: induced voltage detected Stop capture and clear result flag Start capture 16.4.3. Principle of Operation The RZPD can only be operated together with the Stepper Motor module. Switching SR0.SM connects/disconnects the comparators from supply and resets all registers. During Rotor Zero Position Detection one of a unit's H-Ports (Table 16-5) temporarily has to be operated as an input to an internal analog comparator. Reconfigure this port as Special Input. Refer to "Ports" for details. 108 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET fCPU SMA Debouncer and measurement window + - SMA-COMP + SMB-COMP 0 R S Result latch SMB 4 SMC 1 SMD 5 SME 2 - + SMC-COMP - + SMD-COMP - + SME-COMP - HVDD1 HVDD2 r/w x x D B x E C A SMVCMP 5 4 SR0.SM 8R 8R R R 2 1 0 Fig. 16-3: Block Diagram of Rotor Zero Position Detection Circuit tor input voltage - are received, a '1' may be read from the questioned unit's result flag SMVCMP.ACRx, indicating that the Rotor Zero Position Detection is under way. Table 16-5: RZPD input ports Contr. Unit Initialization Resetting the questioned unit's control bit SMVCMP.ACRx to 0 stops the sampling and resets the result flag. When, after a restart of the above sampling procedure and after a sufficiently long capture period, a '1' was still not read from the questioned unit's result flag SMVCMP.ACRx, this indicates that the Rotor Zero Position Detection is complete. Item Setting SMA SMA-COMP input H0.0 special in SMB SMB-COMP input H1.2 special in Parallel Rotor Zero Position Detection on all control units is permitted. SMC SMC-COMP input H2.0 special in SMD SMD-COMP input H3.2 special in After completion of Rotor Zero Position Detection, reconfigure the comparator input port as Special Out. SME SME-COMP input H0.4 special in Reading of the induced voltage at the measured motor winding is started by setting the questioned unit's control bit SMVCMP.ACRx to 1. The respective analog comparator's output will now be sampled. Once three consecutive '1' samples (spaced 1/fCPU) - indicating a sufficient analog compara- Micronas May 25, 2004; 6251-606-1PD 109 CDC16xxF-E PRELIMINARY DATA SHEET 17. LCD Module The Liquid Crystal Display (LCD) Module is designed to directly drive a 1:4 multiplexed liquid crystal display. It generates all signals necessary to drive 4 backplane and 48 segment lines which are output via U-Ports in LCD mode. Up to 192 segments or pixels can be controlled if all U-Ports are designated as segment outputs. In addition, the module provides functions that enable the user to cascade it with external expansion ICs providing more segment lines. It can be operated as master or slave in such an extended system. Features - 1:4 multiplex - 5 V supply - Maximum of 192 segments - Cascadable with external expansion ICs - 0.3 mA buffered 1/3 and 2/3 voltage divider - Zero standby current - 200 A no load active current - Frame frequency HW Option selectable 17.1. Principle of Operation 17.1.1. General Remarks 17.1.2. Hardware settings Each LCD pixel or segment which is controlled by the LCD module is located at the crossing point of a segment line and a backplane line. The LCD module co-ordinates the output sequences of backplane and segment lines (see Fig. 17-3 on page 112). The LCD frame frequency is settable by HW option FFADh. The resulting frame frequency is the selected input frequency, divided by 120. It should be in the range from 50 Hz to 200 Hz. BP3 BP2 BP1 BP0 SEGn-1 SEGn 17.1.3. Initialization After reset, the LCD module is in standby mode (inactive) and all U-Ports are in Port mode, non-conducting. SEGn+1 All U-Ports designated to function as backplane or segment outputs are to be set to LCD mode. Refer to "Ports" for more details. This will set these U-Ports to output LOW state. Fig. 17-1: Segments and Backplanes A segment pin can drive 4 different voltage levels (UVDD, 1/ 3 VDD, 2/3 VDD, VDD) in LCD mode. The output of each segment pin is controlled by the segment field of the corresponding UxSEGy register. Each such register contains the segment fields of two neighboring segment pins. A segment field is 4 bits wide. Each flag (0 to 3) of a segment field corresponds to a backplane line (BP0 to BP3). If the segment flag, corresponding with the backplane line BPx is true, the segment at the crossing of the two lines is on (black). The LCD module does not contain a display ROM translating character information into segment code. The advantage is that arbitrary characters or displays can be generated just by changing the program code. Segment information is directly entered by writing to the corresponding UxSEGy register. It is validated (loaded to all corresponding slave registers) for all segment U-Ports simultaneously by a write access to register U1SEG10. Two internal voltage sources provide the U-Port circuits and the backplane generator with the voltage levels 1/3 UVDD and 2/3 UVDD. These levels are generated by a buffered resistor divider. 110 For best electromagnetic interference results it is recommended to operate all segment and backplane U-Ports in Port Slow mode. Refer to "Ports" for more details and to "HW-Options" for setting the corresponding HW options. Set flag PFST in register SR1 to HIGH to enable Port Slow mode. After reset the content of the segment registers is undefined. It must be set by writing the desired segment information to registers UxSEGy and by validating it by a write access to register U1SEG10 (write 00h for master mode, FFh for slave mode), before the LCD module is enabled. 17.1.4. Operation For entering active mode, set flag LCD in register SR1. Each segment and backplane U-Port will immediately start producing its LCD output signal according to the segment information provided during initialization. During active mode, a new segment information is entered by simply writing the desired segment information to registers UxSEGy and by validating it by a write access to register U1SEG10 (write 00h while in master mode, FFh while in slave mode). Each segment and backplane U-Port will immediately start producing an LCD output signal according to the new segment information. Returning the LCD module to standby mode by resetting flag LCD in register SR1 will immediately return all segment and backplane U-Ports to the output LOW state. May 25, 2004; 6251-606-1PD Micronas Micronas wr U1SEG10 May 25, 2004; 6251-606-1PD UVDD load UVSS 2/ UV 3 DD 1 /3UVDD LCD SYNC OUT LCD SYNC IN LCD CLK OUT LCD CLK IN fclk HW Option U1M54. PMODE 3 1/1,5 1/2,5 1/1 2 1 0 3 2 1 0 SR1.LCD 1 U1.5 0 1 U1.4 0 Analog Switch Analog Switch and and Segment Driver Segment Driver 3 U1SEG54 1 0 1 0 U1SEG10.LCDSLV HW Option 3 2 1 0 3 2 3 8 State Counter 1 0 1 U7.3 0 1 U7.2 0 3 U1M30. PMODE Analog Switch Analog Switch and and Segment Driver Segment Driver 3 U7SEG32 reset overflow U7M32. PMODE 1/15 8 x frame frequency + + UVDD /3UVDD 3UVDD 1 0 U1.3 3 1 0 U1.2 2 1 0 U1.1 1 1 0 U1.0 0 Analog Analog Analog Analog Switch Switch Switch Switch and and and and Backplane Backplane Backplane Backplane Driver Driver Driver Driver 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 UVSS 1 2/ SR1.LCD Back Plane Generator R R R UVDD PRELIMINARY DATA SHEET CDC16xxF-E Fig. 17-2: Block Diagramm 111 CDC16xxF-E PRELIMINARY DATA SHEET 1 Frame VDD 2/3 Back plane BP0 1/3 0 Segment off Segment on Back plane BP1 Back plane BP2 Back plane BP3 Seg-No. Bit-No. 3210 Pin-No. SEG63_ 0000 SEG6.3 SEG64_ 1000 SEG6.4 SEG65_ 0110 SEG6.5 SEG66_ 1010 SEG6.6 SEG67_ 1111 SEG6.7 Fig. 17-3: Frame Timing Diagram The state of the segment registers is not readable. All LCD operations are not affected by CPU SLOW mode. 17.1.5. Cascading of LCD Driver Modules For expansion purposes, the LCD module may be cascaded with external LCD driver ICs. Master or slave mode is selectable for the LCD module while in standby mode. Special signals provide phase and frequency synchronism for the LCD frame among the cascaded ICs. 112 For master mode, set flag LCDSLV in register U1SEG10 LOW. The module always directs signal LCD-SYNC-OUT to pins U1.4 and U6.0 and LCD-CLK-OUT to pins U1.5 and U6.1. They connect to external slave ICs' SYNC-IN and CLK-IN inputs for synchronization. For slave mode, set flag LCDSLV in register U1SEG10 HIGH. Configure pins U5.2 and U5.3 to receive signals LCDSYNC-IN and LCD-CLK-IN from an external master IC's SYNC-OUT and CLK-OUT outputs. These signals will then substitute the LCD module's own HW option frame frequency settings. Starting up and shutting down such an expanded system is described in section 17.3. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET A segment at a crossing of backplane and segment lines is turned black when at the same time the backplane driver out- puts a full swing and the segment driver outputs a full swing of opposite polarity. 17.2. Registers U-Port registers U1SEG10, U1SEG32 and U1M30 play special roles during operation of the LCD module. U1SEG10 7 w LCDSLV 0 Universal Port x Segment Register of Ux.1 and Ux.0 6 5 4 3 2 1 0 x x x x x x x LCD 0 1 0 0 0 1 0 Res LCDSLV LCD Module is Slave w1: validate all segment information and select slave mode w0: validate all segment information and select master mode U1SEG54 7 Register U1SEG54 is an example for any Universal Port Segment Register with exception of U1SEG10 and U1SEG32. Refer to section Ports for detailed description. SEG15.3 Segment # 3 of Pin U1.5 This bit defines the segment at the crossing of the lines SEG1.5 (Pin U1.5) and BP3 (U1.3). w1: Segment is on (black) w0: Segment is off (white) SEG15.2 Segment # 2 of Pin U1.5 This bit defines the segment at the crossing of the lines SEG1.5 (Pin U1.5) and BP2 (U1.2). SEG15.1 Segment # 1 of Pin U1.5 This bit defines the segment at the crossing of the lines SEG1.5 (Pin U1.5) and BP1 (U1.1). SEG15.0 Segment # 0 of Pin U1.5 This bit defines the segment at the crossing of the lines SEG1.5 (Pin U1.5) and BP0 (U1.0). Universal Port 1 Segment Register of Pin U1.5 and U1.4 6 5 4 3 2 1 0 w SEG15.3 SEG15.2 SEG15.1 SEG15.0 SEG14.3 SEG14.2 SEG14.1 SEG14.0 LCD 0 0 1 0 0 0 1 0 Res 17.3. Software Hints for Cascading LCD Modules 17.3.1. Power-On and Start-Up Procedure 1. The SW in master and slave configures the corresponding IC. Table 17-1: Suggested sequence 5. The slave CPU detects the bit combination "01" and immediately switches on the slave LCD module. The slave LCD now generates a display. Note: During the time that the slave needs to detect the bit combination "01", master and slave operate asynchronously. Suggestion: limit time to approximately 100 to 200 ms. Master Slave Load LCD display register. Load LCD display register. Clear flag LCDSLV. Set flag LCDSLV. LCD-CLK-OUT, and LCD-SYNC-OUT: Configure universal ports as Special Out Ports. LCD-CLK-IN, and LCD-SYNC-IN: Configure universal ports as Special In Ports. 2. Optionally the slave signals to the master via handshake link or an inter processor interface (IPI) that it is ready to display. 3. The slave continuously scans the inputs LCD-CLK-IN and LCD-SYNC-IN for the bit combination "01" (SW debouncing required). Micronas 4. The master LCD module is switched on. LCD-CLK-OUT and LCD-SYNC-OUT switch to "01". 6. The LCD modules now operate in controlled synchronization. 17.3.2. Operation In order to obtain optimum synchronization of LCD switchover, a change of display must be coordinated between master and slave (preferably via IPI) so that the time lag between write accesses to U1SEG10 of the master and of the slave is kept as small as possible. Suggestion: Lower ms range or customer specification. 17.3.3. Power-Off Procedure 1. (Optional) The processor which decides that the display is May 25, 2004; 6251-606-1PD 113 CDC16xxF-E PRELIMINARY DATA SHEET to be switched off signals this to the other via IPI. 2. The slave continuously scans the inputs LCD-CLK-IN and LCD-SYNC-IN for the bit combination "11" (SW debouncing required). 3. The master LCD module is switched off. LCD-CLK-OUT and LCD-SYNC-OUT switch to "11". 4. The slave CPU detects the bit combination "11" and immediately switches off the slave LCD module. Note: Keep time delay as short as when switching on. 5. All LCD ports then output a low signal. The LCD display is now inactive. 114 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 18. DMA The DMA module allows read and write access to an external IC with minimum CPU interaction. The module is intended to support the operation of external LCD driver ICs (e.g. SED1560 by Epson): The DMA module copies 8 bit pixel data bytes by direct memory access (DMA) to the external IC's graphic RAM with the help of that IC's internal autoincrement address counter, and without CPU interaction. Other off-chip registers, allowing control of the display behavior (blinking, scrolling, etc.), are written and read by CPU operations supported and timed by the DMA module. The CPU programs the DMA module to copy an array of data from the internal to the external IC's memory. The CPU writes to or reads from external registers while the DMA module generates the necessary timing and control signals. Features - 3 operating modes: direct memory write access (DMA) without CPU interaction, support and timing of CPU write access to ext. registers, support and timing of CPU read access to ext. registers - 16 MB maximum DMA block size - one byte DMA block alignment, no confinement to banks - DMA sequence interruptible by CPU or interrupt controller - CPU cycles are stolen only during CPU bus access - flag for CPU-DMA conflict - Interrupt on DMA transfer finished - External bus cycle time selectable from Fxtal/2 to Fxtal/ 256 - Automatic generation of CPU wait states to support read access to external registers * chip internal signals * BE VPA*, VDA* DMA Logic control RDY CPU ADB 24 DB 8 fix GRDQ U7.2 U7.3 U-Port CS GWRQ n GBus Ifc GADB LCD driver Mem 8 U2 GDB Fig. 18-1: Block Diagram 18.1. Principle of Operation 18.1.1. DMA Write Mode To select the desired write timing, the corresponding bits have to be set in the DMA Initial Condition Register (DIC). To obtain the 8-bit pixel data GDB7 .. 0 on the U2.7 .. U2.0 pins, all U2 bits have to be configured as port, normal, outputs. To obtain the GWRQ control output on U7.3, this port has to be configured as port, special, output. Other signals necessary to control the external IC have to be realized by software using other ports. Micronas The range of internal addresses to be transmitted is finally set by first writing the 3 (lower) physical start address bytes to registers DSA2, DSA1, DSA0, then the 3 (upper) physical end address bytes to registers DEA2, DEA1 and DEA0. The module generates the physical 24-bit address, as it is presented to the memory, even with alternative banking mode. Refer to the Memory Banking section for translation of logical addresses as generated by the CPU to physical addresses. May 25, 2004; 6251-606-1PD 115 CDC16xxF-E PRELIMINARY DATA SHEET Upon writing DEA0 the DMA module will immediately begin presenting data on U2 and corresponding control signals on U7.3. During the necessary DMA access cycles to the internal addresses a wait cycle is generated for the CPU whenever it tries to perform a bus cycle itself. sary to control the external IC have to be realized by software using other ports. The CPU configures and operates U2 as port, normal, output. Upon the CPU writing the U2 Data Register (U2D), the DMA module will present corresponding control signals for one write cycle to the external IC on U7.3. If the CPU tries to rewrite U2D before the previous cycle is finished, the DMA module halts the CPU by generating the appropriate number of wait cycles. During operation, a DMA transfer active status bit (DCS.DTA) is readable from the DMA Control and Status register DCS to indicate that a requested transfer is not finished. A busy status bit (DCS.BSY) is readable to indicate that the DMA is currently active and not halted by the Interrupt Controller or by software. Other bits in the DCS are writable to immediately stop a running DMA sequence, and to restart it, or to allow the Interrupt Controller, when active, to stop and when inactive, to restart it. 18.1.3. CPU Read Mode Upon reaching the end address setting the DMA module finishes operation. At this time the DMA interrupt source output is triggered. To select the desired read timing and to use U2 data reads as cycle trigger the corresponding bits have to be set in the DMA Initial Condition Register (DIC). The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. To obtain the GRDQ control output on U7.2, this port has to be configured as port, special, output. Other signals necessary to control the external IC have to be realized by software using other ports. 18.1.2. CPU Write Mode The CPU configures and operates U2 as port, normal, input. Upon the CPU reading the U2 Data Input (U2D), the DMA module will present corresponding control signals for one read cycle from the external IC on U7.2. To select the desired write timing and to use U2 data writes as cycle trigger, the corresponding bits have to be set in the DMA Initial Condition Register (DIC). To obtain the GWRQ control output on U7.3, this port has to be configured as port, special, output. Other signals neces- During operation a busy status bit (BSY) in the DMA Control and Status Register (DCS) is readable to indicate the busy condition. The DMA module halts the CPU by generating the appropriate number of wait cycles, until the data read cycle from the external IC is complete. Thus one CPU read of U2D is sufficient to read data from external IC. 18.2. Registers The DMA control registers are located in the I/O area. Table 18-1: DMA Control Registers Mnemonic Name DCS DMA Control/Status DIC DMA Initial Configuration DSA0 Start Address 0 (low byte) DSA1 Start Address 1 DSA2 Start Address 2 DEA0 End Address 0 (low byte) DEA1 End Address 1 DEA2 End Address 2 out rewriting the start address register every single time. Only the end address has to be updated in this case. The end address has to be initialized with the address pointing to the first byte after the block to be transferred. Writing the low byte of the end address (DEA0) starts the DMA sequence. The first transfer starts after the next opcode fetch. The compare signal stops the DMA sequence if both pointers, DSAx and DEAx, point at the same memory location. A start or restart is not possible in this case. The DMA Control and Status Register (DCS) shows the CPU whether a requested DMA transfer is not yet finished (DTA flag), whether a DMA transfer is active and not halted, or a CPU access is not yet finished (BSY flag), or if a DMA CPU conflict (DCC flag) has occurred. DCC is set true, if the data, mode or tristate register of U-Port 2 is addressed by the CPU though the DMA logic is active. DCC will not be set, if the respective registers of U-Port 7 are addressed. It allows the CPU to stop (interrupt) and start (continue) a DMA sequence. Furthermore, it lets the CPU define whether an interrupt may stall a DMA sequence. The registers DSAx (start address) and DEAx (end address) are writable by the CPU. Write the address of the first byte to be transferred into the start address register. After the DMA has finished it points to the first byte after the transferred block. This makes it easy to transfer consecutive blocks with- 116 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 16 15 23 8 7 0 End Address Register (0...23) (End Address + 1) DTA = 16 15 23 8 7 0 Start Address (0...23) Upcounter 24 DMAE 0...23 ADB (0...23) Fig. 18-2: DMA Address Generator DCS r/w DMA Control and Status Register 7 6 5 4 3 2 1 0 x x x DTA DSI DCC STP BSY 0 0 0 0 0 0 0 0 DTA r1: r0: Note Res DMA Transfer Active DMA transfer active. No DMA transfer active. DSI DMA Stopped by Interrupt r/w1: DMA stops during interrupt. r/w0: DMA continues during interrupt. DSI should only be modified when DTA is zero. DCC r1: r0: w0: DMA CPU Conflict DMA CPU conflict. No DMA CPU conflict. Clears DCC flag. STP w1: w0: Stop DMA sequence Stops the DMA sequence. Nothing happens. BSY r1: r0: w1: w0: Busy DMA or CPU sequence is active. DMA or CPU sequence is not active. Starts the DMA sequence. Nothing happens. STP BSY 0 0 1 1 0 1 0 1 Micronas No action Start DMA sequence Stop DMA sequence Not allowed With DSI active a DMA sequence is stopped while an interrupt is served. In this case the DMA sequence doesn't lengthen an interrupt service routine. The start of an interrupt sends a stop signal to the DMA logic. Only the first of the nested interrupts sends this stop signal. The end of an interrupt (the last interrupt if they are nested) sends a start signal to the DMA logic. From this reason, each interrupt can start a DMA sequence if DSI is true. The only way to avoid a wrong start is to guarantee that the two address registers DSAx and DEAx point to the same memory location. DSI active implies other restrictions to the user: You can stop a DMA sequence within an interrupt, but it is not continued until the end of the last of nested interrupts. You can start a DMA sequence within an interrupt and it is not stopped by nested interrupts, until the main program is interrupted again. The two flags BSY and STP should be used in common. Table 18-2 shows the possible bit combinations. Table 18-2: BSY and STP Usage With BSY true, the CPU must neither access the ports or the DMA address registers, nor change the DMA Initial Configuration register (DIC). Even after interrupting a DMA sequence by setting the STP flag, it is necessary to guarantee that the BSY flag was cleared by the DMA logic, before changing those registers. Normally, a DMA sequence will be started by writing the end address to the appropriate registers. Writing to DEA0 starts the DMA sequence. So this byte has to be written last. If a DMA sequence is interrupted by SW, it has to be continued by rewriting DEA0 or by writing a one to BSY. A new DMA sequence may be started too by setting BSY, if the end address hasn't changed. In this case the start address has to be rewritten because it points at a position after the last transferred byte. The DMA Initial Configuration Register (DIC) contains wait state stuff like the duration of external access cycles or whether wait states should be generated. If the flag WSA (Wait States Active) is cleared, the U-Port 2 may be used as normal I/O or LCD port. In this case no wait states are generated with CPU access but with DMA access. The bits WSA, WS0, WS1 and WS2 must not be modified if DTA or BSY are true. May 25, 2004; 6251-606-1PD 117 CDC16xxF-E DIC w PRELIMINARY DATA SHEET DMA Initial Configuration Register 7 6 5 4 3 2 1 0 x WS2 WS1 WS0 x x x WSA 0 0 0 0 0 0 0 0 Note Res WS2 to 0 Wait States Bit 2 to 0 Write only field for programming the number of wait states. Table 18-3: Wait States WS2 to 0 #WS Ext. Bus Frequency @ 10 MHz 0 2 Phi2/2 5 M (Reset) 1 4 Phi2/4 2.5 M 2 8 Phi2/8 1.25 M 3 16 Phi2/16 625 k 4 32 Phi2/32 312.5 k 5 64 Phi2/64 156.25 k 6 128 Phi2/128 78 k 7 256 Phi2/256 39 k WSA Wait States Active w1: Wait states at CPU access to U2 and generation of GWRQ and GRDQ. w0: No wait states (RDY) and no control signals (GWRQ, GRDQ) at CPU access. At DMA wait states are always generated. The wait state logic controls the duration of external bus cycles (see Table 18-3 on page 118). It defines the maximum number of cycles the CPU is stopped. Not each kind of access stops the CPU the maximum number of cycles. Only a read from the external memory causes the wait state logic to generate the (programmable) maximum number of wait states. A write stops the CPU only if the previous access is not finished. A DMA sequence causes the CPU to stop for one Phi2 clock at each byte transfer. The next DMA happens after n-1 Phi2 clocks if n is the programmed number of wait states. The timing in Table 18-4 relate on a system clock of 10MHz. The external address has to be written by SW to the data latch. So the SW must guarantee the required address setup time. The GWRQ high to GWRQ low time ratio is symmetrical at DMA accesses. The SW has to guarantee the required GWRQ high time at CPU accesses. In this case the programmer can not rely on self timing with the RDY signal. At consecutive write accesses the GWRQ high time is exactly 2 Phi2 clocks. Table 18-4: Bus timing at 10 MHz #WS 2 4 8 16 32 64 128 256 Units tWDS min. 125 325 725 1525 3125 6325 12725 25525 ns tACC max. 150 350 750 1550 3150 6350 12750 25550 ns tDWH max. 100 200 400 800 1600 3200 6400 12800 ns tDDH max. 50 (always constant 1/2 Phi2) ns tCWH max. 200 (always constant 2 Phi2) ns tWDS: Write data setup time tACC: Read access time tDWH: DMA write high time tDDH: DMA write data hold time tCWH: CPU write high time 118 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 18.3. Ports The access to external memory is done by universal ports. The assignment to external signals is shown in Table 18-5. Table 18-6 shows the settings of the port configuration registers in different modes. Table 18-5: Port Assignment Port Name U2.0 GDB0 : : U2.7 GDB7 1) GADB External address bus U7.2 GRDQ External read signal U7.3 GWRQ External write signal External data bus 1) Any universal port may be used as address output port. Table 18-6: Port Configurations Mode Register Setting DMA Write, CPU Write U2SEG10, 32, 54, 76 00H Normal, out U2M10, 32, 54, 76 01H Port mode U7SEG32 44H Special, out U7M32 01H Port mode U2SEG10, 32, 54, 76 22H Normal, in U2M10, 32, 54, 76 01H Port mode U7SEG32 44H Special, out U7M32 01H Port mode CPU Read 18.4. SW Application Hints Don't try to access the external memory or the involved ports while a DMA sequence is running (DCS.DTA=1). =0). If a DMA is working (DTA=1) or a CPU access to an external address is not finished (BSY=1), it is neither allowed to access the involved ports and the DMA start and end address pointers, nor to change the configuration of the wait state logic. If there is an access, this is a programming error. Both accesses (DMA and CPU) are disturbed. A flag signals the occurrence of this conflict for debugging purposes. The ports must be initialized depending on the kind of access (DMA, write, read). Don't reconfigure ports or addresses (DSAx, DEAx) as long as the flags DCS.DTA or DCS.BSY are true. This may cause problems, particularly if more than two wait states are programmed. The flag BSY will be set if the CPU accesses external addresses too. BSY will be cleared after the transfer cycle has finished. There are two different modes to operate the DMA logic. In the DMA high priority mode a DMA sequence is not affected by an interrupt. DMAs take place during an interrupt service routine. Each DMA steals one cycle of the ISR. In the DMA low priority mode, a DMA sequence is stalled by an interrupt and continues after the end of the ISR. The ISR is not lengthened by an active DMA sequence. CPU must run in CPU FAST mode when accessing external memory. Don't try to access (CPU or DMA) in CPU SLOW mode. Port fast mode is recommended, to guarantee the timing between control signals and data. All involved ports and external addresses may be read or written as long as there is no DMA working (DTA=0, BSY Micronas May 25, 2004; 6251-606-1PD 119 CDC16xxF-E PRELIMINARY DATA SHEET 18.4.1. DMA High Priority Mode DMA write: The flag DSI is, and remains, set to zero. A DMA may interrupt an interrupt service routine. A DMA sequence may be started, stopped, the registers and ports may be modified everywhere if you make sure that the flags BSY/DTA are false. - Activate output driver of data port U2.0 to U2.7. The overall initialization has to be done once after each reset. - Write end address + 1 to registers DEA2 to DEA0. Writing to register DEA0 starts the DMA sequence. - Write destination address to address port. - Clear DSI. - Write start address to registers DSA2 to DSA0. - Set DSI. Overall initialization: - Configure WSA, WS0, WS1 and WS2. Set DSI to zero. CPU write: - Switch data port U2.0 to U2.7 to normal mode. - Activate output driver of data port U2.0 to U2.7. - Switch address port to normal mode and activate output driver. - Write external address to address port. - Write to data port U2. - Switch control port U7.2 and U7.3 to special mode and activate output driver. CPU read: - Deactivate output driver of data port U2.0 to U2.7. DMA write: - Write external address to address port. - Activate output driver of data port U2.0 to U2.7. - Read from data port U2. - Write destination address to address port. - Write start address to registers DSA2 to DSA0. 18.4.2.1. Unwanted DMA Interrupts in Low Priority Mode - Write end address + 1 to registers DEA2 to DEA0. Writing to register DEA0 starts the DMA sequence. CPU write: - Activate output driver of data port U2.0 to U2.7. - Write external address to address port. - Write to data port U2. On leaving interrupt service in Low Priority Mode (DSI=1), the DMA-HW generates a compare of start and end address register. If they are not equal, a halted DMA sequence is continued. But if they are equal, a DMA interrupt is generated instantly. DMA interrupts are generated at every compare, if the result is equal. Thus, an unwanted DMA interrupt is generated every time the DSI function tries to restart a DMA that has no transfers pending. To work around these unwanted interrupts, the following measures should be taken: CPU read: - Deactivate output driver of data port U2.0 to U2.7. - Write external address to address port. - No special measures have to be taken if a new DMA sequence is initiated within the DMA ISR (Interrupt Service Routine). - If no new DMA sequence has to be initiated within a DMA ISR, it is necessary to either clear flag DSI (High Priority Mode), or to disable the DMA interrupt at the Interrupt Controller, within the DMA ISR. - Read from data port U2. 18.4.2. DMA Low Priority Mode With the flag DSI set to one, any interrupt will stop a DMA sequence. The user may modify the DMA logic setting within an ISR as long as flag DTA is zero. If you want to stop a running DMA sequence by setting flag STP, it is advisable to clear flag DSI with the same write access to DSC. Otherwise the next interrupt would restart this interrupted DMA sequence. - After starting a DMA sequence from within the main routine, DSI has to be set and/or DMA interrupt has to be enabled again. The overall initialization has to be done once after each reset. Overall initialization: - Configure WSA, WS0, WS1 and WS2. Set DSI to one. - Switch data port U2.0 to U2.7 to normal mode. - Switch address port to normal mode and activate output driver. - Switch control port U7.2 and U7.3 to special mode and activate output driver. 120 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 18.5. Timings Phi2 ADB DB GADB CPU DMA-Src-1 CPU DMA1 CPU1 DMA-Src-2 CPU1 CPU2 DMA2 DMA-Src-3 CPU2 CPU4 DMA3 CPU4 DMA-Dest.-Adr. GDB DMA1 DMA2 DMA3 tDDH GWRQ VPA * VDA * RDY * BE * DMAE * Count * Busy * DMA internal DMA external * chip internal signals Fig. 18-3: DMA Write, WS = 2 Every second cycle is stolen from the CPU. The external DMA transfer lasts 2 cycles. The CPU computes an internal operation at the same time with the third DMA. In this case the CPU is not stopped. CPU3 is not visible on the buses ADB or DB. Micronas May 25, 2004; 6251-606-1PD 121 CDC16xxF-E PRELIMINARY DATA SHEET Phi2 ADB DB CPU DMA-Src-1 CPU DMA1 GADB DMA-Dest-Adr GDB DMAx CPU3 CPU2 CPU1 CPU2 CPU1 DMA-Src-2 CPU3 DMA1 CPU4 DMA2 CPU4 DMA2 tWDS tDDH GWRQ tDWH RDY * BE * DMAE * Count * Busy * DMA internal DMA external * chip internal signals Fig. 18-4: DMA Write, WS = 4 Phi2 ADB CPU1 DB GADB CPU1 CPU1 GDB CPU1 GWRQ CPU internal CPU external Fig. 18-5: CPU Write, WS = 2 122 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Phi2 ADB CPU1 DB GADB CPU2 CPU1 CPU2 CPU1 GDB CPU2 CPU1 GWRQ tCWH RDY * CPU internal CPU external * chip internal signals Fig. 18-6: CPU Write, WS = 4, with RDY because CPU rewrites to fast. Phi2 ADB CPU1 DB GADB CPU1 CPU1 GDB GRDQ CPU1 tACC RDY * * chip internal signals CPU internal Fig. 18-7: CPU Read, WS = 2 Micronas May 25, 2004; 6251-606-1PD 123 CDC16xxF-E PRELIMINARY DATA SHEET Phi2 ADB CPU1 DB GADB CPU1 CPU1 GDB CPU1 GRDQ RDY * CPU internal * chip internal signals Fig. 18-8: CPU Read, WS = 4 124 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 19. Serial Synchronous Peripheral Interface (SPI) An SPI module provides a serial input and output link to external hardware. An 8 or 9-bit data frame can be transmitted synchronized to an internally or externally generated clock. Features The number of SPIs implemented is given in Table 19-1. The "x" in register names distinguishes the module number. - Programmable data valid edge - 8 or 9-bit frames - Internal or external clock - Three internal clock sources programmable - Input deglitcher for clock and data HW Option SPIx-D-IN SI 0 0 Deglitcher 1 0 shift in 1 1 1 HW Option SPIx-D-OUT SO 0 0 SPIxD shift out 8 1 7 6 5 4 3 2 1 0 1 1 RXSEL Deglitcher BIT8 INTERN SPIxM 7 6 5 4 3 2 1 0 LEN9 3xTosc NEDGE SPIx Interrupt Source D1 D0 0 0 F0SPI 0 1 F1SPI 1 x F2SPI Scheduler clk SR0.SPIx 0 SPIx-CLK-OUT SO clkout 2 1 1 SPIx-CLK-IN SI 0 Deglitcher 1 1 HW Option HW Option F1SPI 0 extclk F0SPI 1/1 3:1 MUX 1/1,5 1/2,5 F2SPI 1 intclk 1 INTERN 0 CSF0/1 2 Fig. 19-1: Block Diagram Micronas May 25, 2004; 6251-606-1PD 125 CDC16xxF-E PRELIMINARY DATA SHEET 19.1. Principle of Operation Table 19-1: Module specific settings 19.1.1. General Remarks A SPI serves as an 8 or 9 bit wide input/output shift register. Either an internally or an externally generated clock can be used to shift data in and out. The input SPIx-D-IN is connected to the LSB of the shift register. The output of the shift register is connected to output signal SPIx-D-OUT. Thus each time a frame is transmitted by shifting bits out, bits are shifted in simultaneously and vice versa. Deglitchers in the data and clock input paths are active only in external clock mode. The input and output can be inverted by HW Option. If the deglitcher is active, input changes polarity after three consecutive samples have shown the same new polarity. Thus, a delay of three oscillator clock cycles is introduced. This feature imposes a limit on the maximum transmission frequency. Module HW Options Initialization Name Item Address Item Setting All SPIs F0SPI FFAFh clock F1SPI FFB0h clock F2SPI FFB1h clock SPI0 The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. SPIs are not affected by CPU SLOW mode. D in inversion FFAFh SPI0-D- U6.5 IN special input in D out inversion FFAFh SPI0-D- U6.4 special OUT out output Prescaler FFAEh SPI0CLK-IN input U6.3 special in SPI0CLKOUT output U6.3 special out 19.1.2. Hardware settings Clock frequency settings and the polarity of the data connections of the SPIs can be set via HW Options (Table 19-1). Refer to "HW Options" for setting them. 19.1.3. Initialization D in inversion FFB0h SPI1-D- U3.1 special IN in input Prior to entering active mode, proper SW configuration of the U-Ports assigned to function as data in- or outputs and clock in- or outputs has to be made (Table 19-1). Refer to "Ports" for details. D out inversion FFB0h SPI1-D- U3.0 OUT special output out For entering active mode of a SPI, set the respective enable bit (Table 19-1). Prescaler FFAEh SPI1CLK-IN input U3.5 special in SPI1CLKOUT output U3.5 special out SPI1 After reset, a SPI is in standby mode (inactive). Prior to operation, the desired clock frequency and telegram length have to be selected. 19.1.3.1. Clock Source The SPI can be operated as clock master, using an internally generated clock, or as clock slave, using an externally generated clock. The flag INTERN must be set in the SPIxM Mode register to operate the SPI as clock master. There are several options for selection of the internal clock. Each input of a 3 to 1 multiplexer can be programmed by HW Options to a different frequency. These three input frequencies F0SPI, F1SPI and F2SPI are used for all SPIs. The output of the 3 to 1 multiplexer is programmed by way of clock selection field (CSF) in register SPIxM. This clock can be used as shift clock directly or divided by 1.5 or 2.5. This selection is done by HW Option too. The shift clock is output by signal SPIx-CLK-OUT which can be inverted by the flag NEDGE of register SPIxM. Enable Bit SR0. SPI0 SR0. SPI1 input by signal SPIx-CLK-IN and can be inverted by the flag NEDGE. The data valid edge of the clock is defined by flag NEDGE in register SPIxM. 19.1.3.2. Telegram Length Flag LEN9 in register SPIxM defines the length of a transferred frame. The ninth bit of the shift register is read or written at the location of flag BIT8 in register SPIxM. If flag INTERN is zero, the SPI operates as clock slave and an externally generated clock is used. The external clock is 126 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 19.1.4. Operation any running receive or transmit operation and will reset all internal registers. 19.1.4.1. Transmit Mode Transmission is initiated by a write access to data register SPIxD. The SPI will immediately begin transmitting the selected number of data bits out from its shift register, in synchronism with the selected clock. A write access during a transmission is ignored. The frame is transmitted MSB first. In nine-bit mode flag BIT8 is MSB of the shift register (Fig. 19-2, 19-3). At the end of the frame, an interrupt source signal is generated which may be selected to trigger an interrupt. 19.1.4.2. Receive Mode The receive mode must be activated by a write access to register SPIxD. The SPI will immediately begin clocking in the selected number of data bits into its shift register, in synchronism with the selected clock. At the end of the frame, an interrupt source signal is generated which may be selected to trigger an interrupt. 19.1.5. Inactivation Returning an SPI module to standby mode by resetting its respective enable bit (Table 19-1) will immediately terminate 19.1.6. Precautions A single-wire bus is easiest implemented by a wired-or configuration of the SPIx-D-OUT output port and the open drain output of the external transmitter: simply configure the SPIx-D-OUT output port in Port Slow mode, always operate it in Port Special Output mode and connect it directly to the external open drain output. An external pull-up resistor is not necessary in this configuration because the SPIx-D-OUT output port supplies the necessary pull-up drive. If the SPIx-D-OUT output port has to be operated in Port Fast mode, this simple scheme is not possible, because the pull-down action of the external open drain output may exceed the absolute maximum current rating of the SPIx-DOUT output port. A discrete external wired-or is recommended for this situation. During operation, please make sure that the external clock does not start until after SPIxD has been written, otherwise correct data transfer is not be guaranteed. Attention must be paid to the neutral level of the external clock. Neutral level is defined high when data are valid on the rising clock edge. Neutral level is low otherwise. 19.2. Registers The following registers are available once for SPI0 and SPI1 each. SPIxD 7 SPI x Data Register 6 5 r/w 4 3 2 1 0 Bit 7 to 0 of Rx/Tx Data 0 0 SPIxM 0 0 0 0 0 0 2 1 0 x x SPI x Mode Register 7 6 r BIT8 LEN9 RXSEL INTERN NEDGE x w BIT8 LEN9 RXSEL INTERN NEDGE x 0 0 5 0 4 0 3 0 0 BIT8 r/w: Bit 8 of Rx/Tx Data Rx/Tx data bit. LEN9 r/w0: r/w1: Frame Length 9 Bit Selection 8 bit mode. 9 bit mode. RXSEL r/w0: r/w1: Receive Selection Input active. Low level at input. Micronas Res INTERN r/w0: r/w1: Internal/External Clock Selection Use external clock. Use internal clock. NEDGE r/w0: r/w1: Negative Edge Selection Data valid at rising edge. Data valid at falling edge. CSF Clock Selection Field w: (Table 19-2) With these two bits one out of three internal clocks can be selected (see Fig. 19-1 on page 125). Table 19-2: CSF usage CSF CSF 0 0 Res Source of internal clock 1 0 0 0 F0SPI 0 1 F1SPI 1 x F2SPI May 25, 2004; 6251-606-1PD 127 CDC16xxF-E PRELIMINARY DATA SHEET 19.3. Timing wr SPIxD clk out SPIx-D-OUT D8 D7 D6 D5 D4 D3 D2 D1 D0 SPIx-D-IN D8 D7 D6 D5 D4 D3 D2 D1 D0 SPIx Int. Src. Fig. 19-2: Nine bit frame. Data valid at rising edge. wr SPIxD clk out SPIx-D-OUT D7 D6 D5 D4 D3 D2 D1 D0 SPIx-D-IN D7 D6 D5 D4 D3 D2 D1 D0 SPIx Int. Src. Fig. 19-3: Eight bit frame. Data valid at falling edge. 128 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 20. Universal Asynchronous Receiver Transmitter (UART) A UART provides a serial Receiver/Transmitter. A 7-bit or 8bit telegram can be transferred asynchronously with or without a parity bit and with one or two stop bits. A 13-bit baud rate generator allows a wide variety of baud rates. A twoword receive FIFO unburdens the SW. Incoming telegrams are compared with a register value. Interrupts can be triggered on transmission complete, reception complete, compare and break. Features The number of UARTs implemented is given in Table 20-1. The "x" in register names distinguishes the module number. - 13-bit baud rate generator. UAxIF 2 1 0 - 7-bit or 8-bit frames. - Parity: None, odd or even. - One or two stop bits. - Receive compare register. - Two-word receive FIFO. UAxIM 2 r 1 UAxD w 0 UAxCA r compare address register w RCVD BRK ADR RCVD BRK ADR rx FIFO 8 & = 8 8 3 UART Interrupt Source >1 & break & received 2 of 3 rx shift register rx 4 rx control TBUSY FULL EMPTY PAER OVRR FRER BRKD RBUSY tx control 4 3 2 1 0 r 7 6 5 4 3 2 1 0 w STPB clk tx UAxD tx data register w 4 UAxBR1 clk 1 LEN 5 PAR 6 ODD 7 UAxC tx tx shift register 5 bit down cnt zero UAxBR0 clk 8 bit down counter 1/8 fBR fsample zero Fig. 20-1: Block Diagram Micronas May 25, 2004; 6251-606-1PD 129 CDC16xxF-E PRELIMINARY DATA SHEET 20.1. Principle of Operation 20.1.1. General Remarks 20.1.3. Initialization A UART module contains a receive shift register that serves to receive a telegram via its RX input. A FIFO is affixed to it that stores two previously received telegrams. After reset, a UART is in standby mode (inactive). A transmit shift register serves to transmit a telegram via its TX output. Other features include a receive compare function, flexible interrupt generation and handling, and a set of control, error and status flags that facilitate management of the UART by SW. The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. Prior to entering active mode, the U-Ports assigned to function as RX input and TX output have to be properly SW configurated (Table 20-1). The RX port has to be configured Special In and the TX port has to be configured Special Out. Refer to "Ports" for details. For entering active mode of a UART, set the respective enable bit (Table 20-1). Prior to operation, the desired baud rate, telegram format, compare address and interrupt source configuration have to be done. 20.1.3.1. Baud Rate Generator A UART module is not affected by CPU SLOW mode. The receive and transmit baud rate is internally generated. The Baud Rate registers UAxBR0 (low byte) and UAxBR1 (high byte) serve to enter the desired 13bit setting. Write UAxBR0 first, UAxBR1 last. A UART module is only capable of receiving telegrams that differ by no more than 2.5% from its own baud rate setting. The baud rate generator is a 13-bit down-counter which is clocked by fOSC. It generates the sample frequency: A programmable baud rate generator generates the required bit clock frequency. 20.1.2. Hardware settings The polarity of most RX and TX connections of the UART can be set via HW Options (See Table 20-1 and Fig. 20-2). Refer to "HW Options" for setting them. HW Option SR.UARTx 0 UARTx-TX tx fOSC clk f OSC f sample = -------------------------------------------------------------------------------Value of Baud Rate Registers + 1 Its output frequency fsample is divided by eight to generate the baud rate (bit/second). f OSC f sample BR = ---------------------------------------------------------------------------------------------= -------------( Value of Baud Rate Registers + 1 ) x 8 8 SO 1 1 UARTx UARTx-RX 0 rx 1 f OSC --1 Value of Baud Rate Registers = ---------------BR x 8 SI 1 HW Option Fig. 20-2: Context Diagram 20.1.3.2. Telegram Format The format of a telegram is configured in the Control and Status register UAxC. A telegram starts with a start bit followed by the data field. The data field consists of 7 or 8 data bit. There can be a parity bit after the data field. The telegram is finished by one or two stop bits (see Table 20-3 on page 134). 130 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 20-1: Module-specific settings Module Name HW Options UART0 UART1 UART2 Initialization Enable Bit Item Address Item Setting RX inversion FFB4h UART0-RX input U4.4 special in TX inversion FFB4h UART0-TX output U4.5 special out RX inversion FFB5h UART1-RX input U5.7 special in TX inversion FFB5h UART1-TX output U5.4 special out RX inversion FFB4h UART2-RX input U4.2 special in TX inversion FFB4h UART2-TX output U4.3 special out SR1.UART0 SR2.UART1 SR0.UART2 20.1.3.4. Interrupt S 0 1 2 3 4 5 6 7 P T0 T1 S 0 1 2 3 4 5 6 7 T0 T1 S 0 1 2 3 4 5 6 T0 S 0 1 2 3 4 5 6 S = Start bit P = Parity bit Four signals can trigger the UART interrupt source output. Three of them set their own flags in the Interrupt Flag register UAxIF and can be enabled by setting bits in the Interrupt Mask register UAxIM. 1. When the flag TBUSY in register UAxC is set to zero, the interrupt source output is triggered. This indicates that a transmission is finished and the transmit buffer is empty. There is neither an interrupt flag to indicate this event, nor a mask flag to disable this interrupt. 7 P T0 2. RCVD is generated by the receive control logic at the end of each received telegram even if the FIFO is full. This signal is enabled by setting the corresponding bit in register UAxIM. T0 = 1. stop bit T1 = 2. stop bit 3. BRK is generated by the receive control logic each time a break is detected. This signal is enabled by setting the corresponding bit in register UAxIM. Fig. 20-3: Examples of Telegram Formats The level of the start bit is always opposite to the neutral level. The level of the stop bits is always the same as the neutral level. If a parity bit is programmed, odd or even parity can be selected. Table 20-2: Definition of Parity Bit Parity Flag Number of Ones Parity Bit odd odd 0 odd even 1 even odd 1 even even 0 4. ADR is generated by the address comparator. This signal is enabled by setting the corresponding bit in register UAxIM. BRK and ADR also set flags in the Interrupt Flag register UAxIF when enabled. The first RCVD interrupt, when the FIFO has been empty before, sets a flag in UAxIF too. Even if all interrupts are enabled in register UAxIM, the interrupt source output is triggered only once within a telegram. UAxIF flags remain valid until the end of the next telegram. ADR is not generated and the ADR flag is not set if a frame or parity error was detected in the corresponding telegram. 20.1.4. Operation With proper HW configuration and SW initialization, a UART module is ready to transmit and receive telegrams in the selected format. 20.1.4.1. Transmit As a general rule, the parity bit completes the number of ones in the data field to the selected parity. 20.1.3.3. Compare Address The content of the Compare Address register UAxCA is compared with each received telegram. If they match, the interrupt flag ADR is set and the interrupt source signal is triggered. A write access to UART Data register UAxD immediately loads the transmit shift register and starts transmission by sending the start bit. The flag TBUSY in register UAxD is set. At the end of transmission the interrupt source signal is triggered and the flag TBUSY is reset. To avoid data corruption, ensure that flag TBUSY is LOW before writing to UAxD. The MSB of register UAxCA must be set to zero if transmission of a seven bit data field is configured in register UAxC. Micronas May 25, 2004; 6251-606-1PD 131 CDC16xxF-E PRELIMINARY DATA SHEET 20.1.4.2. Receive 20.1.4.3. Receive FIFO A first negative edge of a telegram on the RX line of a UART starts a receive cycle and sets the flag RBUSY in UAxC. After reception of the last bit of the telegram, the telegram content, together with its status information, is transferred to the receive FIFO and an interrupt is generated. RBUSY is reset. Telegram data are available in register UAxD, telegram status in register UAxC. The receive FIFO is able to buffer the data fields of two consecutive telegrams. But not only the data field of a telegram is double-buffered, the related information is double-buffered too. The flags PAER, FRER and BRKD in register UAxC apply to a certain telegram and are thus double-buffered. During reception, the following checks are performed according to the register UAxC setting: 1. A parity error is detected if the parity of the received telegram does not match the programmed parity. The flag PAER in register UAxC is set in this case. Differing telegram length settings in register UAxC and receiver may also cause parity errors. 2. A frame error is detected if the level of start or stop bits violate the transmission rule. The flag FRER in register UAxC is set in this case. 3. A break condition is detected if the receive input remains low for one complete telegram duration. When a break starts during telegram, this condition must extend over another telegram length to be properly detected. This event sets the flag BRKD in register UAxC and can trigger the interrupt source output if enabled. After a break, the receive input must be high for at least 1/4 of the bit length before a new telegram can be received. Telegrams of an external RS232 interface are correctly received, even if they are transmitted without gaps (the start bit immediately follows the stop bit of the preceding telegram). The receive FIFO is full if two telegrams have been received but the SW has not yet read register UAxD. If there is a third telegram, it is not written to the FIFO and its data are lost. The flags EMPTY, FULL and OVRR show the status of the FIFO. EMPTY indicates that there is no entry in the FIFO. FULL will be set with the second entry in the receive FIFO and indicates that there is no more entry free. OVRR indicates that there was a third telegram which could not be written to the FIFO. Status flags are readable as long as the corresponding data field was not read from register UAxD. As soon as a FIFO entry is read out, the status flags of this entry are lost. They are overwritten by the flags of the second entry. SW first has to read the flags and then the corresponding FIFO entry. The flags PAER, FRER and BRKD apply to a certain telegram and are only valid if there is at least one entry in the FIFO (EMPTY = 0). The flags EMPTY, FULL and OVRR apply to the FIFO and are valid all the time. 20.1.5. Inactivation Returning a UART module to standby mode by resetting its respective enable bit (Table 20-1) will immediately terminate any running receive or transmit operation and will reset all internal registers. 20.2. Timing The duration of a telegram results from the total telegram length in bits (LTG) (see Table 20-3 on page 134) and the baud rate (BR). L TG t TG = --------BR The incoming signal is sampled with the sample frequency and filtered by a 2 of 3 majority filter. A falling edge at the output of the majority filter starts the receive timing frame for the telegram. An individual bit is sampled with the fifth sample clock pulse within that timing frame (cf. Fig. 20-4 and Fig. 20-5). If a bit was the last bit of its telegram, reception of a new telegram can start immediately after this sample. With a receive telegram, interrupt source is triggered and flags are set just after the sample of the last stop bit. With a transmit telegram, interrupt source is triggered and BUSY reset after the nominal end of the last stop bit. 132 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 1 2 3 4 5 6 7 8 fsample rxdat asynchron bit 0 startbit bit 1 1. sample 2. sample 3. sample indicates the recognition of the low level of the filtered input signal start data sample clock Fig. 20-4: Start of Telegram 1 2 3 4 5 6 7 8 fsample rxdat asynchron 1. stopbit 2. stopbit startbit 1. sample 2. sample 3. sample start data sample clock Flags are set Rx Interrupts Tx Interrupt BUSY Fig. 20-5: End of Telegram Micronas May 25, 2004; 6251-606-1PD 133 CDC16xxF-E PRELIMINARY DATA SHEET 20.3. Registers UAxD 7 6 5 4 3 r Receive register w Transmit register x x x UAxC 7 r RBUSY w LEN w0: w1: UART x Data Register x 2 1 0 Table 20-3: Telegram Format and Length x x x x Res UART x Control and Status Register 6 BRKD 5 4 FRER OVRR 3 PAER 2 1 0 EMPTY FULL TBUSY 0 x x 0 x 1 0 0 x x x x STPB ODD PAR LEN x x x x 0 0 0 0 RBUSY r0: r1: Receiver Busy Not busy. Busy. BRKD r0: r1: Break Detected No break. Break. FRER r0: r1: Frame Error Detected No error. Error. OVRR r0: r1: Overrun Detected No overrun. Overrun. PAER r0: r1: Parity Error Detected No error. Error. Res ODD w0: w1: Odd Parity Even parity. Odd parity. PAR w0: w1: Parity On No parity. Parity on. 134 STPB Format LTG 0 0 0 S, 7D, T0 9 0 0 1 S, 7D, T0, T1 10 0 1 0 S, 7D, P, T0 10 0 1 1 S, 7D, P, T0, T1 11 1 0 0 S, 8D, T0 10 1 0 1 S, 8D, T0, T1 11 1 1 0 S, 8D, P, T0 11 1 1 1 S, 8D, P, T0, T1 12 UART x Baud Rate Register low byte 7 6 5 w 0 UAxBR1 3 2 1 0 0 0 0 0 0 0 Res UART x Baud Rate Register high byte 7 w 4 Bit 7 to 0 of Baud Rate 0 6 5 x x x - - - 4 3 2 1 0 Bit 12 to 8 of Baud Rate 0 0 0 0 0 Res The Baud Rate Registers UAxBR0 and UAxBR1 have to be written low byte first to avoid inconsistencies. UAxBR0 is the low byte. TBUSY Transmitter Busy r0: Not busy. r1: Busy. Do not write to register UAxD as long as BUSY is true. Stop Bits One stop bit. Two stop bits. PAR UAxBR0 Rx FIFO Full Not full. Full. STPB w0: w1: LEN Res EMPTY Rx FIFO Empty r0: Not empty. r1: Empty. There is at least one entry present if EMPTY is zero. PAER, FRER and BRKD are not valid if EMPTY is set. FULL r0: r1: Length of Frame 7-bit frame. 8-bit frame. Valid entries in the Baud Rate Registers range from 1 to 8191. Don't operate the baud rate generator with its reset value zero. UAxCA 7 UART x Compare Address Register 6 5 w 4 3 2 1 0 0 0 0 Bit 7 to 0 of address 0 May 25, 2004; 6251-606-1PD 0 0 0 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET UAxIM w UART x Interrupt Mask Register 7 6 5 4 3 2 1 0 x x x x x ADR BRK RCVD - - - - - 0 0 0 ADR w0: w1: Mask Compare Address Detected Disable interrupt. Enable interrupt. BRK w0: w1: Mask Break Detected Disable interrupt. Enable interrupt. RCVD w0: w1: Mask Received a Telegram Disable interrupt. Enable interrupt. UAxIF r UART x Interrupt Flag Register 7 6 5 4 3 2 1 0 Test Test Test Test Test ADR BRK RCVD - - - - - x 0 0 Test Reserved for test (do not use) ADR r0: r1: Compare Address Detected No Interrupt. Interrupt pending. BRK r0: r1: Break Detected No Interrupt. Interrupt pending. RCVD r0: r1: Received a Telegram No Interrupt. Interrupt pending. Micronas Res Res May 25, 2004; 6251-606-1PD 135 CDC16xxF-E PRELIMINARY DATA SHEET 21. CAN Manual This manual describes the user interface of the CAN module. For further information about the CAN bus, please refer to the CAN specification 2.0B from Bosch. Features - Bus controller according to CAN Licence Specification 1992 2.0B - Supports standard and extended telegrams - FullCAN: at least 16 Rx and Tx telegrams - Variable number of receive buffers - Programmable acceptance filter Single, group or all telegrams received. - Time stamp for each telegram - Overwrite mode programmable for each telegram The CAN interface is a VLSI module which enables coupling to a serial bus in compliance with CAN specification 2.0B. It controls the receiving and sending of telegrams, searches for Tx telegrams and interrupts and carries out acceptance filtering. It supports transmission of telegrams with standard (11 bit) and extended (29 bit) addresses. The CAN interface can be configured as BasicCAN or FullCAN. It enables several active receive and transmit telegrams and supports the remote transmission request. The number of telegrams which can be handled depends mainly on the size of the communication RAM (16 byte per telegram), the system clock and the transmission speed. A maximum of 254 telegrams can be handled. A mask register makes it possible to receive different groups of telegram addresses with different receive telegrams. Transmitting or receiving of a telegram as well as the occurrence of an error can trigger an interrupt. - Programmable baud rate. Max. 1 MBd @ 8 MHz - Sleep mode CPU Address CAN Bus Error Managem. Logic Global Control and Status Register Data Interrupt Source CAN RAM (Com. Area) Bit Timing Logic Rx. Obj. Protocol Manager Interface Managm. Logic Tx. Obj. Rx/TxBuffer Fig. 21-1: Block diagram of the CAN bus interface 136 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 21.1. Abbreviations BI CAN Bus Interface ID Identifier BTL Bit Timing Logic IML Interface Management Logic CAN Controller Area Network Rx. Obj. Receive Object CA Communication Area RxTg Receive Telegram CO Communication Object Std. ID Standard Identifier CM Communication Mode Std. Tg Standard Telegram CRC Cyclic Redundancy Code TD Telegram Descriptor DLC Data Length Code Tg Telegram EoCA End of CA TQ Time Quantum Ext. ID Extended Identifier Tx. Obj. Transmit Object Ext. Tg Extended Telegram TxTg Transmit Telegram GCS Global Control and Status Register 21.2. Functional Description 21.2.1. HW Description The CAN bus interface consists of the following components: Bit Timing Logic: Scans the bus and synchronizes the CAN bus controller to the bus signal. Protocol Manager: The PM monitors or generates the composition of a telegram and performs the arbitration, the CRC and the bit stuffing. It controls the data flow between Rx/Tx buffer and CAN bus. It also drives the Error Management Logic. Error Management Logic: Adds up the error messages received from the protocol manager and generates error messages when particular values are exceeded. Guarantees the error limitation as per the CAN Spec. V2.0B. Interface Management Logic: The IML scans the Communication Area (CA) in the CAN-RAM for transmit telegrams. As soon as it finds one, it enters it into the Rx/Tx buffer and reports it to the protocol manager as ready for transmission. If a telegram is received, the IML carries out the acceptance filtering, i.e. scans the CA, taking into account the Identifier Mask Register in the GCS, for a Tg with the appropriate address. After correct reception, it copies the Tg from the Rx/ Tx buffer to the CA. The IML also reports to the CPU the valid transfer of a telegram or given errors per interrupt. The interrupt source output of this module is routed to the Interrupt Controller logic. But this does not necessarily select it as input to the Interrupt Controller. Check section "Interrupt Controller" for the actually selectable sources and how to select them. Rx/Tx buffer: This is used to buffer a full telegram (ID, DLC, data) during sending and receiving. Global Control and Status Register: The GCS contains registers for the configuration of the BI. It also contains error and status flags and an identifier mask. The Error Counter and the Capture Timer can be read from the GCS. Micronas Receive Object: The BI enters received telegrams into a matching Rx-Object. It can be retrieved from the application. Transmit Object: The application enters data into the TxObject and reports it ready for transmission. The BI sends the telegram as soon as the bus traffic allows. For the effect of CPU clock modes on the operation of this module, refer to section "CPU and Clock System" (see Table 4-2 on page 34). 21.2.2. Memory Map From the CAN bus interface the user sees two storage areas in the user RAM area. The BI is configured with the Global Control and Status Registers (GCS). It also indicates the status here. The communication area (CA) contains the Rx and Tx telegrams. The communication area lies in the CAN-RAM. The end of the Com. Area is fixed by the first control byte of an object whose 3 MSBs contain only ones (Communication Mode = 7 = EoCA). The area after this is available to the user. The CA consists of communication objects (COs). A CO consists of 6 bytes telegram descriptor (TD), 8 data bytes and the Time Stamp which is 2 bytes long. The TD contains the address (ID) and the length of a telegram (DLC) as well as control bits which are needed for access to the CO and for the transmission of a telegram. In the BasicCAN and the FullCAN versions, all the communication objects have the same, maximum size of 16 byte. Unassigned storage locations in the data area of a CO can be freely used. The maximum number of COs is limited by the time which the CAN interface has to search for an identifier in the Com. Area. May 25, 2004; 6251-606-1PD 137 CDC16xxF-E PRELIMINARY DATA SHEET 21.2.3. Global Control and Status Registers (GCS) timing, error status, output control registers, baud rate prescalers, Tx and Rx error counters as well as the capture timer. The GCS registers can be used to determine the behavior of the CAN interface. As well as flags for the interrupts, halt and sleep modes, they also contain interrupt index, ID mask, bus Communication Area Global Control and Status CTR STR ESTR IDX 0 Control Status Error Status Interrupt Index ID Mask 28 ... 21 ID Mask 20 ... 13 ID Mask 12 ... 5 ID Mask 4 ... 0 Bit Timing 1 Bit Timing 2 Bit Timing 3 Input Control Output Control Transmit Error Counter Receive Error Counter 15 Error Status Mask 16 Capture Timer low 17 Capture Timer high 0 Control 1 ID 28 ... 21 2 ID 20 ...13 ID 12 ... 5 ID 4 ... 0 and Control DLC and Control Data 0 Data 1 Data 2 Data 3 Data 4 Data 5 Data 6 Data 7 Time Stamp low 15 Time Stamp high 16 TD IDM BT1 BT2 BT3 ICR OCR TEC REC ESM CTIM Com.-Obj. 1 Telegram Descriptor TD Com.-Obj. 2 Data and Time Stamp 31 32 TD Com.-Obj. 3 Data and Time Stamp 47 n*16 TD Com.-Obj. n Data and Time Stamp n*16+15 (n+1)*16 Control: CM = 7 End of Com. Area Fig. 21-2: Memory allocation halt acknowledge is indicated in the status register (HACK). Re-initialization can be carried out in the halt mode (HACK is set). After this, the halt flag must be deleted again. After a reset, HLT is set. Access modes: r: read w: write i: init (BI halted) w0: clear w1: set CANxCTR r/w If HLT is set during a Tx-Tg and this has to be repeated (error or no acknowledge), the BI stops yet. The corresponding TxCO is still reserved, however, and can no longer be operated from BI. Therefore, when HLT is set, the CA should always be re-initialized if the last Tx-Tg has not been correctly transmitted (Status Transfer Flag is still deleted). Control Register 7 6 5 4 3 2 1 0 HLT SLP GRSC EIE GRIE GTIE BOST rsvd 1 0 0 0 0 0 0 x Res HLT Halt r/w0: Run. r/w1: Halt. Switches the CAN interface into the halt mode. Transmissions which have been started are brought to an end. The 138 If HLT is set during the BI is in Bus-Off mode, the BI stops after Bus-Off mode is finished. Flag BOFF is cleared then and receive and transmit error counters are reset to zero. SLP Sleep r/w0: Run. r/w1: Sleep. The BI goes into the sleep mode when the sleep flag is set and a started Tg is terminated. The sleep mode is finished as May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET soon as a dominant bus level is detected, or the sleep flag is deleted. all the flags in the error status register are either deleted or masked, ERS is also deleted. GRSC Global Rescan r0: Don't rescan. r/w1: Rescan. The microprocessor can set this flag in order to initiate a transmit telegram search at the beginning of the Com. Area. The BI resets the bit. The BI also sets the GRSC flag if the flag RSC has been set in a telegram descriptor of a Tx-Tg just operated, and thereby initiates a rescan. If the microprocessor writes a zero, nothing happens. As long as a bit is set in the CANxESTR and not masked, the ERS bit is also set in the status register. If EIE has been set in the control register, an interrupt is triggered too; i.e. the value 254 is entered in the register CANxIDX as soon as it is free, and the interrupt source output is triggered. EIE r/w0: r/w1: Error-Interrupt-Enable Disabled. Enabled. GRIE r/w0: r/w1: Global Rx-Interrupt-Enable Disabled. Enabled. GTIE r/w0: r/w1: Global Tx-Interrupt-Enable Disabled. Enabled. CANxESTR r/w BOST Bus-Off Stop Select r/w0: Don't stop when leaving Bus-Off mode. r/w1: Stop when leaving Bus-Off mode. The flag HLT is set by the BI after leaving the Bus-Off recovery sequence. The SW has to restart the CAN module in this case after re-initialisation. Consider the flag HACK even in this case. CANxSTR r Status Register 7 6 5 4 3 2 1 0 HACK BOFF EPAS ERS rsvd rsvd rsvd rsvd 1 0 0 0 x x x x Res HACK Halt-Acknowledge r0: Running. r1: Halted. Is set by the BI when it enters the halt mode. It is deleted again when the halt mode is exited. BOFF Bus-Off r0: Bus active. r1: Bus off. With this flag the BI indicates whether the node is still actively participating in the bus. If the transmit error counter reaches a value of > 255 (overflow), the node is separated from the bus and the flag is set. The Bus-Off mode is left after the Bus-Off recovery sequence. The flag CANxCTR.BOST defines the behavior after leaving Bus-Off mode. EPAS Error-Passive r0: Error active. r1: Error passive. With this flag the BI indicates whether the node is still participating in the bus with active Error Frames. If an error counter has reached a value > 127, the node only transmits passive error frames and the flag is set. ERS Error-Status r0: No Errors. r1: Errors. This flag is set when the BI detects an error and the apropriate error flag is not masked in the error status mask register. It is set even if an error counter is greater than 96. It means that a bit has been set in the error status register. As soon as Micronas To erase a bit in the CANxESTR the user must write a one at the appropriate place. Places at which he writes a zero will not be changed. Because it makes sense to erase only those bits which have previously been read, only the value which has been read has to be re-written. Error Status Register 7 6 5 4 3 2 1 0 GDM CTOV ECNT BIT STF CRC FRM ACK 0 0 0 0 0 0 0 0 Res Read-Modify-Write operations on single flags of this register must be avoided. Unwanted clearing of other flags of this register may be the result otherwise. GDM Good Morning r0: No wake-up. r1: Wake-up. w0: Unaffected. w1: Clear. Is set by the BI when it is aroused from the sleep mode by a dominant bus level. The user must delete it. CTOV Capture Time Overflow r0: No overflow. r1: Overflow. w0: Unaffected. w1: Clear. Is set by the BI when the capture timer (CTIM) overflows. The user must delete it. ECNT Error Counter Level r0: No error counter. r1: Error counter. w0: Unaffected. w1: Clear. Is set by the BI as soon as the transmit error counter or the receive error counter exceeds a limit value. The user must delete it. BIT Bit Error r0: No bit error. r1: Bit error. w0: Unaffected. w1: Clear. Is set by the BI when a transmitted bit is not the same as the bit received. The user must delete the flag. STF Stuff Error r0: No stuff error. r1: Stuff error. w0: Unaffected. w1: Clear. Is set by the BI when 6 identical bits are received successively in one Tg. The user must delete it. CRC r0: r1: w0: May 25, 2004; 6251-606-1PD CRC Error No CRC error. CRC error. Unaffected. 139 CDC16xxF-E PRELIMINARY DATA SHEET w1: Clear. Is set by the BI when the CRC received does not coincide with the CRC calculated. The user must delete it. FRM Form Error r0: No form error. r1: Form error. w0: Unaffected. w1: Clear. Is set by the BI when an incorrect bit is received in a field with specified bit level (start of frame, end of frame, ...). The user must delete it. ACK Acknowledge Error r0: No acknowledge error. r1: Acknowledge error. w0: Unaffected. w1: Clear. Is set by the BI when there is no acknowledge for a transmitted Tg. The user must delete it. CANxBT1 r/w Bit Timing Register 1 7 6 5 4 3 2 1 0 MSAM SYN BPR BPR BPR BPR BPR BPR 0 0 0 0 0 0 0 0 Res MSAM r/w0: r/w1: Multi Sample Bus level is determined only once per bit. Bus level is determined three times per bit. SYN r/w0: r/w1: Sync On Synchronization with falling edges only. Synchronization with rising edges too. BPR Baud Rate Pre-scaler r/w: Pre-scaler value. The baud rate pre-scaler sets the length of a time quantum for the bit timing logic. tQ = tXTAL x (BPR + 1). CANxIDX 7 Interrupt Index Register 6 5 r/w 4 3 2 1 With the 6-bit counter it is possible to extend tQ by a factor of 1...64. Values from 0 to 63 are allowed. 0 Interrupt Index 1 1 1 1 1 1 1 1 Res The interrupt index indicates the source of the interrupt. If a transmission has been the cause of an interrupt, the interrupt index points to the corresponding telegram descriptor (CANxIDX = 0..253). If an error has been responsible for the interrupt, the interrupt index designates the error status register (CANxIDX = 254). After dealing with the interrupt, the user must eliminate the cause of the interrupt and set the interrupt index to minus one (255 = EMPTY). As soon as CANxIDX is empty, the BI can enter a new index and initiate an interrupt. An interrupt can only be initiated when CANxIDX contains the value 255. CANxIDM 7 Identifier Mask Register 6 5 4 3 2 r/w Identifier Mask Bits 29 to 21 r/w Identifier Mask Bits 20 to 13 r/w Identifier Mask Bits 12 to 5 r/w Identifier Mask Bits 4 to 0 0 0 0 0 0 1 0 low CANxBT2 r/w x x high 0 0 0 Res etc. Bit Timing Register 2 7 6 5 4 3 2 1 0 rsvd TSEG2 TSEG2 TSEG2 TSEG1 TSEG1 TSEG1 TSEG1 0 0 0 0 0 0 0 0 Res TSEG2 Time Segment 2 r/i: TSEG2 value. TSEG2 determines the number of time quanta after the sample point. Permitted entries: 1...7 (result in 2...8 TQ). TSEG1 Time Segment 1 r/i: TSEG1 value. TSEG1 determines the number of time quanta before the sample point. Permitted entries: 2...15 (result in 3...16 TQ). CANxBT3 x r/w0: Don't care. r/w1: Compare. The identifier mask register is 29 bits long; the MSB is in the MSB position in the lowest byte address. The CANxIDM defines a mask for the acceptance of address groups. Only the permitted bits are used for comparison with a received identifier. Whether the mask is used can be determined individually for each receive object. 140 0: tQ = tXTAL 1: tQ = tXTAL x 2 2: tQ = tXTAL x 3 3: tQ = tXTAL x 4 r/w Bit Timing Register 3 7 6 5 4 3 2 1 0 rsvd rsvd rsvd rsvd rsvd SJW SJW SJW x x x x x 0 0 0 Res SJW Synchronization Jump Width r/i: SJW value. SJW defines by how many TQs a bit may be lengthened or shortened because of resynchronization. Permitted entries: 1...4 (result in 1...4 TQ). Values greater than 4 must not be used. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET CANxICR r/w Input Control Register CANxESM 7 6 5 4 3 2 1 0 rsvd rsvd rsvd rsvd rsvd XREF REF1 REF0 x x x x x 0 0 0 r/w External Reference The internal reference is used. The external reference is used where avail- REF1 r/w0: r/w1: nal. Use Reference for RxD1 RxD is used as inverted input signal. Supply voltage is used as inverted input sig- REF0 r/w0: r/w1: Use Reference for RxD0 RxD is used as input signal. Ground is used as input signal. CANxOCR r/w Output Control Register 7 6 5 4 3 2 1 0 rsvd rsvd rsvd rsvd rsvd rsvd rsvd ITX x x x x x x x 0 ITX r/w0: r/w1: Res Inverted transmission Tx output is not inverted. output is inverted. CANxTEC 7 Transmit Error Counter 6 5 r 4 3 2 1 0 0 0 0 0 0 5 4 3 2 1 0 EGDM ECTV EECT EBIT ESTF ECRC EFRM EACK 1 1 1 1 1 1 1 1 Every flag of the CANxESTR can be enabled/disabled generating an interrupt by modifying the corresponding flag in register CANxESM. EGDM r/w0: r/w1: Enable Good Morning Disable. Enable. ECTV r/w0: r/w1: Enable Capture Time Overflow Disable. Enable. EECT r/w0: r/w1: Enable Error Counter Level Disable. Enable. EBIT r/w0: r/w1: Enable Bit Error Disable. Enable. ESTF r/w0: r/w1: Enable Stuff Error Disable. Enable. ECRC r/w0: r/w1: Enable CRC Error Disable. Enable. EFRM r/w0: r/w1: Enable Form Error Disable. Enable. EACK r/w0: r/w1: Enable Acknowledge Error Disable. Enable. 0 Res CANxCTIM CANxREC 7 r Receive Error Counter 6 5 x x 4 3 2 7 1 Res 0 Counter Bit 7 to 0 0 6 Res XREF r/w0: r/w1: able. Error Status Mask Register 7 6 Capture Timer 5 4 3 2 1 0 0 r Timer Bit 7 to 0 low r Timer Bit 15 to 8 high Counter Bit 6 to 0 0 0 0 0 0 0 0 Res 0 0 0 0 0 0 0 0 Res The Capture Timer is incremented with a clock pulse derived from the CAN bus. As it can only be read byte-wise, the low byte must be read first. The corresponding high byte is latched at the same time. When CANxCTIM overflows, the flag CTOV in the error status register is set. The Capture Timer will not be incremented during CAN module sleep mode (SLP = 1). Micronas May 25, 2004; 6251-606-1PD 141 CDC16xxF-E PRELIMINARY DATA SHEET 21.2.4. Communication Area (CA) The CA is located in the CAN-RAM. It consists of com. objects each of which is 16 bytes long. The CA begins at address 0 of the CAN-RAM with the first byte of a CO. It ends with the first byte of a CO which contains ones in its 3 MSBs (communication mode = 7 = EoCA). The following bytes can be used by the application. If the CAN-RAM is filled completely with COs, there is no place left and no need to mark the end of CA. Every telegram which this node is to receive or transmit, is represented by a CO. As well as the data and the time stamp, this also contains a header, the telegram descriptor (TD), in which the attributes of the communication object are stored. The COs are entered into the CA in order of priority . This starts with the highest priority (the lowest identifier). The identifier defines the priority of a Tg. If the first eleven bits of an ext. Tg are the same as the identifier of a std. Tg, the Tg with standard identifier has higher priority. 21.2.4.1. Telegram Descriptor (TD) The telegram descriptor is 6 bytes (TD0 to TD5) long and forms the beginning of a CO. Telegrams with std. and ext. identifiers have different TDs. They differ only in the length of the identifiers. 18 bits are therefore not allocated in the TD of a std. Tg. They cannot be used by the application because they are overwritten by the reception of a Tg. Standard Addr. Format (EXF is deleted) Extended Addr. Format (EXF is set) 0 7 6 5 CM 4 3 2 RSC MID OW 1 0 rsvd LCK 0 7 6 5 CM 4 1 28 ID 21 1 28 2 20 ID 13 2 20 3 12 ID 5 3 0 EXF RSR ACC 4 don't use 5 DLC 4 4 5 ID DLC TIE RIE SR TS 3 2 RSC MID OW 1 ID ID 0 rsvd LCK 21 don't use 18 don't use EXF RSR ACC TIE RIE SR TS Fig. 21-3: Extended and Standard TD Map cessed, the search for active Tx objects is started at the beginning of the communication area. Otherwise, the search continues at this transmit object until the end of the CA is reached. From there, the system jumps back to the beginning of the CA. Forms of access: r: read w: write i: init (BI halted or CM = inactive) w0: clear w1: set CM Communication Mode r/i: Mode. CM defines the type of telegram. 0: Inactive 1: Send 2: Receive 3: Fetch 4: Provide 5: Rx-All 6: rsvd 7: EoCA Inactive. No participation in the bus traffic. Send data. Receive data. Fetch data via remote frame. Have data fetched via remote frame. Receive every telegram. Don't use (provis. EoCA). End of Communication Area. As long as the CO is inactive (CM = 0) or locked (LCK = TRUE), the BI accesses the first byte of the CO only by reading. All other bytes are neither read nor written. The inactive mode is suitable therefore for re-configuration of a CO online; i.e. while the node is taking part in the bus traffic. RSC r/w0: r/w1: If the rescan 142 Rescan Don't rescan. Rescan. bit has been set in a transmit object just pro- MID Mask Identifier r/w0: Don't mask. r/w1: Mask. If MID has been deleted, the identifier received is compared bit-by-bit with the identifier from the telegram descriptor, i.e. the entire identifier must be the same so that the telegram received is transferred into this CO. If MID has been set, only bits which are allowed in the ID mask register of the GCS are used for the comparison. OW Overwrite r/w0: Don't overwrite. r/w1: Overwrite. When OW is set, the com. object may be overwritten even if the application has not yet fetched the contents (TS set). The BI must of course obtain right of access (LCK deleted). LCK Lock r/w0: BI has right of access. r/w1: BI does not has right of access. Lock determines the right of access for the BI. ID r/i: May 25, 2004; 6251-606-1PD Identifier Identifier. Micronas CDC16xxF-E PRELIMINARY DATA SHEET The ID contains the address of the telegram. 11 bits in the standard mode or 29 bits in the extended mode. ACC Access r/w0: CPU does not have right of access. r/w1: CPU has right of access. Access determines the right of access for the CPU. The CPU should not modify this flag after initialization. In operation mode only the BI modifies it and the CPU reads it. RSR Remote Send Request r/w0: Remote telegram received. r/w1: Corresponding data transmitted. In the provide mode, RSR signals a send request from outside; in the fetch mode it means that a remote Tg is being sent. It is set by the BI if a remote telegram has been received. It is deleted as soon as the corresponding data telegram has been transmitted. EXF Extended Format r/w0: Standard. r/w1: Extended. In order to send/receive telegrams with extended address format, this flag must be switched on. For standard telegrams it is deleted. DLC Data Length Code r/w: Data length. The DLC defines the number of data bytes transmitted. Only telegrams with 0 to max. 8 data bytes are transmitted. If the DLC of a TxTg contains a value >8, the entered DLC and exactly 8 bytes will be transmitted. In the case of RxTgs the received DLC, and therefore also values > 8 will be entered by BI. TIE Tx Interrupt Enable r/w0: Disable. r/w1: Enable. Masks the Tx interrupt for this com. object. SR Send Request r0: Successful transmission. r/w1: Send request. With SR, the microprocessor issues a send request. Both the microprocessor and the BI write the SR flag. If the microprocessor writes a one, the telegram is sent. The BI deletes the SR flag after successful transmission. TS Transfer Status r/w0: Ready for Transfer. r/w1: Successful transfer. The TS flag is set by BI after a successful transfer and is deleted by the microprocessor after a com. object has been processed. 21.2.4.2. Data Field The data field consists of 8 Byte. They are filled with telegram data according to the DLC. Unused data bytes (DLC less than 8) can be used by the user. 21.2.4.3. Time Stamp TIMST Time Stamp r: Counter value. The last two bytes in the CO are used for the time stamp. At each SoF (Start of Frame) the free-running 16-bit counter CANxCTIM is loaded into a register. When the Tg has been correctly transmitted, this register is copied to the two time stamp bytes of the corresponding CO. Data 5 Data 6 Data 7 14 Time Stamp low 15 Time Stamp high RIE Rx Interrupt Enable r/w0: Disable. r/w1: Enable. Masks the Rx interrupt for this com. object. Fig. 21-4: Time stamp 21.3. Application Notes 21.3.1. Initialization Table 21-1: Module-specific settings After reset, a CAN Module is in standby mode (inactive). Prior to entering active mode, proper SW configuration of the U-Ports assigned to function as RX input and TX output has to be made (Table 21-1). The RX port has to be configured Special In and the TX port has to be configured Special Out. Refer to "Ports" for details. For entering active mode of a CAN, set the respective enable bit (Table 21-1). In the initialization phase, a configuration of the CAN node takes place. The mode of operation of the BTL and the bus coupling is set. The communication area is created in the CAN-RAM. The different telegrams are specified in it. Module Name CAN0 CAN1 CAN2 The CAN node must be halted (HACK = TRUE) to carry out the initialization. After a reset, the flags HLT and HACK are set and initialization can take place. If initialization is required on-line, the flag HLT must be set. However, the BI must ter- Micronas May 25, 2004; 6251-606-1PD Initialization Enable Bit Item Setting CAN0-RX input U6.6 special in CAN0-TX output U6.7 special out CAN1-RX input U1.6 special in CAN1-TX output U1.7 special out CAN2-RX input U4.0 special in CAN2-TX output U4.1 special out SR0.CAN0 SR3.CAN1 SR3.CAN2 143 CDC16xxF-E PRELIMINARY DATA SHEET minate any current transmission before it comes to a halt. For the user this means that he must wait until HACK has been set. If HLT is deleted after initialization, then BI begins to participate in the bus traffic and to scan the CA for tasks. During initialization, the error status register (CANxESTR) and the interrupt index (CANxIDX) should be deleted, otherwise no interrupts can be initiated. The error status mask register default value after reset is not masked. If telegrams with different identifiers are to be received in a single CO, the identifier mask register must be initialized. This defines which bit of the ID received must be the same as the ID in the CO. Bit timing registers 1, 2 and 3 and the output control registers 1 and 2 must be initialized in all cases. The CA must be created in the CAN-RAM. The different COs are created one after the other starting at the address 0. It is important at this point that the three MSBs have been set in the first byte after the last CO, i.e. at an address divisible by 16 (CM = End of CA). This is not necessary if the CAN-RAM is completely filled with COs. Communication mode (CM), identifier, data length code, extended format flag (EXF) and remote send request flag must be initialized in each CO. Lock flag (LCK) must be deleted and access flag (ACC) must be set, in order that the BI may also view this CO. Transfer status flag (TS) must be deleted so that interrupts are not initiated erroneously. 21.3.2. Handling the COs 21.3.2.1. Principles If the user wishes to access a CO, then he must lock out the BI from access to it. Also the BI reserves access for itself to one CO. In this case the user may not have access. When scanning the CA, the BI ignores inactive or locked COs; i.e. it reads only the first byte and then jumps to the next CO. Reservations Procedure If the user wants to access a com. object, he must first set LCK. Then he must read ACC. If it is TRUE, he has right of access. After the operation he must delete LCK. LCK = TRUE; if (ACC == TRUE) { /* CPU has right of access */ } LCK = FALSE; _______________ or _________________ LCK = TRUE; while (ACC == FALSE) { /* wait until BI is ready */ } /* CPU has right of access */ LCK = FALSE; Fig. 21-5: Access to a CO by the user When the BI is accessing a com. object, it first deletes ACC and then reads LCK. If LCK is FALSE, it has right of access. 144 ACC = FALSE; if (LCK == FALSE) { /* BI has right of access */ } ACC = TRUE; Fig. 21-6: Access to a CO by the BI The BI does not wait at a CO until it becomes free. The BI scans the CA from beginning to end. After a TxTg has been transmitted, the next TxTg entered is reported ready to send. It makes sense to enter the COs in the CA in order of their priority. The priority is determined by the ID. The lowest ID has the highest priority. If the first bits of an extended ID are identical with a standard ID, the standard ID has higher priority. The CO with the highest priority is at the beginning of the CA. This ensures that Tx-Tgs with high priority are transmitted first when a rescan is initiated. 21.3.2.2. Configuration A CO may be configured only in the inactive and/or locked mode or when HACK has been set. Otherwise it can lead to access conflicts between the user and BI. The communication mode (CM) is determined in the configuration phase. The identifiers are also entered. The flag EXF must not be overlooked. The flag RSR and DLC determine whether and how many data bytes will be transmitted in the telegram. The interrupts can be permitted. In case of a receive telegram it is necessary under certain circumstances to set the flags MID and OW. In case of a transmit telegram, the flag RSC must be adjusted. 21.3.2.3. Transmit Telegram CM = Send A transmit telegram is used to send data. How many data bytes will be sent is fixed in the DLC. The data is entered directly after the TD. Unused data bytes can be freely used by the user. If after the transmission of this telegram the user would like the next Tx-Tg in the CA to be sent, he deletes the RSC flag. If he sets the RSC, then the transmit search starts again at the beginning of the CA. The RSR flag has to be deleted. The set SR flag tells BI that this telegram is to be sent; SR can be likened to a postage stamp. The TS flag must be deleted before the CO is released with the deletion of LCK. If the BI finds a CO whose SR flag has been set, it reserves this (ACC = FALSE) and reports it "ready to send". It will be transmitted as soon as no higher-priority telegrams occupy the bus. After successful transmission, it deletes the flag SR and sets TS. The setting of ACC re-releases the CO. Whether an interrupt will be triggered depends on whether CANxIDX in the GCS contains the value minus one (255) and transmit interrupts are permitted. The user should now reserve the CO, reset the flag TS and delete CANxIDX so that other interrupts can also be reported. Should he wish to send further data, he can now enter this. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET /* copy data */ TS = FALSE; LCK = FALSE; 21.3.2.4. Receive Telegram CM = Receive With a receive telegram, data is received. If the EXF flag and the unmasked bits of the identifier of a received telegram are the same as those of a receive CO, the telegram will be copied to the CO. ID, DLC and data bytes are overwritten by the received ID, DLC and data. Only as many data bytes as the received DLC specify will be overwritten (max. 8). The DLC actually received will be entered. A permitted receive CO is only used when TS has been deleted or OW has been set. Once a telegram has been received and copied to a CO, the flag TS is set. An interrupt will also be initiated if receive interrupts are permitted and CANxIDX contains the value minus one (255). If the user detects the reception of a telegram (TS set), he must reserve the CO. Then he can read the data and, before releasing the CO again, delete TS. 21.3.2.5. Receive All Telegrams CM = Rx-All If, while searching for an RX-CO, the BI comes across a free Rx-All-CO, the received telegram will be entered here without regard to ID and EXF. /* release CO */ Instead of waiting for the answer, it is also possible for notification to be given by a receive interrupt. 21.3.2.7. Provide Telegram CM = Provide A provide CO is used to prepare data for fetching. It is the counterpart of a fetch CO. In a provide CO the RSR flag is cleared. It will be set and deleted by the BI. The data can be prepared in two ways: In the first case, the user does not become active until a remote frame has been received (Rx interrupt or polling from RSR). After the CO has then been reserved, the data is written, the SR flag is set and the CO is released. The BI then ensures that the data is transferred back. In the second case, the data has already been entered, SR has been set and TS deleted before the request. When the remote frame is received, the user does not need to become active. Also, no Rx interrupt will be initiated. The data is simply fetched. In this case the requesting RTR telegram must contain the correct DLC because, with an RTR telegram too, a received DLC overwrites the local DLC. Rx-All-COs should be applied at the end of the CA. In both cases a Tx interrupt can occur after the data telegram has been transmitted. 21.3.2.6. Fetch Telegram 21.3.2.8. Data Length Code CM = Fetch The data length code is 4 bits long. It can therefore contain values between 0 and 15. In principle, no more than 8 bytes can be transmitted. Empty data telegrams (DLC = 0) are also possible. A fetch CO is used to request data from another node. This is done by sending a telegram with the identifier of the desired data. The remote transmission request flag is set in this Tg. No data is therefore sent with it. If another node has the desired data available, this is transmitted with the same ID as soon as bus traffic allows. If a telegram with a DLC greater than 8 is received, this value will be written into the DLC of the CO, but exactly 8 bytes of data will be copied. In this mode, only the reception of the data telegram can trigger an interrupt. If the DLC of a Tx-CO contains a value greater than 8, this DLC will be transmitted, but only 8 bytes of data. The sequence of a fetch cycle is represented for the user in pseudo-code. 21.3.2.9. Overwrite Mode if (TS == FALSE && SR == FALSE) /* CO is empty */ { LCK = TRUE; /* claim CO */ /* wait until BI released this CO */ while (ACC == FALSE) {/* do anything else */} SR = TRUE; /* send this Tg */ TS = FALSE; LCK = FALSE; /* release CO */ } The BI normally processes a CO only when the transfer status TS has been deleted; i.e. the user has processed the CO since the last transmission. In the case of COs with which telegrams are received, the TS flag can be by-passed. If overwrite (OW) is permitted, the BI may overwrite a previously received telegram. When accessing data therefore, the user always receives the most up-to-date data. The BI now transmits the telegram with the RTR flag set. The other node receives the Tg, provides the data and returns the telegram with RTR flag deleted. After the reply telegram has been received, the BI sets the flag TS. The user waits for the data. All interrupts are enabled or disabled by the global interrupt enable flags, GTIE for Tx interrupts, GRIE for Rx interrupts and EIE for error interrupts in the CANxCTR register. Each error interrupt can also be masked individually in the Error Status Mask register. A Tx interrupt can be enabled in the corresponding CO with the Tx interrupt enable flag TIE. An Rx interrupt can be enabled in the corresponding CO with the Rx interrupt enable flag RIE. /* wait for answer */ while (TS == FALSE) {/* do anything else */} LCK = TRUE; /* claim CO */ /* wait until BI released this CO */ while (ACC == FALSE) {/* do anything else */} Micronas 21.3.3. Interrupts An interrupt can only be initiated when the interrupt index CANxIDX is empty (minus one). To initiate an interrupt, the BI enters the number (0...253) of the appropriate CO in the May 25, 2004; 6251-606-1PD 145 CDC16xxF-E PRELIMINARY DATA SHEET CANxIDX. When an error interrupt is involved, the number 254 is entered. The BI attempts to initiate an interrupt immediately after successful transfer. If this does not work (CANxIDX not empty), the interrupt is pending (also error interrupt). The BI permanently scans the CA. If, while doing so, it finds a CO whose interrupt condition is satisfied (e.g. TIE and TS are set), it generates an interrupt. This means that interrupts not yet reported will not be reported in the sequence of their occurrence, but in the sequence in which they are discovered later. The interrupt service routine of the user must read the CANxIDX. The interrupt source is stored here. If CANxIDX points to a CO (0...253), the user must reserve this. After this, he must first delete TS so that this CO does not initiate an interrupt again. Only then he may release CANxIDX (CANxIDX = 255) so that the BI can enter further interrupts. 21.3.4. Rescan The normal transmit strategy searches for the next transmit CO in the CA. If all the transmit COs are ready to send, they are processed one after the other. This is a democratic strategy. If higher-priority TxTgs are reported in the meantime, these are not processed until the complete list has been finished. With rescan, the search for Tx telegrams is started again at the beginning of the CA. By this means the user can force the normal strategy to be interrupted and a search to be made first of all for higher-priority TxTgs. A transmit CO already reported will of course be transmitted first. The rescan requirement can be achieved dynamically, when a transmit CO is reported, by setting the global rescan flag GRSC. It is also possible to configure a rescan strategy statically. Each Tx-CO has the rescan flag RSC. If it is set, the system starts from the beginning with the transmit search after this CO has been processed. It is possible, for instance, to set RSC in the low-priority Tx-COs. Each time a low-priority TxCO has been handled, the search continues for higher-priority objects. The user must ensure that each Tx-CO is processed. tus register. This means that the value 254 is written in CANxIDX and an interrupt is generated when EIE has been set. An error interrupt is deleted by first deleting CANxESTR and then releasing CANxIDX. The 5 flags BIT, STF, CRC, FRM and ACK originate from the protocol manager. The flag GDM (Good Morning) is not an error flag. GDM is set when the BI is aroused from the sleep mode by a dominant bus level. The flag ECNT (error counter level) indicates that an error counter has exceeded a limit value. It is set when the transmit error counter exceeds the values 95, 127 and 255 or the receive error counter exceeds the values 95 and 127. When the BI is in the Bus-Off mode, it no longer actively participates in the bus traffic. Nor does it receive telegrams, but continues to observe the bus. As soon as the BI has detected 128 x 11 successive recessive bits, it either reverts to the error-active mode if flag BOST is zero, or it sets the flag HLT and enters the HALT mode if flag BOST is set. At the same time the error counters are cleared. A Bus-Off sequence triggers two interrupts, if the error interrupt is enabled. The first interrupt (ECNT=TRUE) indicates that the transmit error counter has exceeded the value 255. This means that the module is in the Bus-Off mode now (BOFF=TRUE). The receive error counter is used to count the reception of 128 x 11 successive recessive bits in the Bus-Off mode. This is the reason for the second interrupt (ECNT=TRUE), which indicates that the receive error counter has exceeded the value 95 (warning level). The second interrupt can be ignored in Bus-Off mode. The error interrupt can be disabled during Bus-Off mode to avoid this second interrupt. 21.3.7. Layout of the CA The CA contains all COs beginning with the lowest identifier. The three MSBs must be set in the byte after the last CO (End of CA). If the BI has received an identifier complete, it starts at the beginning of the CA with the search for an appropriate RxCO. If a rescan is initiated, the BI also starts from the beginning with the transmit search. 21.3.7.1. Buffers 21.3.5. Time Stamp The time stamp of a CO shows the user how much time has elapsed since the transmission of the object. For this purpose, he compares the time stamp with the capture timer CANxCTIM. Because the time stamp contains the value of the CANxCTIM at the time of the start of transmission, the difference is proportional to the time which has elapsed. Several successive receive COs may be allocated with the same identifier. The BI stores a received Tg in the first free Rx-CO. Using this mechanism it is possible to construct a receive buffer. If RIE is set in the last CO, the CPU is not informed until the buffer is full. 21.3.7.2. Basic/Full CAN The time stamp mechanism also enables network-wide synchronization. A master transmits a Tg. All nodes note the transmission time (local time). Then the master transmits its own (global) transmission time. The difference between local and global time shows by how much one's own clock (timer) is wrong. For a Basic CAN application, a single Tx-CO will be used. All outgoing telegrams will be transmitted with this. The user must receive all Rx-Tgs and must himself decide whether he needs it (acceptance filtering). For this case it is possible to use an Rx-All-CO. But it is necessary to ensure that this can be processed before the next Tg arrives. 21.3.6. Errors For this reason, it is a good idea to employ 2 or 3 Rx-All-COs as buffers after the Tx-CO. In the error status register (CANxESTR) error messages and status data are collected which can generate an error interrupt. As long as a flag is set in the CANxESTR and not masked in the CANxESM, the flag ERS is also set in the sta- In the case of a FullCAN application, one uses the built-in acceptance filtering and sets up a CO specifically for each desired Rx-Tg and Tx-Tg. 146 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET If the CAN-RAM is not big enough, mixed strategies are also possible. The acceptance filtering, of course, burdens the CPU with communication tasks. Tx-objects, and 2 Rx-buffers TD: CM=Send Tx-Obj TD: CM= Rec. All Rx-Obj Rx-Obj Rx-Obj TD: CM= Rec. All Rx-Obj TD: CM= Rec. All End of Com. Area TD: CM= Rec. All Rx-Obj TD:CM = 7 TD: CM= Rec. All Rx-Obj TD:CM = 7 End of Com. Area TD: CM=Send Tx-Obj TD: CM= Rec. All Fig. 21-7: Example: CA of a BasicCAN with 2 Rx-buffers TD: CM= Receive Rx-Obj TD: CM=Send Tx-Obj Fig. 21-9: Example: CA of a BasicCAN with 4 Rx-buffers 21.3.7.3. Bus Monitor TD: CM=Send Tx-Obj TD: CM= Receive Rx-Obj With some Rx-All-COs it is possible to construct a userfriendly bus monitor. The CPU has merely to observe whether anything has been received. The contents of the CO must be stored. The transmission time can be calculated from the time stamp. 21.3.7.4. Maximum number of COs TD: CM= Rec. All The maximum number of COs depends on the size of the CAN-RAM, the baud rate, the system clock, the BI and the CPU accesses to the CAN-RAM. - The BI can handle a maximum of 254 objects. The limiting factor is the 8-bit register CANxIDX in the GCS. CANxIDX can contain 256 different values. The values 255 (empty) and 254 (error) are reserved. The remaining values 0...253 can indicate 254 objects. Rx-Obj TD: CM= Rec. All Rx-Obj TD:CM = 7 End of Com. Area - The maximum number of COs is, of course, limited to a greater extent by the size of the CAN-RAM. The BI can only access the CAN-RAM. Therefore the CA can only be applied there. 16 bytes are reserved for each CO. One extra byte for coding EoCA after the last CO must not be forgotten. The CAN-RAM area after the EoCA is freely available to the user. No EoCA is necessary if the CAN-RAM is filled completely with COs. Fig. 21-8: Example: CA of a FullCAN with 2 Rx-objects, 2 Micronas May 25, 2004; 6251-606-1PD 147 CDC16xxF-E PRELIMINARY DATA SHEET There is a maximum number of 16 COs possible in a CAN-RAM of 256 bytes. Z BI K BI = ------ZG K BI t CA SCAN Max. Number CO = ---------------------------------t CO SCAN CAN RAM Size Max. Number CO = ----------------------------------------16 - The next limiting factor can be calculated from the baud rate and system clock. After the BI has received an identifier, it must be possible for it to scan the entire CA before the telegram comes to an end. ZBI is the number of BI cycles in the total cycles (ZG), over a relatively long period (mean value). KBI therefore represents a correction factor. Example for an 8-bit CPU: t CA SCAN Max. Number CO = ---------------------t CO SCAN t CO SCAN = 9 t XTAL t CA SCAN = 28 t Bit t Bit = ( 3 + TSEG1 + TSEG2 ) t Q t Q = ( BPR + 1 ) t XTAL tCA Scan is the time from having received an ID to the end of a minimum telegram (11 bit ID, no data), which is at the BI's disposal to scan the CA. The Load and Store-Accu commands require 4 cycles. OP code Adr.L Adr.H DB Of the 4 cycles, only the last occupies the CAN-RAM. If a block move without loop is programmed, LDA 600; STA 680; LDA 601; STA 681; etc. then only 3 of 4 cycles remain for the BI, i.e. 75%. KBI would then be 0.75. The maximum number of COs is then 18. This applies only when source and destination lie in the CANRAM. If one of the two lies outside, then KBI is 0.875. tCO Scan is the worst case time needed by the BI to process an object (A value of 6 I/O cycles is a more realistic size than 9). If, of course, a loop is programmed, LDA 600,X ZBI = 3 of 4 STA 680,X ZBI = 3 of 4 DEX ZBI = 2 of 2 BNE NXT ZBI = 2 of 2 With an input frequency of 8 MHz and a baud rate (1/tbit) of 1 MBd, the BI could handle 24 COs. Naturally, this value needs to be rounded off. 10 of 12 cycles are available to the BI. This gives a KBI of 0.833. The BI can then handle 20 COs. If source or destination are not in the CAN-RAM, there are as many as 22. - The value thus calculated is further limited, however, by the CPU accesses to the CAN-RAM. Each I/O cycle required by the CPU to write or read data in the CANRAM is missing from the BI. The BI is halted by CPU accesses. This reduces the time which the BI has to scan the CA. Where there is a reduced CPU clock, in particular, the user should have only limited access to the CANRAM. Example for an 16-bit CPU: The Load and Store-Accu commands require 5 cycles. OP code Adr.L Adr.H DBL DBH Of the 5 cycles, the last two occupy the CAN-RAM. In the worst case, 3 of 5 cycles remain for the BI, i.e. 60%. KBI would then be 0.6. The maximum number of COs is then 14. 21.4. Bit Timing Logic In the bit timing logic the transmission speed (baud rate) and the sample point within one bit will be configured. By shifting the sample point it is possible to take account of the signal propagation delay in different buses. Furthermore, the nature of the sampling and the bit synchronization can also be defined. 21.4.2. Bit Timing A bit duration consists of a programmable number of TQCLK cycles. The cycles are split up into the segments SYNCSEG, TSEG1 and TSEG2. 21.4.2.1. Bit Timing Definition 21.4.1. Baud Rate Pre-scaler The baud rate pre-scaler is a 6-bit counter. It divides the system clock down by the factor 1...64. The output is the clock for the bit timing logic. This clock TQCLK defines the time quantum (tQ). The time quantum is the smallest time unit into which a bit is subdivided. 148 Sync.Seg. It is expected that a bit will begin in the synchronization segment. If the bit level changes, the resynchronization ensures that the edge lies inside this segment. The sync.seg is always one time quantum long. Prop.Seg. This part of a bit is necessary to compensate for delay times May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET of the network. It is twice the sum of the signal propagation delay on the bus plus input comparator delay plus output driver delay. of time quanta by which a bit may be lengthened or shortened by resynchronization. Phase Seg. Phase segments 1 and 2 are necessary to compensate phase differences. They can be lengthened or shortened by resynchronization. t Bit = t SYNCSEG + t TSEG1 + t TSEG2 t Q = t XTAL ( BPR + 1 ) Sample Point The bus level is read at this point and interpreted as a received bit. t SYNCSEG = 1 t Q t TSEG1 = ( TSEG1 + 1 ) t Q TSEG1 The CAN implementation combines propagation delay segment and phase segment 1 to form time segment TSEG1. t TSEG2 = ( TSEG2 + 1 ) t Q TSEG2 TSEG2 corresponds to phase segment 2. t SJW = SJW t Q SJW The synchronization jump width gives the maximum number tBit Sample Point 1 Time quant Sync Seg tSYNCSEG Prop Seg Phase Seg1 Phase Seg2 tTSEG2 tTSEG1 def. CAN-SPEC impl. CAN Fig. 21-10: Bit Timing Definition The baud rate is then calculated as follows: The information processing time is the internal processing time. After reception of a bit (sample point) this time is needed to calculate the next bit for transmission. With a baud rate of 1 MBd a bit should be at least 8 tQ long. 1BR = ------t Bit In case of a triple sample mode (MSAM = 1), the following boundary condition must also be observed: t Bit = t XTAL ( BPR + 1 ) ( 3 + TSEG1 + TSEG2 ) f XTAL BR = ---------------------------------------------------------------------------------------( BPR + 1 ) ( 3 + TSEG1 + TSEG2 ) t TSEG1 t PROP + t SJW + 2t Q 21.4.2.2. Bit Timing Configuration Certain boundary conditions need to be observed when programming the bit timing registers. The correct location of the sample point is especially important with maximum bus length and at high baud rate. t TSEG2 2 t Q t TSEG2 t SJW t TSEG1 3 t Q t TSEG1 t TSEG2 t TSEG1 t PROP + t SJW Micronas = Information Processing Time The triple sample mode offers better immunity to interference signals. In the single sample mode a higher transmission speed is possible. For high baud rates and maximum bus length, neither SYN nor MSAM may be switched on. Bosch advises against both adjustment facilities. When an input filter matched to the baud rate or a bus driver is used, the triple sample mode is not necessary. If SYN is set, synchronization will also be made with the soft edge (dominant to recessive) and this will mean higher demands being imposed on the clock tolerances. 21.4.2.3. Influence of ERM on CAN Timing When 29 bits are transferred without intermediate resynchronization and with a synchronization jump width of 4 time May 25, 2004; 6251-606-1PD 149 CDC16xxF-E PRELIMINARY DATA SHEET quants and prescaler value of 0, the CAN module can handle a maximum baudrate offset of 4 f BAUD -------------------------------2 29 f XTAL 21.4.2.4. Synchronization The BTL carries out synchronization at an edge (change of the bus level) in order to compensate for phase shifts between the oscillators of the different CAN nodes. 21.4.2.5. Hard Synchronization With fXTAL = 8MHz and fBAUD = 1MBd the result is 0.86%. The ERM introduces a limited uncertainty in the position of the actual sample time point which may vary from clock to clock by 0 to 0.121 fXTAL. Due to this phase modulation, the above maximum baud rate offset is reduced by a small amount: 0.121 f BAUD --------------------------------2 29 f XTAL With fXTAL = 8MHz and fBAUD = 1MBd the result is 0.026%, and the maximum baud rate offset is reduced to 0.83%. Furthermore, due to this modulation, the propagation delay that the CAN node can produce increases by 0.121 fXTAL. During system design, this increased delay has to be taken into consideration. Hard synchronization is carried out at the start of a telegram. The BTL ensures that the first negative edge is in the sync. seg. 21.4.2.6. Resynchronization Resynchronization takes place during the transmission of a telegram. If the BTL detects an edge outside the sync. seg., it can lengthen or shorten the bit. If it detects the edge during TSEG1, tTSEG1 is lengthened. If it detects the edge during TSEG2, tTSEG2 is shortened. In this way, it ensures that the edges lie in the sync. seg. TSJW is the maximum time a bit can be lengthened or shortened. Two forms of resynchronization are possible. In normal operation, synchronization is carried out only with the negative edge (recessive to dominant). At low transmission speeds, synchronization can also be carried out with the rising edge (SYN = 1). 0,121- Prop.Seg. 2 f XTAL ext. delay + t dtxmax - t srxmin + ------------ f XTAL 21.5. Bus Coupling The bus coupling describes the connection of the internal signals rx (receive line) and tx (transmit line) to the pins to the CAN bus. The output pins are push/pull drivers for TLL levels. The input pins are also designed for TTL levels. ITX 0 1 Integrated transceivers (Siliconix Si9200, Philips 82C250 etc.) are available for physical coupling in the high-speed range in compliance with ISO/DIS 11898. 1 +5V For a laboratory system a "minimum bus" can be constructed by means of a wire-Or circuit. To utilize the advantages of differential signal transmission, an analogue comparator is necessary. tx TxD REF1 1 RxD 0 OR rx 0 1 REF0 Fig. 21-11: Bus Coupling 150 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 21-2: Logical Level Transmitting ITX tx TxD Bus Level Remarks 0 0 0 Dominant direct 0 1 1 Recessive 1 0 1 Recessive 1 1 0 Dominant inverted REF1 REF0 Table 21-3: Logical Level Receiving RxD 0 0 x 1 Does not work 0 1 0 1 Recessive 0 1 1 0 Dominant 1 0 0 0 Dominant 1 0 1 1 Recessive 1 1 x 0 Does not work rx Bus Level Remarks inverted direct +5V Bus CAN +5V REF1 1 RxD 0 OR rx 0 1 REF0 ITX TxD 0 tx 1 1 Fig. 21-12: Minimum Bus Micronas May 25, 2004; 6251-606-1PD 151 CDC16xxF-E PRELIMINARY DATA SHEET 22. DIGITbus System Description 22.1. Bus Signal and Protocol The DIGITbus is a single-line serial master-slave-bus that allows clock recovery from the sign stream. Data on the bus is represented by a pulse width modulated signal. There are three different signs: "0": 25% High Time "1": 50% High Time "T": 75% High Time address length is one bit. The minimum data field length is zero bit. Telegrams with more than one data field are also permitted. For instance TTTTAAATDDDDTDDDDDTT is a valid telegram format on the DIGITbus. A telegram consisting of one address only is possible, too. In this case, the length of the data field is zero. bit time 0 1 T T T Address T T T T T T A permanently high bus (100% High Time) means that the bus is passive high. The bus is active if there are consecutive T-Signs, ones or zeros. A data field is preceded by an address field and separated from this by a single "T". It is followed by one T-Sign. After reception of two T-Signs the telegram is finished and valid. A permanently low bus (0% High Time) is interpreted as bus reset or failure indicator. Reasons may be shorts, or opens, or even a low level forced by a bus node to indicate an internal failure or reset condition. In the idle phase (no information exchange) of the bus traffic, only the bus clock is transmitted. The sign "T" is used to provide a system-wide clock for the bus nodes and to separate the address and data fields and consecutive telegrams. A telegram normally consists of an address and a data field separated by one "T". These fields may be as long as necessary. Thus the length of an address or data field may carry information. The end is marked by a "T". The end of a telegram is marked by two T-Signs. T T Address T Data T T T One system implementation may be confined to certain address and/or data field lengths, thus reducing the hardware or software requirements. The transmitter of an address has to guarantee that the address is preceded by four T-Signs at least. An isolated data field is not possible. Each non-"T" sequence, which is preceded by two or more consecutive TSigns, must be interpreted as an address. An address field is valid after the reception of the following "T". The minimum T T T T T T T T T T T T After the reception of two consecutive T-Signs, all bus nodes have to be prepared to receive a new telegram starting with an address field. They are ready to send an address after the reception of four consecutive T-Signs. The modification of a T-Sign to a zero or one is done by pulling the bus line to low (dominant state) at the right time. This is done by a master sending an address or a data bit or by a slave sending a data bit. When reading data from a slave, the master first sends the address. After receiving the address , the slave waits one TSign and then modifies the following T-Signs to zeros and ones which the master can recognize. Slaves do not have the possibility to become active on the bus if they want to communicate a local event or if they need data from a master. It is a polling bus. Only a master is able to send an address. The master has to scan the slaves for their data. But it is possible to transfer data from one slave directly to another slave. The master has to transmit an address for which one slave is the source and the second slave is the destination. Telegrams on the bus are broadcast. Every bus node may receive them. 22.2. Other Features There are two possibilities for a slave to signal a local event to the master. They are called wake-up and bus reset. 152 22.2.1. Wake-up If the DIGITbus is passive high, (permanent high level for more than one bit period), a slave can pull the bus line down May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET to low level. This will awake the master who has to store this event in a flag, to start the bus clock and to scan the bus for the source of this event. The minimum low time of the reset pulse is 1/16 of the nominal bit time (1/Baudrate). 22.2.2. Bus Reset The rising edge of a bit or bus clock is only controlled by the bus node which generates the bus clock (clock master). No other bus node may hold down the bus line at that moment. When the clock master releases the bus line at the end of a bit, he must watch the bus line. If the bus level does not rise after at least 1/2 bit time, this must be interpreted as a protocol violation. Delay of 1/2 of a bit time is the latest moment for a master. He can indicate this protocol violation if the rising edge is delayed 1/8 bit time. Slaves may use this mechanism to signal an exception to the master. They must pull down the bus for at least 2 bit times. After such an event, normal communication may be impossible until the PLL of bus nodes have synchronized again. 22.2.3. Phase Correction edges. The bus nodes see the edges at different times. This causes them to pull the bus line delayed. To compensate this effect, the phase correction mechanism allows the bus nodes to adjust their internal counters. The master sends a special address, to which the slave answers with a single zero. The master measures the time between the rising and the falling edge. With this value, he can calculate a phase correction value and transmit it to the slave. The slave may use it to adjust his internal counter. The Phase Correction has to be done separately for each bus node. 22.2.4. Abort Transmission The Abort Transmission feature is an option that allows the implementation of some kind of rip cord with the DIGITbus. In the event of an alarm, the SW of the sending master bus node may break the current telegram and send another telegram instead. The reception of an address/data field cannot be stopped. The transmission of the alarm telegram is delayed until after the end of the reception in this case. Only the currently sending bus node can abort the transmission. On a physical bus the signal edges may be delayed by the bus load. An extra delay may be added by different trigger 22.3. Standard Functions The following standard functions have to be included in every DIGITbus implementation. 22.3.1. Send Bus Clock The Bus Clock is the sequence of T-Signs on the DIGITbus. The rising edges of the bus signal are of constant distance. Only one bus node may generate this Bus Clock even in a multimaster system. All bus nodes use this stream of T-Signs to generate telegrams. The bus clock generator knows two states. "Active Bus" means the transmission of the Bus Clock. "Passive Bus" means permanent high bus level. "Passive Bus" may be a low power mode. 22.3.2. Receive Bus Clock 22.3.4. Receive Address Every slave and all multimaster-capable bus nodes must be able to receive an address. For a receiver, a valid address field must be preceded by two consecutive T-Signs. To verify a received address it is not sufficient to compare the value. The length of the address must be correct too, because of the arbitrary length of the address field. 22.3.5. Send Data Every master must be able to send a data field, and some slaves are also able to. A data field is preceded by an address or data field and one T-Sign. 22.3.6. Receive Data Bus nodes which do not generate the bus clock need an internal clock for their operation. They may use a separate clock source or derive their clock from the bus clock by a PLL. Bus nodes which use own clock sources nevertheless have to synchronize on the bus clock if they want to transmit or receive data. Every master must be able to receive a data field, and some slaves are also able to. A data field is preceded by an address or data field and one T-Sign. It is a good idea to verify the length of a received data field, if possible. But data fields of variable lengths are possible too. 22.3.3. Send Address 22.3.7. Collision Detection The Address is the first bit field in a telegram. Only a master may send this field. The sender must guarantee that at least two consecutive T-Signs have been visible on the DIGITbus before sending this field. Therefore he has to send four TSigns. If one of those four transmitted T-signs is disturbed, only one of the separated telegrams is corrupted for a receiver. Sending of an address requires synchronization on the bus clock and, in the case of a multimaster system, collision detection and arbitration capability. Collision detection together with arbitration is necessary in multimaster systems. It is necessary to avoid the disturbance of telegrams if two masters try to send a telegram at the same time. As long as both transmit the same sign (one or zero) at the same time, they don't detect a collision. If one master is sending a one and the other is sending a zero, a zero will be seen at the bus. In this case the master whose one was modified to the zero, immediately stops sending and should receive this telegram. The sender has to arbitrate his part of the telegram. Write telegram: TTTTTAAAATDDDDTTTTT Micronas May 25, 2004; 6251-606-1PD 153 CDC16xxF-E PRELIMINARY DATA SHEET Read telegram: TTTTTAAAATDDDDTTTTT The separator (T-Sign) after an address or data field is object of arbitration too. In a single master system arbitration loss has to be managed as a bus error. 22.4. Optional Functions The following optional functions may be designed into a certain DIGITbus implementation. 22.4.1. Abort Transmission A master controlling the transmission of a telegram can abort the sending of the address and data field. After four T-Signs after the last bit he can send another, more urgent telegram. If he is receiving a data field from a slave, he must wait until the slave has finished the data field. Then he can insert a new telegram. 22.4.7. Receive Reset The clock master generates the rising edge at the end of a bit time. He will detect the reset condition described above and set a flag if the rising edge is delayed for at least 1/8 of the bit time. 22.4.2. Measure Pulse Width The capability to measure the pulse width of a high pulse at the DIGITbus may be used for a phase correction by some bus nodes. The bus node generating the bus clock sends a data read telegram to another bus node. The other bus node answers with a data field which consists of a single zero. The pulse width of this zero is measured by the master. With this value he can calculate a phase correction value and transmit it to this bus member, which may adjust its time slots to the system dependencies. 22.4.3. Correct Phase Bus nodes which do not generate the bus clock may use the procedure described above to adjust their phase. They have to answer to a special address with sending back a zero. Afterwards they will receive a correction value with another special address. With this value they can adjust the point where they pull the bus line to modify a "T" to a one or a zero. 22.4.4. Generate Wake-up If the DIGITbus is passive high (no bus clock, always high level), the clock master may become wake-up by pulling the bus level to low (dominant state) for 1/16 bit time at least. All nodes without the clock master may be able to do that. 22.4.5. Receive Wake-up If there is a low pulse of at least 1/64 bit time on a passive high DIGITbus, the clock master must start to transmit the bus clock by sending T-Signs. All Masters with a bus clock generation unit must be able to do so in a system which uses this feature. 22.4.6. Generate Reset During active DIGITbus a slave may be allowed to pull down the bus line longer than up to the end of the actual bit time (2 bit times at least). The rising edge at the end of the bit will be delayed in this case. This will disturb the bus clock for all bus nodes. 154 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 23. DIGITbus Master Module 23.1. Introduction The DIGITbus is a single-line serial master-slave-bus that allows clock recovery from the sign stream. The address and data field are of arbitrary length. - Bus clock generation. The DIGITbus Master module is a HW-Module for connecting a single-chip controller to the DIGITbus. It generates the bus clock and manages short telegrams autonomously. Transmission and reception of long telegrams are supported by a FIFO each. The DIGITbus Master may be used in a single or in a multimaster bus system. - Transmit FIFO and receive FIFO. - Receive and transmit a telegram with address and data field. - Collision detection and arbitration. - Abort transmission. - Sleep mode. - Bus monitor mode. Features - Measurement of pulse width for phase correction. - Single master in a singlemaster system. - Phase correction. - Clock master in a multimaster system. - Reception of wake-up and bus reset signal. - Passive master in a multimaster system. - Register interface to the CPU. 23.2. Context Apart from reset and clock line, the interface to the CPU consists of registers connected to the internal address and data bus. An output signal may be connected to the interrupt controller. A modified universal port builds the output logic which is connected with its special input and output to the DIGITbus Mas- from clock divider ADB R/W DB Reset Interrupt ter. This provides an easy way for the SW to hold the bus line permanent low or high, or investigate bus level directly, without support of DIGITbus Master HW. An open drain output instead of a push/pull output is necessary for the universal port to build a single-line wired-and bus. +U Universal Port with Open Drain Output DIGITbus Master rx tx SI Port Pin DIGITbus SO Other Transmitter Fig. 23-1: Context Diagram 23.3. Functionality 23.3.1. 3-bit-Prescaler The programmable 3-bit-Prescaler supplies the module with clock signals. It scales down the clock divider clock by factor Micronas 1, 2, 3 to 8 (see Table 23-2 on page 158). The output is 64 times the bus clock. The desired input frequency from the clock divider is hardware programmable. May 25, 2004; 6251-606-1PD 155 CDC16xxF-E PRELIMINARY DATA SHEET 23.3.2. Internal Clocks In low-power mode, the clock supply of the whole module with exception of the receive bit logic can be stopped. The receive bit logic needs a clock in low-power mode too, as it must filter and watch the bus line for a wake-up signal. 23.3.3. Transmit T The transmit T logic sends a continuous stream of T-signs, if active. It outputs a permanent high if it is inactive. corresponding field is entered into the FIFO unless the field length is not a multiple of 8. An entry into the address register is inserted into the bus clock after the reception of 4 consecutive T-signs. An entry into the data register is inserted into the bus clock after the reception of a non-T-sign and one T-sign. Thus it is possible to append a second data field (maybe acknowledge) after the reception of a telegram. The transmit FIFO may be flushed to abort a transmission. It is also flushed if the transmit telegram logic is active and a collision is detected. 23.3.4. Transmit Bit Depending on the input signals, the transmit bit logic modifies the T-signs to ones or zeros. A phase correction can be done by adjusting the start time of a transmit bit sequence. Other bus behavior than sending zeros, ones or T-signs may be enforced by the SW using the universal port in normal mode directly. The bus line may be released or pulled low. 23.3.10. Receive FIFO The receive FIFO will be filled from the receive shift register. It has two exit addresses. One for the field length and field type and one for the bit field. The field length has to be read before the corresponding field is taken from the FIFO. The receive FIFO will be frozen if it is full. The receive shift register will be overwritten. 23.3.11. Interrupt 23.3.5. Receive Bit The receive bit logic samples the bus level at a frequency of 64 times of the bus clock. It filters the input signal and decodes the input stream to supply the receive telegram logic with the logical bus signals (0, 1 and T) and the receive clock. In addition, it measures the pulse width of each non Tsign. It creates a bus reset signal if the active bus is held down beyond the end of a bit time. It creates a wake-up signal if there is a low level on the passive high bus. Several flags of the status registers are connected with the interrupt source signal by a logical-OR. The interrupt output can be masked by a flag in the control register. 23.3.6. Send Telegram The send telegram logic will be enabled by the transmit FIFO and the receive telegram logic when four consecutive Tsigns have been received. It supports the transmit bit logic with the transmit bit sequence. If it recognizes the beginning of a new field, it waits one bit time (separator T-sign). 23.3.7. Receive Telegram The receive telegram logic traces the bus and indicates the state to the status register and other related modules. The received bit field is written to the receive FIFO. The receive telegram logic is active all the time. Even if the module is transmitting a telegram, all bits must also be received in a multimaster system, because arbitration may be lost. Reception of own telegrams can be disabled (in a singlemaster system). 23.3.8. Collision Detection The collision detection logic compares each incoming bit with the currently outgoing bit. A difference is signalled to the send telegram logic. If the module is transmitting, the send telegram logic is stopped immediately, and the transmit FIFO and shift register are flushed. 23.3.9. Transmit FIFO The transmit FIFO has five entry addresses. One for the field length of address or data field, one for a address byte, one for a data byte, one for more address bytes and one for more data bytes. The field length has to be written once before the 156 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET ADB DIGITbus Master Address Decoder R/W run from clock divider 64 x bus clk 3-Bit-Prescaler Transmit T generate bus clock DIGITbus Interrupt Source Control/Status T-Seq. DB Phase Tx Field Length Tx Addr. Field & Tx Data Field Reset Tx More Addr. Field wake-up/bus reset arbitration lost Tx More Data Field 0-Seq. 64 x bus clk 1-Seq. full flush TxFIFO Transmit Bit T dat Transmit Telegram tx rise Collision Detection TxSR RxSR rx external only Receive Telegram data lost RxFIFO empty rxclk txclk T dat Receive Bit rx 64 x bus clk Rx Field Length Rx Field Pulse Width Fig. 23-2: Block Diagram Micronas May 25, 2004; 6251-606-1PD 157 CDC16xxF-E PRELIMINARY DATA SHEET 23.4. Registers PSC r/w: The register mnemonic prefix "DG" stands for DIGITbus. Prescaler Scaling value Table 23-1: Register Mapping Table 23-2: Clock Prescaler Addr. Offs. Mnem. readable writable 0 DGC0 Control 0 1 DGC1 Control 1 0 1 93.75 125.0 156.25 2 DGS0 Status 0 1 2 46.9 62.5 78.1 3 DGRTMD 2 3 31.25 41.7 52.1 4 DGTL 3 4 23.4 31.25 39.1 5 DGS1TA Status 1 Tx Addr. 4 5 18.75 25.0 31.25 6 DGTD reserved Tx Data 5 6 15.6 20.8 26.0 7 DGRTMA Rx Field Tx More Addr. 6 7 13.4 17.9 22.3 7 8 11.7 15.6 19.5 PSC hex Rx Length Tx More Data Tx Length DGC1 r/w r/w 7 6 5 4 3 RUN GBC ACT RXO X 0 0 0 0 x 2 1 158 @ 10 MHz Control Register 1 7 6 5 4 INTE ENEM ENOF x 0 0 0 x 3 2 1 0 0 0 PHASE PSC 2 to 0 0 0 0 0 Res 0 0 Res Generate Bus Clock Module generates bus clock No bus clock ACT Activate r/w1: Module is active (reception and transmission). r/w0: Module is sleeping (low power mode). Only the receive bit logic is active in the low-power mode. RXO r/w1: r/w0: @ 8 MHz Control Register 0 RUN Run r/w1: Module clock is active. r/w0: Module is not clocked. The module is absolutely inactive if RUN is zero. Other flags are not functional then. GBC r/w1: r/w0: Bus Clock in kHz @ 6 MHz An "x" in a writable bit location means that this flag is reserved. The user has to write a zero to this location for further compatibility. An "x" in a readable bit location means that this flag is reserved. A read from this location results in an undefined value. DGC0 Divide by INTE r/w1: r/w0: Enable Interrupt Enable interrupt Disable interrupt ENEM r/w1: r/w0: Enable Not Empty Interrupt Enable Disable ENOF r/w1: r/w0: Enable Not Full Interrupt Enable Disable PHASE Phase Correction Field r/w: Transmit phase. The start of the transmit frame can be selected in increments of 1/64 of a total bit time related to the rising edge. Values between 0 and 15 are possible, but only the interval from 0 to 9 results in correct behavior. Receive External Only Don't receive own telegrams. Receive all. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Bit time Transmitted RxFIFO 0 16 32 48 0 Received NEM 0 16 32 48 0 Phase delay Interrupt Corrected 4 16 32 48 0 PHASE = Start value of transmit counter. TxFIFO Fig. 23-3: Phase Correction EMPTY NOF DGS0 Status Register 0 7 6 5 4 3 2 1 0 w x x x TGV PV ERR x ARB r RDL NEM NOF x 0 1 0 0 0 x 0 Interrupt Fig. 23-4: Rx- and TxFIFO Timing Res RDL Receive Data Lost r1: Data lost r0: No data lost This flag is set if the receive FIFO is full and the shift register tries to store its contents to the FIFO, because a new bit arrives. In this case the FIFO is frozen but the shift register is overwritten. It must be interpreted and cleared by the user. It is cleared by reading an entry from the FIFO. NEM Rx FIFO is Not Empty r1: There is at least one entry to read. r0: Empty. (see Fig. 23-4 on page 159) NOF Tx FIFO is Not Full r1: There is at least one entry free. r0: Full. It generates an interrupt only at the precise moment when the limit is passed. It doesn't generate interrupts when the FIFO is empty (see Fig. 23-4 on page 159). TGV Telegram Valid r1: Telegram valid r0: Telegram not valid w0: Clear flag This flag will be set if two consecutive T-signs have been received. It is reset by the HW if a non-T-sign is received. It can be cleared by the user if the related telegram is evaluated. PV r1: Protocol Violation Wake-up if bus is passive high. Bus reset if bus is active. r0: No trouble w0: Clear flag It must be interpreted and cleared by the user. It is set when the receive bit logic enters or leaves state passive high or when it enters the state passive low. Micronas ERR Error r1: Fatal error. r0: No error w0: Clear flag The HW sets this flag either if a dominant level is transmitted and a recessive level is detected (collision error), or if there was a wrong edge within a received bit. If a collision error is detected during transmission, the flag ARB will be set too and transmission stops immediately. This flag has to be cleared by the user. ARB Arbitration Lost r1: Arbitration lost. r0: No arbitration loss. w0: Clear flag This flag will be set if a collision is detected during transmission. It must be cleared by the user. The transmit buffer is flushed if ARB is true. It is impossible to write to the transmit FIFO as long as ARB is true. Wait until flag TGV is true before reloading TxFIFO. This is automatically done if ARB is evaluated within the TGV interrupt subroutine only. The Flags RDL, NEM, NOF, TGV, and PV trigger the interrupt source signal (see Section 23.5.7. on page 163). DGS1TA 7 Status 1 & Tx Address Register 6 5 w 4 3 2 1 0 0 0 Transmit Address r STATE 0 PW5 to 0 1 0 0 0 0 Res The first byte of an address field must be written to DGS1TA. May 25, 2004; 6251-606-1PD 159 CDC16xxF-E STATE r: PRELIMINARY DATA SHEET Table 23-4: LEN usage, Receive and Transmit Length Bus State State of receive bit logic. Table 23-3: Receiver States LEN 210 Valid Bit Numbers 76543210 STATE Bus 1 001 _______x 00 Passive low 2 010 ______xx 01 Passive high 3 011 _____xxx 10 Active low 4 100 ____xxxx 11 Active high 5 101 ___xxxxx 6 110 __xxxxxx 7 111 _xxxxxxx 0 000 xxxxxxxx PW Pulse Width r: Pulse width The pulse width of the most recent non-T-sign is stored in this register. It is measured in increments of 1/64 of the bus clock period. DGRTMD 7 Rx Length & Tx More Data Register 6 5 w r 4 3 2 1 0 The examples in Table 23-5 illustrate the interpretation of register DGRTMD. They are valid for an address field (FTYP = 1) or a data field (FTYP = 0). Table 23-5: DGRTMD Interpretation Examples Transmit More Data RDL NEM FTYP EOFLD x 0 0 x x x LEN2 to 0 x x x Res LEN EOFLD 6 1 Last byte of a field. The six rightmost bits belong to the field. 0 0 A byte of a field. All bits belong to the field. At least one byte follows. 0 1 Last byte of a field. Eight bits belong to the field. 0 0 Impossible. More bytes of a data field must be written to DGRTMD. The read part of register DGRTMD is associated with the front entry in the receive FIFO (the receive field DGRTMA). It has to be read and interpreted before the corresponding FIFO entry. RDL Receive Data Lost r1: Data lost r0: No data lost The flag RDL from the status register DGS0 is mirrored here. It is cleared by a read access to register DGRTMA. NEM Receive FIFO is Not Empty r1: There is at least one entry. r0: Empty The flag NEM from the status register DGS0 is mirrored here. FTYP, EOFLD, LEN and register DGRTMA are not valid if NEM is false. DGRTMA 7 Field Type Address field Data field 5 4 3 Transmit More Address r Receive Field x x x x 2 1 0 x x x Res More bytes of an address field must be written to DGRTMA. EOFLD End of Field r1: Last byte of a field r0: Not last byte of a field If EOFLD is set, the corresponding FIFO entry is the last part of the actual field. The next entry, if there is one, belongs to a new field. LEN Length of Field r: Length of valid data bit The three-bit length does not limit the overall length of the corresponding field. The field length defines how many bits of the front entry of the receive FIFO carry valid bits. They are right-aligned (Table 23-4). The real length of the field is unlimited. The user must count the bytes fetched from the FIFO to calculate the real field length. 160 6 w x FTYP r1: r0: Rx Field & Tx More Address Register The bytes of a received field must be read from register DGRTMA. The meaning of this field (address or data) is defined by the flag FTYP. Received bytes of a bit field are right-aligned. The last byte of a long bit field (with the LSB) may be filled partially. To get the whole bit field right-aligned it is necessary to shift all preceding bytes to the right. A read access to this register takes the top entry of the receive FIFO. Both registers DGRTMA and DGRTMD are overwritten by the next FIFO entry as result of a read access. May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET DGTL Transmit Length Register 7 6 5 4 3 2 1 0 w x FLUSH x x x x 0 x x x 0 0 0 r x EMPTY x x x x x x x 1 x x x x x x LEN2 to 0 Res LEN Length of Field w: Length of address or data field. These three bits correspond to the first byte of a bit field. They define how many bits of this byte carry valid information and should be transmitted (see Table 23-4 on page 160). DGTL must be written before the first byte of the actual bit field is written to the FIFO. It only has to be written once for each bit field. The overall length of the bit field is not limited. Res DGTD The Transmit Length Register is associated with the whole field (address or data) which will be written into the transmit FIFO. It has to be written before the first entry of the field. FLUSH Flush Tx FIFO w1: Empty Tx FIFO and abort transmission. w0: No action. This flag will be reset by the HW autonomously. After FLUSH wait at least one bit time before rewriting TxFIFO. EMPTY r1: r0: Tx FIFO is Empty No transmit telegram in FIFO. Transmit telegram in FIFO. 7 Transmit Data Register 6 5 w 4 3 2 1 0 x x x Transmit Data x x x x x Res The first byte of a data field must be written to DGTD. The first byte of a bit field (with the MSB) which is entered into DGS1TA or DGTD, may be partially filled. In the following bytes all bits must contain valid data. 23.5. Principle of Operation 23.5.1. Reset 23.5.2. Initialization The module reset signal resets all registers and internal HW. The same module reset signal does a standby bit in a standby register. The corresponding port must be configured as special out open drain. Setting flag RUN in register DGC0 resets all internal HW and registers, with exception of registers DGC0, DGC1, DGS0 and DGS1TA. These registers are accessible all the time, they are not reset by any setting of the DIGITbus Master flags. Internal HW is reset to an inactive state (not transmitting, not receiving). Internal counters are reset to zero. FIFOs and shift registers are empty. Internal representations of the bus line are reset to passive bus level (high). After reset, and after setting flag DGB in standby register SR2, the DIGITbus master is inactive. The global enable flag RUN must be set together with the appropriate prescaler entry PSC, to activate the module. 23.5.2.1. Clock Master The flag GBC (generate bus clock) must be set, if the DIGITbus master should generate the bus clock. The module now acts as clock master of the connected DIGITbus system. It outputs a stream of T-signs. 23.5.2.2. Receiver/Transmitter Registers C0 C1 reset S1.TSTn reset SR2.DGB C0.RUN R Q R Q reset Fig. 23-5: Reset Structure Micronas Internal HW and remaining registers Setting the flag ACT activates the receive and transmit logic. From now on, all telegrams are received in the receive FIFO. Writing to the transmit FIFO initiates transmission of a telegram. The bus clock (T-signs) must be activated some time before the first telegram is transmitted. This is necessary, as other modules may use a PLL for generating the internal clock from the bus clock. No telegram shall be transmitted before all modules have locked on the bus clock. 23.5.2.3. Singlemaster System In a singlemaster system (no collision possible), you can suppress reception of transmitted telegrams by setting flag RXO (receive external only). This unburdens the CPU from clearing the receive FIFO of those telegrams. May 25, 2004; 6251-606-1PD 161 CDC16xxF-E PRELIMINARY DATA SHEET 23.5.2.4. Multimaster System In a multimaster system it is necessary that each transmitted telegram is received too, because arbitration may be lost and then the transmitter becomes a receiver. If arbitration has not been lost, the receive FIFO must be read to empty it. The flag RXO has to be cleared in a multimaster system. Table 23-6: Operating modes RUN GBC ACT RXO Remarks 0 x x x Standby mode 1 0 x x Passive master. External bus clock generation is necessary. complete emptiness of transmit FIFO. After reset, FLUSH or ARB wait until flag TGV is true before rewriting TxFIFO. Short telegrams can be completely buffered in the FIFO. Managing long telegrams is a SW job. The SW must buffer long telegrams and write the parts in time. The transmit FIFO is intended to unburden the CPU from immediate reaction to a NOF interrupt. If an entry becomes free, the SW has time to write, as long as it needs to transmit two FIFO entries and the contents of the transmit shift register. This time must not necessarily be the duration of sending 24 bits. Possibly, only one bit of each remaining FIFO entry has to be sent. The transmit FIFO is not intended for telegram tracking. Only one transmit telegram at a time must be entered. 23.5.4. Reception Every non-T-sign is shifted into the receive shift register. If it is full, or if a T-sign was received, the shift register is stored into the receive FIFO. This is done until the receive FIFO is full. In this case, the FIFO is frozen, but the shift register continues operation. The flag RDL indicates the latter case. 1 1 x x Clock master 1 0 0 x Sleep mode 1 x 1 x Active mode 1 x 1 0 Receive all. (Recommended in multimaster system) 1 x 1 1 Receive external only. (Recommended in singlemaster system) 23.5.3. Transmission Transmission is initiated by writing a telegram into the transmit FIFO. If the field length is not a multiple of 8 bit, the total field length module 8 has to be written to register DGTL. This must be done once for each field, and before any entry in registers DGS1TA, DGTD, DGRTMA or DGRTMD. If the total field length is a multiple of 8, it is not necessary to write the field length into register DGTL. The first entry of a field (address or data) has to be written right-aligned to register DGS1TA (address) or DGTD (data). Further entries of the same field, if it is longer than 8 bit, have to be written to DGRTMA (more address) or DGRTMD (more data). A telegram is transmitted MSB first, hence fields have to be written to transmit FIFO MSB first. A new address field is transmitted if at least four consecutive T-signs were on the bus. A new data field is transmitted if there was exactly one T-sign. If the last bit of a field was transmitted and there are no more entries in the transmit FIFO, the transmitter stops sending. After reception of two consecutive T-signs the telegram valid flag TGV is set. This is the signal for the SW to evaluate whether transmission was correct or whether an arbitration loss or an error have cancelled transmission (flags ARB, PV and ERR). In the latter case SW must initiate retransmission. If the shift register is stored to the receive FIFO because a Tsign was received, the corresponding flag EOFLD is set, indicating that this is the last entry of a field. The corresponding flag FTYP is modified at the same time. If two or more consecutive T-signs were received in front of the actual field, it is set, indicating that this field has to be interpreted as an address field. If only one T-sign has been received in front of the actual field, it is cleared, indicating that it has to be interpreted as a data field. The flag TGV is set if two consecutive T-signs were received. This is the moment to read status flags and Receive FIFO. The flags PV and ERR have to be interpreted. Even if an error has occurred, the Receive FIFO must be emptied by reading it because every telegram or fragment is stored there. Otherwise reception of the next telegram may overflow the receive FIFO, which is indicated by flag RDL. Every time you want to read DGRTMA, it is ingenious to read DGRTMD first, because DGRTMD and DGRTMA are overwritten with a read access to DGRTMA. 23.5.4.1. Receive FIFO The receive FIFO contains entries as long as flag NEM is true. Short telegrams can be buffered completely in the receive FIFO. SW must buffer long telegrams and read parts of it in time. 23.5.5. Sleep Mode Only the receive bit logic is active in sleep mode. Neither transmission nor reception of telegrams is possible. A wake-up (passive high to low edge) is signalled by flag PV. A telegram has been transmitted correctly if ARB and ERR are false and EMPTY is true. The DIGITbus master is not automatically activated by a wake-up. This has to be done by SW. The flag PV can be used to trigger an interrupt. 23.5.3.1. Transmit FIFO Switching to Sleep Mode while a telegram is being transmitted can cause problems. Hence, please make sure that bus clock generation is switched off only if bus is idle (T-signs). SW must ascertain that there is an empty entry in the transmit FIFO, before writing to it. Flag NOF (not full) indicates that there is at least one entry free. Flag EMPTY indicates 162 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 23.5.6. Abort Transmission - Wrong port configuration of DIGITbus Master. Writing a one to flag FLUSH aborts the transmission of a telegram after completion of the actual transmitted bit, if the DIGITbus master is the transmitter. The transmit FIFO is emptied and another, more urgent telegram can be transmitted. Transmission of the new telegram starts as soon as 4 consecutive T-signs have been received after the aborted telegram. - Disturbances on bus line. It is not possible to abort a telegram or a field which is transmitted by another bus node. 23.5.7. Interrupt Five flags (RDL, NEM, NOF, TGV, PV) are connected to the interrupt source output by an or operation. This output can be enabled globally by flag INTE. The interrupt generation of two flags (NEM, NOF) can be enabled locally by flags ENEM and ENOF. A rising edge of a flag triggers the interrupt source output. - DIGITbus Master HW damaged. 23.5.11. Precautions Don't use indirect addressing when you write to a DIGITbus register. An unwanted read access to the same address can be the result and a read access to the RxFIFO output register modifies the content of this FIFO. Received data are lost in this case. If a telegram is aborted by FLUSH, normally there is a TGV interrupt with the reception of the second T sign after the last bit of the aborted telegram. The next TGV interrupt signals the transmission of the alarm telegram. If a transmit telegram is aborted by FLUSH before transmission has actually started, then the first TGV interrupt of the aborted telegram doesn't occur. In this case the TGV interrupt signals the transmission of the alarm telegram. Don't access DIGITbus registers in CPU SLOW mode. This can cause interrupts. Operation of the module in CPU SLOW mode is allowed. INTE RDL ENEM DIGITbus Interrupt Source & NEM ENOF & OR & NOF TGV PV Fig. 23-6: Interrupt Sources 23.5.8. Measure Pulse Width The pulse width (high time) of every non-T sign is stored with the falling edge of the bus signal in status register DGS1TA in the field PW. T-signs don't affect PW. It must be read before the falling edge of the next non-T sign. 23.5.9. Correct Phase The rising edge of the bus signal can be delayed by inner (sampling and filter) or outer (bus load) influences. This delayed rising edge resets a 6-bit transmit counter in the transmit bit logic. The transmit counter pushes the bus line low when it reaches 15 (transmitting 0) or 31 (transmitting 1). It releases the bus line when it reaches 55. The transmit counter is reset to a value which contains two zeros at the most significant position and the four PHASE bits of the control register DGC1 at the least significant position. This allows an adjustment of the transmitted non T signs between 0 and 1/15 of the whole bit length. 23.5.10. Error The setting of flag ERR may have one of the following causes: - Wrong baud rate of DIGITbus Master or other bus nodes. Micronas May 25, 2004; 6251-606-1PD 163 CDC16xxF-E PRELIMINARY DATA SHEET 23.6. Timings Bus Clock Tx stream D T T T T T A A T D D T T T T txa D Rx stream T T T T T A A T D D T T T T TGV NEM ARB collision Fig. 23-7: Tx Timing Bus Clock Tx stream D T T T T T T T T T T T T T T txa Rx stream D T T T T T A A T D D T T T T TGV NEM ARB collision Fig. 23-8: Rx Timing 164 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 24. Audio Module (AM) The Audio Module AM provides a gong output signal that may be used to drive a speaker circuit. Features The output signal is a square wave signal with selectable gong frequency. - Programmable gong duration - Programmable gong frequency - Programmable initial amplitude The gong signal amplitude is defined by the pulse-width of a PWM signal. An internal accumulator is selectable to automatically decrease this pulse-width, and thus the gong amplitude following an exponential function. 1/ - Gong can be stopped and retriggered - Generation of an exponentially decreasing gong amplitude function without CPU interaction 32 13 13 - + Adder Data Bus 13 '1FH' Write AMAS (Start/Stop gong sound) 13 13 8 5 LSB's AMAS Amplitude - Latch (13 Bit) Read AMAS MSB 8 13 S Q R Data Bus (Bit 7) AMA COMP Amplitude=0 ? U 5.2 AM-PWM HW Options AM Clock & FCL= 4 MHz AMMCA 8 0 AM Trigger VDD 8 Bit - PWM & & U 5.3 AM-OUT FPWM = 15.625 kHz 7-Bit Counter CLK 1 /n Clear Counter Set Frequency-Register FGONG 1/ 2 CLR 5-Bit Counter CLK 1/( n) 2 Clear Counter Set Decrement-Register 7 AMA Write AMF Data Bus FDecrement 3 Write AMDEC Data Bus Fig. 24-1: Block diagram of the audio module Micronas May 25, 2004; 6251-606-1PD 165 CDC16xxF-E PRELIMINARY DATA SHEET 24.1. Functional Description The gong sound frequency is adjusted with the Audio Module Frequency Register (AMF). FGONG is FPWM divided by twice the [AMF value + 1]. The length of AMF is 7 bit, so values from 0 to 127 can be written. 24.1.5. Stop Gong The gong sound will stop automatically, as soon as the amplitude value in the AMAS reaches zero. This will reset the AMA, which indicates the inactive audio module. The initial gong sound amplitude is set by writing the Audio Module Amplitude & Status Register (AMAS), this write also starts the gong sound. An active audio module is indicated by the read only Audio Module Active Bit (AMA) in the AMAS. To stop the gong sound, just write 00H into the AMAS. The gong sound then will stop immediately with the writing of 00H. (also indicated by AMA). Every 1st..32nd cycle of the gong sound frequency (depending on the Audio Module Decrement Register (AMDEC)), a new amplitude value is calculated (FDecrement). The falling edge of the amplitude decrement frequency FDecrement latches the output of the adder into the amplitude latch (13 bit), and simultaneously the 8 MSB's into the PWM. 24.1.6. Decay of Sound During the first low cycle of FGONG following the active FDecrement edge, the PWM ialready runs with the newly calculated amplitude, but takes effect at the output not until the next high cycle of FGONG. FGONG is modulating the PWM-output to generate the gong sound frequency, while the decreasing PWM-value generates an exponentially decreasing amplitude. As soon as the 8 MSBs of the amplitude latch reach zero, the AMA will be reset, which deactivates the audio module. The audio module is only operable in the CPU FAST mode. The decay characteristic used for this gong sound is described by the following exponential function (see Fig. 24- 3 on page 168): An = A0 (1 - 1/32)n with A0 = initial amplitude An = amplitude after n FDecrement cycles n = int (t * FDecrement ) Each FDecrement cycle the amplitude is decreased by 1/32. FDecrement is determined by the value of GDF in the register AMDEC and by the value of the Audio Module Frequency Register (AMF): FDecrement = FGong / 2 GDF for 24.1.1. Hardware Settings GDF settings of 0 .. 5 The AM clock frequency FCL is set by HW option FFB7h. The AM trigger frequency FPWM (PWM reload frequency) is set by HW option FFC3h. Select 4MHz for FCL and FCL/256 for FPWM to achieve the standard Audio Module functionality. 24.1.2. Initialization To connect the audio module output with the corresponding output pin (U5.3), U5M32.PMODE has to be set to switch U5.3 (and U5.2) into the Port Mode. Additionally, U5.3 has to be switched into the Special Out Mode: U5SEG32.T3 = 0 and U5SEG32.S3 = 1. There is one register to set the gong sound frequency (AMF) and another one to set the gong sound duration (AMDEC) before the gong sound can be started. Both their reset values are zero. 24.1.3. Start Gong The gong sound is started by writing the initial amplitude value into the Audio Module Amplitude & Status Register (AMAS). Simultaneously with the write to AMAS the Flag Audio Module Active (AMA) is set, which enables the FPWMand FCL-inputs. The setting of AMA to '1' also enables the FGONG- and FDecrement - counter. With GDF settings of 6 and 7 the gong sound amplitude update frequency FDecrement is zero (continuous tone). The time constant of the above exponential function is defined as the time interval within which the amplitude A is decreasing to 36.8%. Given 1 n 0, 368 = 1 - ------ 32 the number n of FDecrement cycles needed to reduce the initial amplitude to 36.8% is n 32 This means that is correlating with FDecrement. The higher FDecrement, the shorter is . With an initial amplitude of FFH the total time t255->0 needed to reach zero amplitude in the 8 Bit - AMAS is n = 193 FDecrement cycles, which is approximately 6. GDF t 255 0 1 2 = 193 ------------------------- = 193 ----------------F GONG F Decrement With an initial amplitude lower than FFH the gong sound duration is shorter. 24.1.4. Restart Gong It's possible to restart the gong sound simply by writing a new initial amplitude value to the AMAS (independently from the former initial value or the current value of the register. Note: The current amplitude value can't be read out). The new gong sound will start immediately with a low cycle of FGONG. 166 A continuous tone will never stop automatically. It can also be stopped by writing 00H into AMAS. To sum up, it can be said that the total duration of the gong sound depends on FGong, set with AMF, the setting of the Gong sound Duration Factor GDF and the setting of the initial amplitude (see Table 24-1 on page 167). Please note May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET that senseless combinations of register values are also possible. Table 24-1: Total gong sound running time from A0 = FFH to AFinal = 00H for selected gong sound frequencies (approx. 6; FPWM=15.625 kHz) GDF=0 GDF=1 GDF=2 GDF=3 GDF=4 GDF= 5 3.20 s 6.39 s 12.8 s 25.6 s 51.1 s 86.6 s 100 Hz 1.95 s 3.9 s 7.8 s 15.6 s 31.2 s 62.4 s 601 Hz 0.324 s 0.649 s 1.30 s 2.60 s 5.19 s 10.4 s 2.60 kHz 75.0 ms 150 ms 300 ms 600 ms 1.2 s 2.4 s 25.0 ms 49.9 ms 99.9 ms 200 ms 399 ms 799 ms FGong (AMF) 61.0 Hz (min.) 7.81kHz (max.) Conditions: (FPWM = 15.625 kHz; FGONG = 601 Hz; AMDEC value = 2, FDecrement = 150.25Hz) A 100 % zoomed gong output signal B after 0 s (initial) 50 % after 0.146 s (0.68) FPWM PWM Pulse Duty Factor C 15 % 0 1 2 3 12 13 14 FGONG 15 25 26 after 0.398 s (1.87) 4x A 4x C 4x B Gong Output Pin FGONG FDecrement start gong new amplitude (n.a.) n.a. n.a. n.a. n.a. time 0s 0.146 s (0.68) 0.398 s (1.87) Fig. 24-2: Example sections of the audio module output signal Micronas May 25, 2004; 6251-606-1PD 167 168 May 25, 2004; 6251-606-1PD 1.8% 5.0% 13.5% 36.8% 1/FDecrement 20 40 60 80 100 120 140 160 180 200 220 240 260 8 16 24 1 32 40 48 AMAS (MSB of amplitude latch) 56 2 64 72 80 88 3 4 5 6 time no. FDecrement-cycles 96 104 112 120 128 136 144 152 160 168 176 184 192 200 CDC16xxF-E PRELIMINARY DATA SHEET Fig. 24-3: Decay of Sound - Function Micronas CDC16xxF-E PRELIMINARY DATA SHEET 24.2. Registers The Audio Module control registers are located in the I/O area. It's possible to write a new gong sound frequency during an active audio module (AMA = '1'). Table 24-2: Audio Module Control Registers Table 24-3: Examples for AMF-values Mnemonic Name AMF - value AMAS Audio Module Amplitude/Status 127 AMF Audio Module Frequency : : AMDEC Audio Module Decrement 77 100 Hz : : 12 601 Hz : : 2 2.60 kHz : : AMAS 7 Audio Module Amplitude and Status Register 6 5 w r 4 3 2 1 0 Note Initial Amplitude AMA x x x x x x x 0 x x x x x x x Res Initial Amplitude A write access to this register starts or stops the gong sound, while the value written is the initial gong sound amplitude. Writing the value 00H into this register during an active gong sound deactivates the gong sound immediately, while writing a value > 00H is restarting the gong sound immediately with the new Initial Amplitude. wxx: (Re-)Start gong sound with Initial Amplitude. w00: Stop gong sound. AMA Audio Module Active Flag This flag indicates an active Audio Module generating a gong sound. r1: Audio Module is active. r0: Audio Module is not active. AMF 7 w Audio Module Frequency Register 6 5 x - 4 3 2 1 0 Note 0 0 Res Sound Frequency 0 0 0 0 0 With this register the gong sound frequency is programmed. The PWM frequency is divided by twice the register value increased by one. The value which has to be written, resp. the resulting gong sound frequency is calculated with: F PWM value = --------------------1 2F GONG F GONG (max.) 0 61.0 Hz (min.) AMDEC 7 w AMMCA 0 AMMCA w1: w0: F PWM = ------------------------------2 ( value + 1 ) (min.) 7.81kHz (max.) Audio Module Decrement Register 6 5 4 3 x x x x - - - - 2 1 0 Note 0 Res GDF 0 0 Audio Module Maximal Constant Amplitude Flag Activate the AMMCA mode. Deactivate the AMMCA mode. With the flag AMMCA the Audio Module Maximal Constant Amplitude (AMMCA) mode is selected. If this Flag is set, the gong sound with the maximum, not decreasing amplitude is available at the audio module output pin. The only difference between this tone and a 'normal' gong sound is the constant, not decreasing amplitude. The handling of this tone (i.e. start, stop, frequency, duration) is the same. The tone is started by writing an initial value to AMAS, but this value will only influence the duration of the tone, not its amplitude. GDF Gong sound Duration Factor This register sets the gong sound duration in dependence of FGONG. With GDF=0 the amplitude will be decreased every FGONG - cycle, values 1 to 5 will result in a amplitude update frequency of FGONG / 2 to FGONG / 32 according this equation: F GONG F Decrement = ---------------GDF 2 With the 7bit value ranging from 0 to 127, the programmable gong sound frequency range is 61 Hz .. 7.81 kHz (see Table 24-3 on page 169). Micronas resulting FGong GDF = 0...5 A value of 6 or 7 means no decrease of the amplitude, so a continuous tone with the initial amplitude will be generated (FDecrement = 0). To stop the continuous tone write a '00H' to AMAS or change the gong sound duration factor to let the May 25, 2004; 6251-606-1PD 169 CDC16xxF-E PRELIMINARY DATA SHEET tone decay. It's possible to change GDF during an active gong sound (AMA = '1'). Table 24-4: Definition of GDF GDF gong sound duration factor 0H 1 1H 2 2H 4 3H 8 4H 16 5H 32 6H continuous tone 7H 170 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET 25. Hardware Options 25.1. Functional Description Hardware Options are available in several areas to adapt the IC function to the host system requirements: - clock signal selection for most of the peripheral modules from fosc to fosc/217 plus some internal signals (see Table 25-2 on page 175) - interrupt source selection for interrupt inputs 0, 1, 5, 6, 7, 10, 13, 14 and 15 - Special Out signal selection for some U- and H-ports - Rx/Tx polarity selection for SPI and UART modules - U-port Port Slow Mode selection The setting of the Hardware Option takes place in two steps: 1. selection is done by programming dedicated address locations with the desired options' code 2. activation is done by a read access to these dedicated address locations at least once after each reset. Address locations 00FFB8h through 00FFBFh do not allow random setting. Their respective Hardware Options are hardwired and can only be altered by changing a production mask for this IC. By default all U-Ports have the Port Slow Option set with the exception of U1.0 to U1.3 (Port Fast Option set). The Watchdog and Clock Monitor are SW activated by default. Future mask ROM derivatives of this IC will not require (but will tolerate) activation of option settings by read accesses because ROM as well as options will be hard-wired. Instead, the manufacturer will automatically process the setting of the dedicated address locations, as given in the ROM code file, to set the required mask changes. To ensure compatible option settings in this IC and mask ROM derivatives when run with the same ROM code, it is recommended to always read locations 00FFA0h through 00FFC3h directly after reset. Be aware that the non-programmable locations 00FFB8h through 00FFBFh may not be compatible among this IC and the mask ROM derivative. 25.2. Listing of Dedicated Addresses and Corresponding Hardware Options Table 25-1: Hardware-Option-Dedicated Addresses 7 00FFA0 x 00FFA1 x 00FFA2 x 6 5 4 3 2 1 0 Timer 0 Clock Options x x Clock options f1 to f31 PWM0, PWM3 Clock Options x x Clock options f0 to f31 (all) PWM0, PWM3 Trigger Options x x Clock options f0 to f31 (all) The high pulse width of the trigger period must be greater than the high pulse width of the clock the PWM is provided with. 00FFA3 x 00FFA4 x PWM1, PWM4 Clock Options x x Clock options f0 to f31 (all) PWM1, PWM4 Trigger Options x x Clock options f0 to f31 (all) The high pulse width of the trigger period must be greater than the high pulse width of the clock the PWM is provided with. Micronas May 25, 2004; 6251-606-1PD 171 CDC16xxF-E PRELIMINARY DATA SHEET Table 25-1: Hardware-Option-Dedicated Addresses 7 00FFA5 x 00FFA6 x 6 5 4 3 2 1 0 PWM2 Clock Options x x Clock options f0 to f31 (all) PWM2 Trigger Options x x Clock options f0 to f31 (all) The high pulse-width of the trigger period must be greater than the high pulse-width of the clock the PWM is provided with. 00FFA7 x 00FFA8 x 00FFA9 x 00FFAA x 00FFAB x 00FFAC x 00FFAD x 00FFAE x 172 Timer 1 Option x x Clock options f0 to f31 (all) x Clock options f0 to f31 (all) Timer 2 Option x CAPCOM Counter Clock Option x x Clock options f0 to f31 (all) DIGITbus Clock Option x x Clock options f0 to f31 (all) Clock Out 0: Mux0 Prescaler and Clock Option x0: Mux out direct 01: Mux out / 1.5 11: Mux out / 2.5 Clock options f0 to f31 (all) Clock Out 1: Prescaler and Clock Option x0: direct 01: 1/ 1.5 11: 1/ 2.5 Clock options f0 to f31 (all) LCD Module Prescaler and Clock Option x0: direct 01: 1/ 1.5 11: 1/ 2.5 Clock options f0 to f31 (all) SMM, SPI0, SPI1 Clock Prescaler and SMM Clock Option x0: direct 01: 1/ 1.5 11: 1/ 2.5 Clock options f0 to f31 (all) May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 25-1: Hardware-Option-Dedicated Addresses 7 00FFAF SPI0-D-OUT 0: direct 1: inverted 6 5 4 3 2 1 0 SPI0 Input, Output and F0SPI Clock Option 1) SPI0-D-IN 0: direct 1: inverted x Clock options f0 to f31 (all) 1) FFAE, Bits 6 & 5 define also the SPI0 and SPI1 prescaler setting. 00FFB0 SPI1-D-OUT 0: direct 1: inverted SPI1 Input, Output and F1SPI Clock Option 1) SPI1-D-IN 0: direct 1: inverted x Clock options f0 to f31 (all) 1) FFAE, Bits 6 & 5 define also the SPI0 and SPI1 prescaler setting. 00FFB1 x 00FFB2 x 00FFB3 x 00FFB4 UART0 Tx 0: direct 1: inverted 00FFB5 UART1 Tx 0: direct 1: inverted 00FFB6 x 00FFB7 x 00FFB8 x Micronas F2SPI Clock Options x x Clock options f0 to f31 (all) Clock Out 0: Mux1 Clock Option x x Clock options f0 to f31 (all) Clock Out 0: Mux2 Clock Option x x Clock options f0 to f31 (all) UART0, UART2 Input and Output UART0 Rx 0: direct 1: inverted UART2 Tx 0: direct 1: inverted UART2 Rx 0: direct 1: inverted x x x x x x x x x x UART1 Options UART1 Rx 0: direct 1: inverted x x Clock Out 0: Mux3 Clock Option x x Clock options f0 to f31 (all) AM Clock Option x x Clock options f0 to f31 (all) Clock Monitor Options Wdog & Clk Monitor: 0: deact. by Software 1: always active x x x May 25, 2004; 6251-606-1PD x 173 CDC16xxF-E PRELIMINARY DATA SHEET Table 25-1: Hardware-Option-Dedicated Addresses 7 6 00FFB9 5 4 3 2 1 0 Universal Port 1 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBA Universal Port 2 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBB Universal Port 3 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBC Universal Port 4 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBD Universal Port 5 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBE Universal Port 6 Slow/Fast Options 0: Fast mode pin only 1: Slow or fast mode pin possible 00FFBF Universal Port 7 Slow/Fast Options x x 00FFC0 Mux4: 00 01 10 11 174 x 0: Fast mode pin only 1: Slow or fast mode pin possible Interrupt Sources Multiplexer 1 to 4 CAN 2 SPI 0 DMA PINT3-IN 00FFC1 Mux8: 00 01 10 11 x Mux3: 00 01 10 11 PINT3-IN SPI 1 UART 1 CC1 COMP Mux2: 00 01 10 11 UART 2 P06 COMP SPI 0 Timer 1 Mux1: 00 01 10 11 CC0 COMP Timer 2 CAN 2 Timer 1 Mux6: 00 01 10 11 Timer 2 DIGITbus UART 2 PINT2-IN Mux5: 00 01 10 11 Timer 2 UART 1 SPI 1 DMA Interrupt Sources Multiplexer 5 to 8 CC1OR PINT2-IN IR-RTC IR-WAPI Mux7: 00 01 10 11 CC0OR UART 1 IR-RTC IR-WAPI May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 25-1: Hardware-Option-Dedicated Addresses 7 00FFC2 H-Port 1.1 0: SME 1: PWM2 00FFC3 x 6 5 4 3 2 1 0 Interrupt Sources Multiplexer 9 and Port Multiplexer x H-Port 1.0 0: SME 1: PWM0 PINT3-IN 0: at U5.6 1: at U5.7 x x Mux9: 00 01 10 11 CAN 1 UART 1 IR-RTC IR-WAPI AM Trigger Option x x Clock options f0 to f31 (all) Table 25-2: Clock Option Selection Code Clock Option Number Clock Signal Selection Code Clock Option Number Clock Signal Selection Code f0 fOSC/20 xxx0.0000 f19 Timer 0 xxx1.0011 f1 fOSC/21 xxx0.0001 f20 VSS xxx1.0100 f2 fOSC/22 xxx0.0010 f21 fSM xxx1.0101 f3 fOSC/23 xxx0.0011 f22 1) fSM/28 xxx1.0110 f4 fOSC/24 xxx0.0100 f23 fCC0IN xxx1.0111 f5 fOSC/25 xxx0.0101 f24 fCC1IN xxx1.1000 f6 fOSC/26 xxx0.0110 f25, 26, 27 VSS xxx1.1001 ... f7 fOSC/27 xxx0.0111 f28 fOSC/22 xxx1.1100 f8 fOSC/28 xxx0.1000 f29, 30 VSS xxx1.1101 ... f9 fOSC/29 xxx0.1001 f31 fOSC/210 xxx1.1111 f10 fOSC/210 xxx0.1010 f11 fOSC/211 xxx0.1011 f12 fOSC/212 xxx0.1100 If the leading "x" in the Clock sampling table are not used for the purpose of coding other options, they must be replaced by zeros. 1) Clock option f22 is only available if the Stepper Motor Module has been enabled by the standby bit. f13 fOSC/213 xxx0.1101 f14 fOSC/214 xxx0.1110 f15 fOSC/215 xxx0.1111 f16 fOSC/216 xxx1.0000 f17 fOSC/217 xxx1.0001 f18 VSS xxx1.0010 If the leading "x" in the Clock sampling table are not used for the purpose of coding other options, they must be replaced by zeros. 1) Clock option f22 is only available if the Stepper Motor Module has been enabled by the standby bit. Micronas May 25, 2004; 6251-606-1PD 175 CDC16xxF-E PRELIMINARY DATA SHEET 26. Register Cross Reference Table V2.1 26.1. CAN RAM, memory pages 19 ... 1B Address (hex) Mnemonic Block 1900 CAN2_RAM CAN2-RAM CAN1_RAM CAN1-RAM CAN0_RAM CAN0-RAM ... 19FF 1A00 ... 1AFF 1B00 ... 1BFF 26.2. CAN Registers, memory page 1C Address (hex) Mnemonic Block Address (hex) Mnemonic Block 1C00 CAN0CTR CAN0 1C40 CAN1CTR CAN1 1C01 CAN0STR 1C41 CAN1STR 1C02 CAN0ESTR 1C42 CAN1ESTR 1C03 CAN0IDX 1C43 CAN1IDX 1C04 CAN0IDM 1C44 CAN1IDM 1C05 1C45 1C06 1C46 1C07 1C47 1C08 CAN0BT1 1C48 CAN1BT1 1C09 CAN0BT2 1C49 CAN1BT2 1C0A CAN0BT3 1C4A CAN1BT3 1C0B CAN0ICR 1C4B CAN1ICR 1C0C CAN0OCR 1C4C CAN1OCR 1C0D CAN0TEC 1C4D CAN1TEC 1C0E CAN0REC 1C4E CAN1REC 1C0F CAN0ESM 1C4F CAN1ESM 1C10 CAN0CTIM 1C50 CAN1CTIM 1C11 176 1C51 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET Address (hex) Mnemonic Block 1C80 CAN2CTR CAN2 1C81 CAN2STR 1C82 CAN2ESTR 1C83 CAN2IDX 1C84 CAN2IDM 1C85 1C86 1C87 1C88 CAN2BT1 1C89 CAN2BT2 1C8A CAN2BT3 1C8B CAN2ICR 1C8C CAN2OCR 1C8D CAN2TEC 1C8E CAN2REC 1C8F CAN2ESM 1C90 CAN2CTIM 1C91 26.3. I/O Registers, memory page 1E Address (hex) Mnemonic Block Address (hex) Mnemonic Block 1E64 PAR0 Patch Module 1E74 SSR Power Saving Module 1E65 PAR1 1E75 1E66 PAR2 1E76 1E67 PDR 1E78 1E68 PER0 1E79 1E69 PER1 1E7A 1E70 WUS 1E71 Power Saving Module 1E7C SSC RTC 1E7D 1E7E 1E80 Micronas May 25, 2004; 6251-606-1PD WPM0 177 CDC16xxF-E PRELIMINARY DATA SHEET Address (hex) Mnemonic Block 1E81 WPM2 Power Saving Module 1E82 WPM4 1E83 WPM6 1E84 WPM8 1E88 WSC 1E90 OSC 1E94 RTCC 1E98 POL 1E99 1E9C SMX 1EA0 MULCAND 1EA1 MULPLIER 1EA2 MULPROD Multiplier 1EA3 26.4. I/O Registers, memory page 1F Address (hex) Mnemonic Block Address (hex) Mnemonic Block 1F00 CSW0 Core Logic 1F14 CO0SEL Core Logic 1F01 CR 1F15 CO1SEL 1F02 ERMC ERM 1F18 UA1D 1F08 SR0 Core Logic 1F19 UA1C 1F09 SR1 1F1A UA1BR0 1F0A SR2 1F1B UA1BR1 1F0B SR3 1F1C UA1IM 1F0C DBG Debug Register 1F1D UA1CA 1F0F ABR Memory Banking 1F1E UA1IF 1F10 SPI0D SPI0 1F1F IRE 1F11 SPI0M 1F20 IRC 1F12 SPI1D 1F21 IRRET 1F13 SPI1M 1F22 IRPRI10 1F23 IRPRI32 178 SPI1 May 25, 2004; 6251-606-1PD UART1 Interrupt Controller Micronas CDC16xxF-E PRELIMINARY DATA SHEET Address (hex) Mnemonic Block Address (hex) Mnemonic Block 1F24 IRPRI54 Interrupt Controller 1F5E PWM3 PWM 1F25 IRPRI76 1F5F PWM4 1F26 IRPRI98 1F60 CSW1 1F27 IRPRIBA 1F61 CSW2 1F28 IRPRIDC 1F64 UA2D 1F29 IRPRIFE 1F65 UA2C 1F2A IRP 1F66 UA2BR0 1F2B IRPM0 1F67 UA2BR1 1F2C IRPP 1F68 UA2IM 1F2D AMAS 1F69 UA2CA 1F2E AMF 1F6A UA2IF 1F2F AMDEC 1F6C CC0M 1F30 U2D 1F6D CC0I 1F32 U2SEG10 1F6E CC0 1F33 U2M10 1F6F 1F34 U2SEG32 1F70 CC1M 1F35 U2M32 1F71 CC1I 1F36 U2SEG54 1F72 CC1 1F37 U2M54 1F73 1F38 U2SEG76 1F74 CC2M 1F39 U2M76 1F75 CC2I 1F4E TIM0 1F76 CC2 Audio Module Universal Port 2 Timer 0 1F4F Core Logic UART2 Capture Compare Module 1F77 1F50 PWM0 1F51 PWM1 1F7D 1F52 PWM2 1F7E P0PIN Analog Input Port 0 1F54 TIM1 1F80 H0NS High Current Port 0 1F55 TIM2 1F81 H0TRI 1F5A SMVC 1F82 H0D 1F5B SMVSIN 1F84 H1NS 1F5C SMVCOS 1F85 H1TRI 1F5D SMVCMP 1F86 H1D Micronas PWM 1F7C Timer 1, 2 Stepper Motor Module May 25, 2004; 6251-606-1PD CCC High Current Port 1 179 CDC16xxF-E PRELIMINARY DATA SHEET Address (hex) Mnemonic Block Address (hex) Mnemonic Block 1F88 H2NS High Current Port 2 1FB8 U4D Universal Port 4 1F89 H2TRI 1FBA U4SEG10 1F8A H2D 1FBB U4M10 1F90 H3NS 1FBC U4SEG32 1F91 H3TRI 1FBD U4M32 1F92 H3D 1FBE U4SEG54 1F98 U1D 1FBF U4M54 1F99 U1SEG10 1FC0 U4SEG76 1F9A U1SEG32 1FC1 U4M76 1F9B U1M30 1FC4 U5D 1F9C U1SEG54 1FC6 U5SEG10 1F9D U1M54 1FC7 U5M10 1F9E U1SEG76 1FC8 U5SEG32 1F9F U1M76 1FC9 U5M32 1FA0 UA0D 1FCA U5SEG54 1FA1 UA0C 1FCB U5M54 1FA2 UA0BR0 1FCC U5SEG76 1FA3 UA0BR1 1FCD U5M76 1FA4 UA0IM 1FD0 U6D 1FA5 UA0CA 1FD2 U6SEG10 1FA6 UA0IF 1FD3 U6M10 1FA8 AD0 1FD4 U6SEG32 1FA9 AD1 1FD5 U6M32 1FAC U3D 1FD6 U6SEG54 1FAE U3SEG10 1FD7 U6M54 1FAF U3M10 1FD8 U6SEG76 1FB0 U3SEG32 1FD9 U6M76 1FB1 U3M32 1FDC U7D 1FB2 U3SEG54 1FDE U7SEG10 1FB3 U3M54 1FDF U7M10 1FB4 U3SEG76 1FE0 U7SEG32 1FB5 U3M76 1FE1 U7M32 180 High Current Port 3 Universal Port 1 UART0 AD Converter Universal Port 3 May 25, 2004; 6251-606-1PD Universal Port 5 Universal Port 6 Universal Port 7 Micronas CDC16xxF-E PRELIMINARY DATA SHEET Address (hex) Mnemonic Block 1FE8 DCS DMA 1FE9 DIC 1FEA DSA 1FEB 1FEC 1FED DEA 1FEE 1FEF 1FF0 DGC0 1FF1 DGC1 1FF2 DGS0 1FF3 DGRTMD 1FF4 DGTL 1FF5 DGS1TA 1FF6 DGTD 1FF7 DGRTMA 1FFD TST3 1FFE TST1 1FFF TST2 Micronas DIGITbus TST May 25, 2004; 6251-606-1PD 181 CDC16xxF-E PRELIMINARY DATA SHEET 27. Register Quick Reference Table 27-1: A/D Converter Mnemonic Register Name Addr. (hex) Register Configuration 7 AD0 ADC Register 0 1FA8 r EOC w AD1 ADC Register 1 1FA9 r 6 CMPO Section 5 4 3 2 1 0 x x x x AN1 AN0 TSAMP 12.2. CHANNEL 0 0 x x 0 0 0 0 AN9 AN8 AN7 AN6 AN5 AN4 AN3 AN2 Res Table 27-2: Audio Module Mnemonic Register Name Addr. (hex) Register Configuration 7 AMAS AMF Audio Module Amplitude & Status Register Audio Module Frequency Register 1F2D w Audio Module Decrement Register 1F2F 4 3 2 1 0 24.2. Initial Amplitude AMA x x x x x x x 0 x x x x x x x Res 0 0 Res 0 Res x - AMDEC 5 w r 1F2E 6 Section w AMMCA 0 Sound Frequency 0 0 0 0 x x x x - - - - 0 GDF 0 0 Table 27-3: Capture-Compare-Unit Mnemonic Register Name Addr. (hex) Register Configuration 7 CC0M CC0I 182 CAPCOM 0 Mode Register CAPCOM 0 Interrupt Register 1F6C 1F6D r/w r/w 6 5 4 3 2 Section 1 15.2. MCAP MCMP MOFL FOL 0 0 0 0 0 0 0 0 CAP CMP OFL LAC RCR x x x 0 0 0 0 0 0 0 0 May 25, 2004; 6251-606-1PD OAM 0 IAM Res Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-3: Capture-Compare-Unit, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 CC0 CAPCOM 0 Capture/ Compare Register low byte 1F6E CC1M CC1I CC1 CAPCOM 1 Mode Register CAPCOM 1 Interrupt Register CAPCOM 1 Capture/ Compare Register low byte 1F6F 1F70 1F71 1F72 CC2M CC2I CC2 CAPCOM 2 Mode Register CAPCOM 2 Interrupt Register CAPCOM 2 Capture/ Compare Register low byte 1F73 1F74 1F75 1F76 1F77 2 1 Write low byte of compare register and lock it. 1 1 1 1 1 Read high byte of capture register and unlock it. w Write high byte of compare register and unlock it. r/w r/w 1 1 1 1 Res 1 Res Res 1 1 1 MCAP MCMP MOFL FOL 0 0 0 0 0 0 0 0 CAP CMP OFL LAC RCR x x x 0 0 0 0 0 0 0 0 Res 1 Res 1 Res Res OAM IAM Read low byte of capture register and lock it. w Write low byte of compare register and lock it. 1 1 1 1 1 1 r Read high byte of capture register and unlock it. w Write high byte of compare register and unlock it. r/w 15.2. 1 r r/w 0 1 r 1 1 1 1 MCAP MCMP MOFL FOL 0 0 0 0 0 0 0 0 CAP CMP OFL LAC RCR x x x 0 0 0 0 0 0 0 0 Res 1 1 1 1 Res 1 Res OAM IAM r Read low byte of capture register and lock it. w Write low byte of compare register and lock it. 1 1 1 1 1 1 r Read high byte of capture register and unlock it. w Write high byte of compare register and unlock it. 1 Micronas 3 w 1 CAPCOM 2 Capture/ Compare Register high byte 4 Read low byte of capture register and lock it. 1 CAPCOM 1 Capture/ Compare Register high byte 5 r 1 CAPCOM 0 Capture/ Compare Register high byte 6 Section 1 1 May 25, 2004; 6251-606-1PD 1 1 1 1 183 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-3: Capture-Compare-Unit, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 CCC CAPCOM Counter low byte 1F7C r 1F7D 5 4 3 2 1 0 15.2. Read low byte and lock CCC 0 CAPCOM Counter high byte 6 Section 0 r 0 0 0 0 0 0 Res 0 0 Res Read high byte and unlock CCC 0 0 0 0 0 0 Table 27-4: Controller Area Network 0 Mnemonic CAN0CTR CAN0STR CAN0ESTR CAN0IDX Register Name Control Register Status Register Error Status Register Interrupt Index Register Addr. (hex) 1C00 1C01 1C02 1C03 Register Configuration r/w r r/w 7 6 HLT SLP 1 4 3 2 1 0 GRSC EIE GRIE GTIE BOST rsvd 0 0 0 0 0 0 x HACK BOFF EPAS ERS rsvd rsvd rsvd rsvd 1 0 0 0 x x x x GDM CTOV ECNT BIT STF CRC FRM ACK 0 0 0 0 0 0 0 0 Res 1 1 1 Res r/w CAN0BT1 CAN0BT2 CAN0BT3 184 Identifier Mask Register Bit Timing Register 1 Bit Timing Register 2 Bit Timing Register 3 1C04 1 1 1 1 r/w Identifier Mask Bits 29 to 21 1C05 r/w Identifier Mask Bits 20 to 13 1C06 r/w Identifier Mask Bits 12 to 5 1C07 r/w 1C08 1C09 1C0A r/w r/w r/w 21.2. Res Res Interrupt Index 1 CAN0IDM 5 Section Identifier Mask Bits 4 to 0 low x x x high 0 0 0 Res 0 0 0 0 0 MSAM SYN BPR BPR BPR BPR BPR BPR 0 0 0 0 0 0 0 0 rsvd TSEG2 TSEG2 TSEG2 TSEG1 TSEG1 TSEG1 TSEG1 0 0 0 0 0 0 0 0 rsvd rsvd rsvd rsvd rsvd SJW SJW SJW x x x x x 0 0 0 May 25, 2004; 6251-606-1PD Res Res Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-4: Controller Area Network 0, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 CAN0ICR CAN0OCR CAN0TEC Input Control Register Output Control Register Transmit Error Counter 1C0B 1C0C 1C0D r/w r/w CAN0ESM CAN0CTIM Receive Error Counter Error Status Mask Register Capture Timer 1C0E 1C0F 1C10 1C11 5 r/w 3 2 1 0 21.2. rsvd rsvd rsvd rsvd XREF REF1 REF0 x x x x x 0 0 0 rsvd rsvd rsvd rsvd rsvd rsvd rsvd ITX x x x x x x x 0 Res 0 0 0 Res Res r r 4 rsvd Res Counter Bit 7 to 0 0 CAN0REC 6 Section 0 0 0 x 0 Counter Bit 6 to 0 x 0 0 0 0 0 0 0 EGDM ECTV EECT EBIT ESTF ECRC EFRM EACK 1 1 1 1 1 1 1 1 Res r Timer Bit 7 to 0 low r Timer Bit 15 to 8 high 0 0 0 0 0 0 0 0 Res Table 27-5: Controller Area Network 1 Mnemonic CAN1CTR CAN1STR CAN1ESTR CAN1IDX Register Name Control Register Status Register Error Status Register Interrupt Index Register Addr. (hex) 1C40 1C41 1C42 1C43 Register Configuration r/w r r/w 7 6 HLT SLP 1 4 3 2 1 0 GRSC EIE GRIE GTIE BOST rsvd 0 0 0 0 0 0 x HACK BOFF EPAS ERS rsvd rsvd rsvd rsvd 1 0 0 0 x x x x GDM CTOV ECNT BIT STF CRC FRM ACK 0 0 0 0 0 0 0 0 Res 1 1 1 Res r/w 21.2. Res Res Interrupt Index 1 Micronas 5 Section 1 1 May 25, 2004; 6251-606-1PD 1 1 185 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-5: Controller Area Network 1, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 CAN1IDM CAN1BT1 CAN1BT2 CAN1BT3 CAN1ICR CAN1OCR CAN1TEC Identifier Mask Register Bit Timing Register 1 Bit Timing Register 2 Bit Timing Register 3 Input Control Register Output Control Register Transmit Error Counter 1C44 CAN1ESM CAN1CTIM Receive Error Counter Error Status Mask Register Capture Timer 4 3 2 Identifier Mask Bits 29 to 21 1C45 r/w Identifier Mask Bits 20 to 13 1C46 r/w Identifier Mask Bits 12 to 5 1C47 r/w 1C48 1C49 1C4A 1C4B 1C4C 1C4D 1C4E 1C4F 1C50 1C51 r/w r/w r/w r/w r/w Identifier Mask Bits 4 to 0 r/w 0 low x x x high 0 0 0 Res 0 0 0 0 MSAM SYN BPR BPR BPR BPR BPR BPR 0 0 0 0 0 0 0 0 rsvd TSEG2 TSEG2 TSEG2 TSEG1 TSEG1 TSEG1 TSEG1 0 0 0 0 0 0 0 0 rsvd rsvd rsvd rsvd rsvd SJW SJW SJW x x x x x 0 0 0 rsvd rsvd rsvd rsvd rsvd XREF REF1 REF0 x x x x x 0 0 0 rsvd rsvd rsvd rsvd rsvd rsvd rsvd ITX x x x x x x x 0 Res 0 0 0 Res Res r r 1 0 21.2. Res Res Res Res Counter Bit 7 to 0 0 0 0 x 0 Counter Bit 6 to 0 x 0 0 0 0 0 0 0 EGDM ECTV EECT EBIT ESTF ECRC EFRM EACK 1 1 1 1 1 1 1 1 Res r Timer Bit 7 to 0 low r Timer Bit 15 to 8 high 0 186 5 r/w 0 CAN1REC 6 Section 0 0 May 25, 2004; 6251-606-1PD 0 0 0 0 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-6: Controller Area Network 2 Mnemonic CAN2CTR CAN2STR CAN2ESTR CAN2IDX Register Name Control Register Status Register Error Status Register Interrupt Index Register Addr. (hex) 1C80 1C81 1C82 1C83 Register Configuration r/w r r/w 7 6 HLT SLP 1 4 3 2 1 0 GRSC EIE GRIE GTIE BOST rsvd 0 0 0 0 0 0 x HACK BOFF EPAS ERS rsvd rsvd rsvd rsvd 1 0 0 0 x x x x GDM CTOV ECNT BIT STF CRC FRM ACK 0 0 0 0 0 0 0 0 Res 1 1 1 Res r/w CAN2BT1 CAN2BT2 CAN2BT3 CAN2ICR CAN2OCR CAN2TEC Identifier Mask Register Bit Timing Register 1 Bit Timing Register 2 Bit Timing Register 3 Input Control Register Output Control Register Transmit Error Counter 1C84 1 1 1 r/w Identifier Mask Bits 29 to 21 r/w Identifier Mask Bits 20 to 13 1C86 r/w Identifier Mask Bits 12 to 5 1C87 r/w 1C89 1C8A 1C8B 1C8C 1C8D r/w r/w r/w r/w r/w Identifier Mask Bits 4 to 0 Res Res low x x x high 0 0 0 Res 0 0 0 0 0 MSAM SYN BPR BPR BPR BPR BPR BPR 0 0 0 0 0 0 0 0 rsvd TSEG2 TSEG2 TSEG2 TSEG1 TSEG1 TSEG1 TSEG1 0 0 0 0 0 0 0 0 rsvd rsvd rsvd rsvd rsvd SJW SJW SJW x x x x x 0 0 0 rsvd rsvd rsvd rsvd rsvd XREF REF1 REF0 x x x x x 0 0 0 rsvd rsvd rsvd rsvd rsvd rsvd rsvd ITX x x x x x x x 0 Res 0 0 0 Res r Res Res Res Res Counter Bit 7 to 0 0 Micronas 1 1C85 1C88 21.2. Interrupt Index 1 CAN2IDM 5 Section 0 0 May 25, 2004; 6251-606-1PD 0 0 187 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-6: Controller Area Network 2, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 CAN2REC CAN2ESM CAN2CTIM Receive Error Counter Error Status Mask Register Capture Timer 1C8E 1C8F 1C90 1C91 r r/w 6 5 4 x 3 2 Section 1 0 21.2. Counter Bit 6 to 0 x 0 0 0 0 0 0 0 EGDM ECTV EECT EBIT ESTF ECRC EFRM EACK 1 1 1 1 1 1 1 1 Res Res r Timer Bit 7 to 0 low r Timer Bit 15 to 8 high 0 0 0 0 0 0 0 0 Res Table 27-7: Core Logic Mnemonic CSW0 CR Register Name Clock, Supply and Watchdog Register 0 Control Register Addr. (hex) 1F00 1F01 Register Configuration w Section 7 6 5 4 3 2 1 0 x x x x x x x CMA x x x x x x x 1 Res x MFM IRAM ICPU ROM IRAM ICPU Emu r/w RESLNG TSTTOG r/w RESLNG TSTTOG EBTRI MFM TSTROM IROM FLASH IROM Value of 00FFF3h SR0 SR1 SR2 SR3 Standby Register 0 Standby Register 1 Standby Register 2 Standby Register 3 1F08 1F09 1F0A 1F0B r/w r/w r/w r/w Reset with pin reset || VDD power on Res SM PWM1 PWM0 UART2 SPI1 CAN0 CCC SPI0 0 0 0 0 0 0 0 0 UART0 ADC P0DIN TIM1 ERM LCD CPUFST PSLW 6. 0 1 0 0 0 0 0 0 TIM2 PWM3 PWM2 UART1 PWM4 DGB EXTIR ABM 0 0 0 0 0 0 0 0 x x x XTAL WAID FCLO CAN2 CAN1 0 0 0 Res Res Res *) CO0SEL 188 Clock Out 0 Selection 1F14 w *) x x x 1 0 x x x x x x CO01 CO00 x x x x x x 0 0 May 25, 2004; 6251-606-1PD Res Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-7: Core Logic, continued Mnemonic CO1SEL CSW1 Register Name Clock Out 1Selection Clock, Supply and Watchdog Register 1 Addr. (hex) 1F15 1F60 Register Configuration w r 7 6 5 4 3 2 1 0 x x x x x x x CO10 x x x x x x x 0 x x x x x x x WDRES 1 1 w CSW2 Clock, Supply and Watchdog Register 2 1F61 Section 6. Res Watchdog Time and Trigger Value 1 1 1 1 1 1 Res r TST x WKID FHR CLM PIN POR x 0 w x x x FHR x x x x 0 TST x 0 0 0 0 0 x Res* *The Reset state in the register frame above describes the state after a write to register CSW2. Refer to Table 6-8 on page 53 for the state after a hardware reset. Table 27-8: Debug Register Mnemonic DBG Register Name Debug Register Addr. (hex) 1F0C Register Configuration r/w Section 7 6 5 4 3 2 1 0 x x x x x x x DCS x x x x x x x 0 0 8.3.5. POR Table 27-9: DIGITbus Mnemonic Register Name Addr. (hex) Register Configuration 7 DGC0 DGC1 DGS0 Micronas Control Register 0 Control Register 1 Status Register 0 1FF0 1FF1 1FF2 r/w 6 5 4 3 RUN GBC ACT RXO X 0 0 0 0 x INTE ENEM ENOF x 0 0 0 x 0 w x x x TGV r RDL NEM NOF x 0 1 0 r/w May 25, 2004; 6251-606-1PD 2 Section 1 0 23.4. PSC 2 to 0 0 0 0 Res 0 0 0 Res PV ERR x ARB 0 0 x 0 PHASE Res 189 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-9: DIGITbus, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 DGRTMD Rx Length & Tx More Data Register 1FF3 DGS1TA Tx Length Register Status 1 & Tx Address Register 1FF4 1FF5 1FF6 Rx Field & Tx More Address Register 1FF7 2 1 0 23.4. NEM FTYP EOFLD x 0 0 x x x w x FLUSH x x x x 0 x x x 0 r x EMPTY x x x x x 1 x x x x w LEN2 to 0 x x x Res 0 0 Res x x x x Res 0 0 0 Res x x x Res x x x Res LEN2 to 0 Transmit Address STATE PW5 to 0 1 0 0 w 0 Transmit Data x DGRTMA 3 RDL 0 Tx Data Register 4 Transmit More Data r DGTD 5 w r DGTL 6 Section x x x x w Transmit More Address r Receive Field x x x x x Table 27-10: DMA Mnemonic DCS DIC DSA Register Name DMA Control and Status Register DMA Initial Configuration Register DMA Start Address Addr. (hex) 1FE8 1FE9 1FEA Register Configuration r/w w 7 6 5 x x 0 4 3 2 1 0 x DTA DSI DCC STP BSY 0 0 0 0 0 0 0 x WS2 WS1 WS0 x x x WSA 0 0 0 0 0 0 0 0 Res 0 0 0 Res w Bit 7 to 0 1FEB w Bit 15 to 8 1FEC w Bit 23 to 16 0 190 Section 0 0 May 25, 2004; 6251-606-1PD 0 0 18.2. Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-10: DMA, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 DEA DMA End Address 1FED 6 5 4 3 w Bit 7 to 0 1FEE w Bit 15 to 8 1FEF w Bit 23 to 16 0 0 0 0 0 2 Section 1 0 18.2. 0 0 0 Res Table 27-11: EMI Reduction Module Mnemonic ERMC Register Name EMI Reduction Module Control Register Addr. (hex) 1F02 Register Configuration Section 7 6 5 4 3 2 1 0 r x x x x x x x CLKSEL w x x 0 0 0 0 0 CLKSEL x x 0 0 1 0 0 0 4.4.8. Res Table 27-12: High Current Port 0 Mnemonic H0NS H0TRI H0D Register Name Addr. (hex) High Current Port 0 Normal/Special Register 1F80 High Current Port 0 Tristate Register 1F81 High Current Port 0 Data Register 1F82 Register Configuration w w r/w 7 6 x Section 5 4 3 2 1 0 x S5 S4 S3 S2 S1 S0 0 0 0 0 0 0 0 0 x x T5 T4 T3 T2 T1 T0 0 0 0 0 0 0 0 0 x x D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 11.5. Res Res Res Table 27-13: High Current Port 1 Mnemonic H1NS Micronas Register Name High Current Port 1 Normal/Special Register Addr. (hex) 1F84 Register Configuration w 7 6 x 0 Section 5 4 3 2 1 0 x S5 S4 S3 S2 S1 S0 0 0 0 0 0 0 0 May 25, 2004; 6251-606-1PD 11.5. Res 191 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-13: High Current Port 1, continued Mnemonic H1TRI H1D Register Name High Current Port 1 Tristate Register High Current Port 1 Data Register Addr. (hex) 1F85 1F86 Register Configuration w r/w 7 6 x Section 5 4 3 2 1 0 x T5 T4 T3 T2 T1 T0 0 0 0 0 0 0 0 0 x x D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 11.5. Res Res Table 27-14: High Current Port 2 Mnemonic H2NS H2TRI H2D Register Name Addr. (hex) High Current Port 2 Normal/Special Register 1F88 High Current Port 2 Tristate Register 1F89 High Current Port 2 Data Register 1F8A Register Configuration w w r/w 7 6 x Section 5 4 3 2 1 0 x S5 S4 S3 S2 S1 S0 0 0 0 0 0 0 0 0 x x T5 T4 T3 T2 T1 T0 0 0 0 0 0 0 0 0 x x D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 11.5. Res Res Res Table 27-15: High Current Port 3 Mnemonic H3NS H3TRI H3D 192 Register Name Addr. (hex) High Current Port 3 Normal/Special Register 1F90 High Current Port 3 Tristate Register 1F91 High Current Port 3 Data Register 1F92 Register Configuration w w r/w 7 6 x Section 5 4 3 2 1 0 x S5 S4 S3 S2 S1 S0 0 0 0 0 0 0 0 0 x x T5 T4 T3 T2 T1 T0 0 0 0 0 0 0 0 0 x x D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 May 25, 2004; 6251-606-1PD 11.5. Res Res Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-16: Interrupt Controller Mnemonic Register Name Addr. (hex) Register Configuration 7 IRE IRC IRRET Interrupt Enable Register Interrupt Control Register Interrupt Pending and Return Register 1F1F 1F20 1F21 w 1F22 Interrupt Priority, Inputs 2 and 3 1F23 Interrupt Priority, Inputs 4 and 5 1F24 Interrupt Priority, Inputs 6 and 7 1F25 Interrupt Priority, Inputs 8 and 9 1F26 0 0 0 r x x x x DAINT DINT x x w x x x RESET DAINT DINT A1INT CLEAR x 1 1 x x IPF4 IPF3 IPF2 IPF1 IPF0 r IPF7 Interrupt Priority, Inputs 10 and 11 1F27 Interrupt Priority, Inputs 12 and 13 1F28 IRP Micronas Interrupt Priority, Inputs 14 and 15 Interrupt Pending Register 1F29 1F2A 1 1 0 r/w 1 1 1 Res Res 0 0 0 0 0 0 0 0 PRIO5 r/w 0 0 0 PRIO7 r/w 0 0 0 PRIO9 r/w 0 0 0 PRIO11 r/w 0 0 0 PRIO13 r/w Res 0 0 Res 0 0 Res 0 0 Res 0 0 Res 0 0 Res 0 0 Res Res PRIO10 0 0 0 PRIO8 0 0 0 PRIO6 0 0 Res PRIO4 0 0 1 PRIO2 0 0 1 PRIO0 PRIO3 r/w r IPF5 PRIO1 0 IRPRIFE IPF6 r/w 0 IRPRIDC 10.2. A write access signals to the Interrupt Controller that the current request has been served 0 IRPRIBA 0 0 0 IRPRI98 1 0 0 IRPRI76 2 0 0 IRPRI54 3 0 0 IRPRI32 4 A write access enables interrupts according to priority setting (same effect as setting IRC.DINT) 1 Interrupt Priority, Inputs 0 and 1 5 0 w IRPRI10 6 Section PRIO12 0 0 0 0 PRIO15 PRIO14 0 0 0 0 0 0 0 0 IPF15 IPF14 IPF13 IPF12 IPF11 IPF10 IPF9 IPF8 1 1 1 1 1 1 1 1 May 25, 2004; 6251-606-1PD Res 193 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-16: Interrupt Controller, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 IRPM0 IRPP Interrupt Port Mode Register 0 Interrupt Port Prescaler Register 1F2B 1F2C w w 6 5 4 PIT3 3 PIT2 2 Section 1 PIT1 0 10.2. PIT0 0 0 0 0 0 0 x x x x x x 0 0 Res P1INT32 P0INT4 0 0 Res Table 27-17: Memory Banking Mnemonic Register Name Addr. (hex) Register Configuration 7 ABR Alternative Banking Register 1F0F 6 5 r/w 4 3 2 Section 1 0 5.2.2. Alternative Bank Address 0 0 0 0 0 0 0 1 Res Table 27-18: Multiplier Mnemonic Register Name Addr. (hex) Register Configuration 7 MULCAND Multiplicand 1EA0 Multiplier 1EA1 Multiplication Product 1EA3 1EA2 4 3 2 1 0 7.2. multiplicand x x x r/w x x x x Res x x x Res multiplier x MULPROD 5 r/w x MULPLIER 6 Section x x x x r Product high byte 1 r Product low byte 0 x Res Table 27-19: Patch Module Mnemonic PAR0 194 Register Name Patch Address Register 0 Addr. (hex) 1E64 Register Configuration w Section 7 6 5 4 3 2 1 0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 1 1 1 1 1 1 1 1 May 25, 2004; 6251-606-1PD 9.2. Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-19: Patch Module, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 PAR1 PAR2 PDR PER0 PER1 Patch Address Register 1 Patch Address Register 2 Patch Data Register Patch Enable Register 0 Patch Enable Register 1 1E65 1E66 1E67 1E68 1E69 w w w w w 6 5 Section 4 3 2 1 0 PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 1 1 1 1 1 1 1 1 PA23 PA22 PA21 PA20 PA19 PA18 PA17 PA16 1 1 1 1 1 1 1 1 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 0 0 0 0 0 0 0 0 PSEL6 PSEL5 PSEL4 PSEL3 PSEL2 PSEL1 PSEL0 PMEN 0 0 0 0 0 0 0 0 x x x x x PSEL9 PSEL8 PSEL7 x x x x x 0 0 0 9.2. Res Res Res Res Res Table 27-20: Port 0 Mnemonic P0PIN Register Name Port 0 Data Register Addr. (hex) 1F7E Register Configuration r 7 6 x x Section 5 4 3 2 1 0 x P5 P4 P3 P2 P1 x x x x x x x x 11.1. Res Table 27-21: Power Saving Module Mnemonic WUS Register Name Wake-Up Source Register Addr. (hex) 1E71 1E70 Register Configuration 7 6 5 4 3 2 1 0 r/w RTC x x x x x WP9 WP8 1 r/w WP7 WP6 WP5 WP4 WP3 WP2 WP1 WP0 0 No HW reset Micronas Section May 25, 2004; 6251-606-1PD 8.2. Res 195 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-21: Power Saving Module, continued Mnemonic SSR Register Name Sub Second Reload Register Addr. (hex) Register Configuration Section 7 6 5 4 3 2 1 0 r/w x x x x x x x x 1E76 r/w x x x x 1E75 r/w Bit 15 to 8 1 1E74 r/w Bit 7 to 0 0 1E77 Bit 19 to 16 Sub Second Counter 1E7B Res r x x x x 1E7A x x x x r x x x x 1E79 r Bit 15 to 8 1 1E78 r Bit 7 to 0 0 Bit 19 to 16 Real Time Counter 1E7F x Res r/w x x x 1E7E x x x x r/w x x x 1E7D r/w x x MIN 1 1E7C r/w x x SEC 0 HR Wake Port Mode Register 1E80 WPM2 1E81 WPM4 1E82 WPM6 1E83 WPM8 1E84 WSC Wake Source Control 1E88 r/w x MOD1 Res x MOD0 x x x x x Res AST RTC P 0x00 after VDD power on OSC RTCC Oscillator Source Register RTC Control Register 1E90 1E94 r/w r/w x LD Polling Register 1E99 1E98 RC XK XM 1 0 1 No HW reset x x x SEL r/w x r/w ENA CLK OE PRE SRC 196 May 25, 2004; 6251-606-1PD Res 0 PER DEL 0x00 0 Res x x 0 Res No HW reset POL 0 No HW reset r/w 3 2 No HW reset WPM0 3 2 No HW reset RTC 8.2. 2 No HW reset SSC 3 1 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-21: Power Saving Module, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 SMX Signal Multiplexer Register 1E9C r/w BYP 6 5 4 3 x x x x 2 Section 1 0 MUX 0 0x00 8.2. Res Table 27-22: Pulse Width Modulator Mnemonic Register Name Addr. (hex) Register Configuration 7 PWM0 PWM 0 Register 1F50 PWM1 PWM 1 Register 1F51 PWM2 PWM 2 Register 1F52 PWM3 PWM 3 Register 1F5E PWM4 PWM 4 Register 1F5F 6 5 w 4 3 2 Section 1 0 14.2. Pulse width value 0 0 0 0 0 0 0 0 Res Table 27-23: Serial Synchronous Peripheral Interface Mnemonic Register Name Addr. (hex) Register Configuration 7 SPI0D SPI0M SPI1D SPI1M SPI 0 Data Register SPI 0 Mode Register SPI 1 Data Register SPI 1 Mode Register 1F10 1F11 1F12 1F13 6 5 r/w r/w 3 2 1 0 19.2. Bit 7 to 0 of Rx/Tx Data 0 0 BIT8 LEN9 0 0 0 0 0 RXSEL INTERN NEDGE 0 r/w r/w 4 Section 0 0 0 0 x 0 Res CSF 0 0 0 Res 0 0 0 Res 0 Res Bit 7 to 0 of Rx/Tx Data 0 0 BIT8 LEN9 0 0 0 0 0 RXSEL INTERN NEDGE 0 0 0 x 0 CSF 0 Table 27-24: Stepper Motor Module Mnemonic SMVC Micronas Register Name SMM Control Register Addr. (hex) 1F5A Register Configuration w 7 6 x x x x 5 4 3 SEL 0 May 25, 2004; 6251-606-1PD 0 2 Section 1 x 0 x 0 16.2. QUAD 0 0 Res 197 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-24: Stepper Motor Module, continued Mnemonic SMVSIN Register Name SMM Sine Register Addr. (hex) 1F5B Register Configuration r 7 6 5 4 3 2 1 0 x x x x x x x BUSY 0 0 0 Res Res w SMVCMP SMM Cosine Register SMM Comparator Register 1F5C 1F5D 16.2. 8bit Sine Value 0 SMVCOS Section 0 0 0 w r/w 0 8bit Cosine Value 0 0 0 0 0 0 0 0 x x ACRD ACRB x ACRE ACRC ACRA x x 0 0 x 0 0 0 Res Table 27-25: Test Registers Mnemonic Register Name Addr. (hex) Register Configuration 7 TST3 Test Register 3 1FFD Test Register 1 1FFE Test Register 2 1FFF 4 3 2 1 0 6.4. For testing purposes only 0 0 w 0 0 0 0 0 Res 0 0 0 Res 0 0 0 Res For testing purposes only 0 TST2 5 w 0 TST1 6 Section 0 0 w 0 0 For testing purposes only 0 0 0 0 0 Table 27-26: Timers Mnemonic Register Name Addr. (hex) Register Configuration 7 TIM0L Timer 0 low byte 1F4E Timer 0 high byte 1F4F 4 3 2 1 Read low byte of down-counter and latch high byte w Write low byte of reload value and reload down-counter 1 1 1 1 1 r Latched high byte of down-counter w High byte of reload value 1 198 5 r 1 TIM0H 6 Section 1 1 May 25, 2004; 6251-606-1PD 1 1 1 0 13. 1 1 Res 1 1 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-26: Timers, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 TIM1 Timer 1 Register 1F54 TIM2 Timer 2 Register 1F55 6 5 4 w 3 2 Section 1 0 13. Reload value 0 0 0 0 0 0 0 0 Res Table 27-27: Universal Asynchronous Receiver Transmitter 0 Mnemonic Register Name Addr. (hex) Register Configuration 7 UA0D UART 0 Data Register 1FA0 UART 0 Control and Status Register 1FA1 UART 0 Baudrate Register low byte 1FA2 UA0IM UA0CA UA0IF Micronas UART 0 Baudrate Register high byte UART 0 Interrupt Mask Register UART 0 Compare Address Register UART 0 Interrupt Flag Register 1FA3 1FA4 1FA5 1FA6 3 w Transmit register r RBUSY w 0 20.3. x x x x x x BRKD FRER OVRR PAER EMPTY FULL TBUSY Res x x 0 x 1 0 0 x x x x STPB ODD PAR LEN x x x x 0 0 0 0 Res Res 0 0 0 Res Res Bit 7 to 0 of Baud Rate 0 0 0 0 x x x - - - 0 0 0 0 0 x x x x x ADR BRK RCVD - - - - - 0 0 0 Res Res w r 1 x w w 2 0 0 UA0BR1 4 Receive register w UA0BR0 5 r x UA0C 6 Section Bit 12 to 8 of Baud Rate Bit 7 to 0 of address 0 0 0 0 0 0 0 0 Test Test Test Test Test ADR BRK RCVD - - - - - x 0 0 May 25, 2004; 6251-606-1PD Res 199 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-28: Universal Asynchronous Receiver Transmitter 1 Mnemonic Register Name Addr. (hex) Register Configuration 7 UA1D UART 1 Data Register 1F18 6 UART 1 Control and Status Register 1F19 UART 1 Baudrate Register low byte 1F1A w Transmit register r RBUSY UA1IM UA1CA UA1IF UART 1 Baudrate Register high byte UART 1 Interrupt Mask Register UART 1 Compare Address Register UART 1 Interrupt Flag Register 1F1B 1F1C 1F1D w r 0 20.3. x x x x x BRKD FRER OVRR PAER EMPTY FULL TBUSY Res 0 x x 0 x 1 0 0 x x x x STPB ODD PAR LEN x x x x 0 0 0 0 Res Res 0 0 0 Res Res Bit 7 to 0 of Baud Rate 0 0 0 0 x x x - - - 0 0 0 0 0 x x x x x ADR BRK RCVD - - - - - 0 0 0 Res Res w 1F1E 1 x w w 2 x 0 UA1BR1 3 Receive register w UA1BR0 4 r x UA1C 5 Section Bit 12 to 8 of Baud Rate Bit 7 to 0 of address 0 0 0 0 0 0 0 0 Test Test Test Test Test ADR BRK RCVD - - - - - x 0 0 Res Table 27-29: Universal Asynchronous Receiver Transmitter 2 Mnemonic Register Name Addr. (hex) Register Configuration 7 UA2D UART 2 Data Register 1F64 UART 2 Control and Status Register 1F65 4 3 Receive register w Transmit register r RBUSY w 200 5 r x UA2C 6 2 Section 1 0 20.3. x x x x x x x BRKD FRER OVRR PAER EMPTY FULL TBUSY 0 x x 0 x 1 0 0 x x x x STPB ODD PAR LEN x x x x 0 0 0 0 May 25, 2004; 6251-606-1PD Res Res Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-29: Universal Asynchronous Receiver Transmitter 2, continued Mnemonic Register Name Addr. (hex) Register Configuration 7 UA2BR0 UART 2 Baud rate Register low byte 1F66 UA2IM UA2CA UA2IF UART 2 Baud rate Register high byte UART 2 Interrupt Mask Register UART 2 Compare Address Register UART 2 Interrupt Flag Register 1F67 1F68 1F69 5 w w w 0 0 r 3 2 1 0 20.3. 0 0 0 0 0 Res Res x x x - - - 0 0 0 0 0 x x x x x ADR BRK RCVD - - - - - 0 0 0 Res Res w 1F6A 4 Bit 7 to 0 of Baud Rate 0 UA2BR1 6 Section Bit 12 to 8 of Baud Rate Bit 7 to 0 of address 0 0 0 0 0 0 0 0 Test Test Test Test Test ADR BRK RCVD - - - - - x 0 0 Res Table 27-30: Universal Port 1 Mnemonic U1D U1SEG10 Register Name Universal Port 1 Data Register Universal Port 1 Segments of U1.0, U1.1 Addr. (hex) 1F98 1F99 Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x w LCDSLV 0 U1SEG32 U1M30 U1SEG54 Universal Port 1 Segments of U1.2, U1.3 Universal Port 1 Mode of U1.0 to U1.3 Universal Port 1 Segments of U1.4, U1.5 1F9A 1F9B 1F9C w w w 11.3. LCD 0 1 0 0 0 1 0 Res x S3 T3 x x S2 T2 x Port 0 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 Micronas 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res 201 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-30: Universal Port 1, continued Mnemonic U1M54 U1SEG76 Register Name Universal Port 1 Mode of U1.4, U1.5 Universal Port 1 Segments of U1.6, U1.7 Addr. (hex) 1F9D 1F9E Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U1M76 Universal Port 1 Mode of U1.6, U1.7 1F9F w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-31: Universal Port 2 Mnemonic U2D U2SEG10 Register Name Universal Port 2 Data Register Universal Port 2 Segments of U2.0, U2.1 Addr. (hex) 1F30 1F32 Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U2M10 U2SEG32 Universal Port 2 Mode of U2.0, U2.1 Universal Port 2 Segments of U2.2, U2.3 1F33 1F34 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x x S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U2M32 U2SEG54 Universal Port 2 Mode of U2.2, U2.3 Universal Port 2 Segments of U2.4, U2.5 1F35 1F36 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 202 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-31: Universal Port 2, continued Mnemonic U2M54 U2SEG76 Register Name Universal Port 2 Mode of U2.4, U2.5 Universal Port 2 Segments of U2.6, U2.7 Addr. (hex) 1F37 1F38 Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U2M76 Universal Port 2 Mode of U2.6, U2.7 1F39 w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-32: Universal Port 3 Mnemonic U3D U3SEG10 Register Name Universal Port 3 Data Register Universal Port 3 Segments of U3.0, U3.1 Addr. (hex) 1FAC 1FAE Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U3M10 U3SEG32 Universal Port 3 Mode of U3.0, U3.1 Universal Port 3 Segments of U3.2, U3.3 1FAF 1FB0 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x DPM2 S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U3M32 U3SEG54 Universal Port 3 Mode of U3.2, U3.3 Universal Port 3 Segments of U3.4, U3.5 1FB1 1FB2 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 Micronas 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res 203 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-32: Universal Port 3, continued Mnemonic U3M54 U3SEG76 Register Name Universal Port 3 Mode of U3.4, U3.5 Universal Port 3 Segments of U3.6, U3.7 Addr. (hex) 1FB3 1FB4 Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U3M76 Universal Port 3 Mode of U3.6, U3.7 1FB5 w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-33: Universal Port 4 Mnemonic U4D U4SEG10 Register Name Universal Port 4 Data Register Universal Port 4 Segments of U4.0, U4.1 Addr. (hex) 1FB8 1FBA Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U4M10 U4SEG32 Universal Port 4 Mode of U4.0, U4.1 Universal Port 4 Segments of U4.2, U4.3 1FBB 1FBC w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x x S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U4M32 U4SEG54 Universal Port 4 Mode of U4.2, U4.3 Universal Port 4 Segments of U4.4, U4.5 1FBD 1FBE w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 204 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-33: Universal Port 4, continued Mnemonic U4M54 U4SEG76 Register Name Universal Port 4 Mode of U4.4, U4.5 Universal Port 4 Segments of U4.6, U4.7 Addr. (hex) 1FBF 1FC0 Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U4M76 Universal Port 4 Mode of U4.6, U4.7 1FC1 w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-34: Universal Port 5 Mnemonic U5D U5SEG10 Register Name Universal Port 5 Data Register Universal Port 5 Segments of U5.0, U5.1 Addr. (hex) 1FC4 1FC6 Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U5M10 U5SEG32 Universal Port 5 Mode of U5.0, U5.1 Universal Port 5 Segments of U5.2, U5.3 1FC7 1FC8 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x x S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U5M32 U5SEG54 Universal Port 5 Mode of U5.2, U5.3 Universal Port 5 Segments of U5.4, U5.5 1FC9 1FCA w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 Micronas 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res 205 CDC16xxF-E PRELIMINARY DATA SHEET Table 27-34: Universal Port 5, continued Mnemonic U5M54 U5SEG76 Register Name Universal Port 5 Mode of U5.4, U5.5 Universal Port 5 Segments of U5.6, U5.7 Addr. (hex) 1FCB 1FCC Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U5M76 Universal Port 5 Mode of U5.6, U5.7 1FCD w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-35: Universal Port 6 Mnemonic U6D U6SEG10 Register Name Universal Port 6 Data Register Universal Port 6 Segments of U6.0, U6.1 Addr. (hex) 1FD0 1FD2 Register Configuration r/w w Section 7 6 5 4 3 2 1 0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U6M10 U6SEG32 Universal Port 6 Mode of U6.0, U6.1 Universal Port 6 Segments of U6.2, U6.3 1FD3 1FD4 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x x S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U6M32 U6SEG54 Universal Port 6 Mode of U6.2, U6.3 Universal Port 6 Segments of U6.4, U6.5 1FD5 1FD6 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S5 T5 x x S4 T4 x Port x w SEG5.3 SEG5.2 SEG5.1 SEG5.0 SEG4.3 SEG4.2 SEG4.1 SEG4.0 LCD 0 206 0 1 May 25, 2004; 6251-606-1PD 0 0 0 1 0 Res Micronas CDC16xxF-E PRELIMINARY DATA SHEET Table 27-35: Universal Port 6, continued Mnemonic U6M54 U6SEG76 Register Name Universal Port 6 Mode of U6.4, U6.5 Universal Port 6 Segments of U6.6, U6.7 Addr. (hex) 1FD7 1FD8 Register Configuration w w Section 7 6 5 4 3 2 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S7 T7 x x S6 T6 x Port x 11.3. w SEG7.3 SEG7.2 SEG7.1 SEG7.0 SEG6.3 SEG6.2 SEG6.1 SEG6.0 LCD 0 U6M76 Universal Port 6 Mode of U6.6, U6.7 1FD9 w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res Res Table 27-36: Universal Port 7 Mnemonic U7D U7SEG10 Register Name Universal Port 7 Data Register Universal Port 7 Segments of U7.0, U7.1 Addr. (hex) 1FDC 1FDE Register Configuration r/w w Section 7 6 5 4 3 2 1 0 x x x x D3 D2 D1 D0 0 0 0 0 0 0 0 0 Res S1 T1 x x S0 T0 x Port x 11.3. w SEG1.3 SEG1.2 SEG1.1 SEG1.0 SEG0.3 SEG0.2 SEG0.1 SEG0.0 LCD 0 U7M10 U7SEG32 Universal Port 7 Mode of U7.0, U7.1 Universal Port 7 Segments of U7.2, U7.3 1FDF 1FE0 w w 0 1 0 0 0 1 0 Res x x x x x x x PMODE 0 0 0 0 0 0 0 1 Res S3 T3 x x S2 T2 x Port x w SEG3.3 SEG3.2 SEG3.1 SEG3.0 SEG2.3 SEG2.2 SEG2.1 SEG2.0 LCD 0 U7M32 Micronas Universal Port 7 Mode of U7.2, U7.3 1FE1 w 0 1 0 0 0 1 0 x x x x x x x PMODE 0 0 0 0 0 0 0 1 May 25, 2004; 6251-606-1PD Res Res 207 CDC16xxF-E PRELIMINARY DATA SHEET 28. Differences This chapter describes differences of this document to predecessor document "CDC16xxF-E Automotive Controller Family User Manual", March 31, 2003, 6251-606-2AI. # Section Description 1 1. Introduction 1.1. Features, Table 1-1: CDC16xxF Family Feature List, page 6: Interrupt Controller expanding NMI: "16 priority levels" changed into "15 priority levels" and no. of "Port WakeUp Inputs including Slope / Level Selection" added. 1.1. Features, Table 1-1: CDC16xxF Family Feature List, page 8: Temperature Range, CDC1605F-E EMU: "Tcase: -40 C to +105 C" changed into "Tcase: 0 to +70 C". 2 2. Package and Pins Fig. 2-9 removed, Table 2-2 corrected. 3 3. Electrical Data 3.1. Absolute Maximum Ratings: Revised Introduction. 3.2. Recommended Operating Conditions: Revised Introduction; Tj removed. 3.3. Characteristics, Table 3-3: Temperature Range "TCASE: -40 C to +105 C" changed into "TCASE: 0 to +70 C", values for RC Oscillator and Clock Supervision added, some values and footnotes revised, AIDDa: Test Conditions changed. 3.4. Recommended Crystal Characteristics, Table 3-4: Temperature Range "TCASE: -40 C to +105 C" changed into "TCASE: 0 to +70 C". 3.5. Flash/EMU Port Characteristics, Table 3-5: Temperature Range "TCASE: -40 C to 85 C" changed into "TCASE: 0 to +70 C". 4 5. Memory and Boot System 5.1.1. Address Map: "Emulation mode: E=1, Native mode: E=0" changed into a footnote of Table 5-1: Reserved (physical) Addresses. "5.3.4. Used RAM" changed into "5.3.4. Used Resources" and enlarged. 5 6. Core Logic 6.1. Control Register CR: Description of RESLNG corrected. Fig. 6-1: Analog core logic block diagram renamed, Signals and logic for TST.MIX, TEST, MOSPOR and RESBP removed, Power supplies revised. Fig. 6-2: Reset Logic Block Diagram revised: Signals MOSPOR, COMPRES and other internal signal names removed, shown logic minimized, CSW2.FHR logic corrected. 6.2.2.5. Forced Hardware Reset: added. 6.2.2.6. Wake-Up Reset: added. 6.2.5. Reset Registers: CSW2: description revised. 6.3. Standby Registers: Text of RESET cause for SR3.WAID modified and added as Footnote. 6 7. Multiplier Added: "It is fully supported by the WDC C-compiler WDC816CC." 7 8. Power-Saving Module (PSM) Some phrases corrected and clarified. Fig. 8-3, Fig. 8-4 and Fig. 8-5: Signals MOSPOR, COMPRES, WKX and RESINT removed. 8.2. Registers: Text of RESET cause for reg. WSC modified. 8 10. Interrupt Controller (IR) Fig. 10-1: "Block Diagram": corrected: A0 ... A15 are unidirectional. Fig. 10-5: "Port Interrupts": corrected: U5.7, U6.6 are not influenced by IRPM0. 10.2. Registers: Reset pattern of IRRET and IRP corrected. 208 May 25, 2004; 6251-606-1PD Micronas CDC16xxF-E PRELIMINARY DATA SHEET # Section Description 9 11. Ports P0D.Dn renamed to P0PIN.Pn. Normal/Special Flags of registers HxNS and UxSEG renamed from N/Sn to Sn. Tristate Flags of registers HxTRI renamed from TRIy to Ty. Tristate Flags of registers UxSEG renamed from TRIy to Ty. 10 13. Timers (TIMER) Corrected and clarified. 11 15. Capture Compare Module (CAPCOM) Fig. 15-1: CAPCOM Module Block Diagram and 15.2. Registers: Flags CCxM.MSK devided into CCxM.MCAP, CCxM.MCMP and CCxM.MOFL. 12 16. Stepper Motor Module (SMM) 16.1. Functional Description, Fig. 16-2: Block Diagram of Output Generation Circuit: "fSM / 2E8" changed into "fSM / 256". 13 18. DMA Fig. 18-1: Block Diagram: Arrow for interface between U2 and GDB changed form unidirectional to bidirectional. 14 19. Serial Synchronous Peripheral Interface (SPI) 19.2. Registers: SPIxM: description revised. 15 23. DIGITbus Master Module 23.4. Registers: Flag "DGRTMD.EOF" renamed into "DGRTMD.EOFLD". 16 24. Audio Module (AM) 24.1.2. Initialization: Corrected and clarified. 17 25. Hardware Options 25.2. Listing of Dedicated Addresses and Corresponding Hardware Options: Some register descriptions clarified. 18 26. Register Cross Reference Table V2.1 26.1. CAN RAM, memory pages 19 ... 1B: added. 19 27. Register Quick Reference Table 27-7: Core Logic: SR3 Footnote added. Table 27-16: Interrupt Controller: Addr. of IRE added. Table 27-23: Serial Synchronous Peripheral Interface: SPI0 added. Other corrections according to the changes in the accessory sections. 20 28. Differences Micronas Updated May 25, 2004; 6251-606-1PD 209 CDC16xxF-E PRELIMINARY DATA SHEET 29. Data Sheet History 1. Advance Information: "CDC16xxF-E Automotive Controller Family User Manual", Feb. 17, 2003, 6251-606-1AI. First release of the advance information. Originally created for the HW version CDC16xxF-E1. 2. Advance Information: "CDC16xxF-E Automotive Controller Family User Manual", March 31, 2003, 6251-606-2AI. Second release of the advance information. Originally created for the HW version CDC16xxF-E2. 3. Preliminary Datasheet: "CDC16xxF-E Automotive Controller Family User Manual", May 25, 2004, 6251-606-1PD. First release of the preliminary datasheet. Originally created for the HW version CDC16xxF-E2. Micronas GmbH Hans-Bunte-Strasse 19 D-79108 Freiburg (Germany) P.O. Box 840 D-79008 Freiburg (Germany) Tel. +49-761-517-0 Fax +49-761-517-2174 E-mail: docservice@micronas.com Internet: www.micronas.com Printed in Germany Order No. 6251-606-1PD 210 All information and data contained in this data sheet are without any commitment, are not to be considered as an offer for conclusion of a contract, nor shall they be construed as to create any liability. Any new issue of this data sheet invalidates previous issues. Product availability and delivery are exclusively subject to our respective order confirmation form; the same applies to orders based on development samples delivered. By this publication, Micronas GmbH does not assume responsibility for patent infringements or other rights of third parties which may result from its use. Further, Micronas GmbH reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of Micronas GmbH. May 25, 2004; 6251-606-1PD Micronas