| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Turbo Plus Series Fast Turbo 8032 with Programmable Logic FAST 8-
Top Searches for this datasheetuPSD34xx Turbo Plus Series Fast Turbo 8032 with Programmable Logic FAST 8-BIT TURBO 8032 MCU, 40MHz Advanced core, 4-clocks instruction MIPs peak performance 40MHz (5V) JTAG Debug In-System Programming 16-bit internal instruction path fetches double-byte instruction single memory cycle Branch Cache instruction Prefetch Queue Dual XDATA pointers with automatic increment decrement Compatible with party 8051 tools DUAL FLASH MEMORIES WITH MEMORY MANAGEMENT Place either memory into 8032 program address space data address space READ-while-WRITE operation InApplication Programming EEPROM emulation Single voltage program erase 100K guaranteed erase cycles, 15-year retention CLOCK, RESET, POWER SUPPLY MANAGEMENT SRAM Battery Backup capable Flexible 8-level clock divider register Normal, Idle, Power Down Modes Power-on Voltage reset supervisor Programmable Watchdog Timer PROGRAMMABLE LOGIC, GENERAL PURPOSE macrocells logic applications (e.g., shifters, state machines, chip-selects, glue-logic keypads, LCDs) CONVERTER Eight Channels, 10-bit resolution, Figure Packages TQFP52 (T), 52-lead, Thin, Quad, Flat TQFP80 (U), 80-lead, Thin, Quad, Flat COMMUNICATION INTERFACES v2.0 Full Speed (12Mbps) endpoint pairs (In/Out), each endpoint with 64-byte FIFO (supports Control, Intr, Bulk transfer types) Master/Slave controller, 833kHz Master controller, 1MHz UARTs with independent baud rate IrDA Potocol: kbaud I/O, tolerant uPSD34xxV TIMERS INTERRUPTS Three 8032 standard 16-bit timers Programmable Counter Array (PCA), 16-bit modules PWM, CAPCOM, timers 8/10/16-bit operation Interrupt sources with external interrupt pins OPERATING VOLTAGE SOURCE (±10%) Devices: 5.0V 3.3V sources 3.3V Devices: 3.3V source October 2005 1/264 This preliminary information product development undergoing evaluation. Details subject change without notice. uPSD34xx Table Device Summary Part Number uPSD3422E-40T6 uPSD3422EV-40T6 uPSD3422E-40U6 uPSD3422EV-40U6 uPSD3433E-40T6 uPSD3433EV-40T6 uPSD3433E-40U6 uPSD3433EV-40U6 uPSD3434E-40T6 uPSD3434EV-40T6 uPSD3434E-40U6 uPSD3434EV-40U6 uPSD3454E-40T6 uPSD3454EV-40T6 uPSD3454E-40U6 uPSD3454EV-40U6 Flash (bytes) 128K 128K 128K 128K 256K 256K 256K 256K 256K 256K 256K 256K Flash SRAM GPIO 8032 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V 5.0V 3.3V Pkg. TQFP52 TQFP52 TQFP80 TQFP80 TQFP52 TQFP52 TQFP80 TQFP80 TQFP52 TQFP52 TQFP80 TQFP80 TQFP52 TQFP52 TQFP80 TQFP80 Note: Operating temperature Industrial range (-40°C 85°C). 2/264 uPSD34xx TABLE CONTENTS TABLE CONTENTS FEATURES SUMMARY TABLE CONTENTS SUMMARY DESCRIPTION. DESCRIPTIONS HARDWARE DESCRIPTION MEMORY ORGANIZATION Internal Memory (MCU Module, Standard 8032 Memory: DATA, IDATA, SFR) External Memory (PSD Module: Program memory, Data memory). 8032 CORE PERFORMANCE ENHANCEMENTS Pre-Fetch Queue (PFQ) Branch Cache (BC) Example, Multi-cycle Instructions Aggregate Performance MODULE DISCRIPTION 8032 REGISTERS Stack Pointer (SP) Data Pointer (DPTR) Program Counter (PC). Accumulator (ACC) Register (B). General Purpose Registers R7). Program Status Word (PSW) SPECIAL FUNCTION REGISTERS (SFR) 8032 ADDRESSING MODES Register Addressing Direct Addressing Register Indirect Addressing Immediate Addressing External Direct Addressing External Indirect Addressing Indexed Addressing Relative Addressing Absolute Addressing Long Addressing Addressing 3/264 uPSD34xx TABLE CONTENTS uPSD34xx INSTRUCTION SUMMARY DUAL DATA POINTERS. Data Pointer Control Register, DPTC (85h) Data Pointer Mode Register, DP(86h) DEBUG UNIT. INTERRUPT SYSTEM. Individual Interrupt Sources CLOCK GENERATION MCU_CLK PERIPH_CLK POWER SAVING MODES Idle Mode Power-down Mode Reduced Frequency Mode OSCILLATOR EXTERNAL COMPONENTS PORTS MODULE. Port Operating Modes INTERFACE. PSEN Cycles READ WRITE Cycles Connecting External Devices Programmable Timing Controlling SUPERVISORY FUNCTIONS External Reset Input Pin, RESET_IN Voltage Detect, LVD. Power-up Reset JTAG Debug Reset Watchdog Timer, STANDARD 8032 TIMER/COUNTERS Standard Timer SFRs Clock Sources SFR, TCON SFR, TMOD Timer Timer Operating Modes Timer 4/264 uPSD34xx TABLE CONTENTS SERIAL UART INTERFACES. UART Operation Modes Serial Port Control Registers UART Baud Rates More About UART Mode More About UART Mode More About UART Modes IrDA INTERFACE Baud Rate Selection Pulse Width Selection INTERFACE Interface Main Features Communication Flow Operating Modes Arbitration Clock Synchronization General Call Address Serial Engine (SIOE) Interface Control Register (S1CON) Interface Status Register (S1STA) Data Shift Register (S1DAT). Address Register (S1ADR) START Sample Setting (S1SETUP) Operating Sequences (SYNCHRONOUS PERIPHERAL INTERFACE) Features Communication Flow Full-Duplex Operation Bus-Level Activity Registers Configuration Dynamic Control INTERFACE Basic Concepts Types Transfers Endpoint FIFOs Registers Typical Connection ANALOG-TO-DIGITAL CONVERTOR (ADC) Port Channel Selects 5/264 uPSD34xx TABLE CONTENTS PROGRAMMABLE COUNTER ARRAY (PCA) WITH Block Clock Selection Operation Modes Capture Mode. Timer Mode Toggle Mode Mode (X8), Fixed Frequency Mode (X8), Programmable Frequency Mode Fixed Frequency, 16-bit Mode Fixed Frequency, 10-bit Writing Capture/Compare Registers Control Register Definition Interrupts MODULE Module Functional Description Memory Mapping Module Data Width Runtime Control Register Definitions (csiop). Module Detailed Operation. Module Reset Conditions AC/DC PARAMETERS MAXIMUM RATING. PARAMETERS. PACKAGE MECHANICAL INFORMATION PART NUMBERING IMPORTANT NOTES Interrupts with Idle Mode Reset Interrupt Reset Data Toggle FIFO Accessibility Erroneous Resend Data Packet FIFO Pairing Operation. PORT 5-volt Tolerant REVISION HISTORY. 6/264 uPSD34xx SUMMARY DESCRIPTION SUMMARY DESCRIPTION Turbo Plus uPSD34xx Series combines powerful 8051-based microcontroller with flexible memory structure, programmable logic, rich peripheral form ideal embedded controller. core fast 4-cycle 8032 with 4-byte instruction prefetch queue (PFQ) 4-entry fully associative branching cache (BC). connected 16-bit internal instruction path maximize performance, enabling loops code smaller localities execute extremely fast. 16-bit wide instruction path Turbo Plus Series allows double-byte instructions fetched from memory single memory cycle. This keeps average performance near peak performance (peak performance 40MHz Turbo Plus uPSD34xx MIPS single-byte instructions, average performance will approximately MIPS single- multibyte instructions). (full speed, 12Mbps) included, providing endpoints, each with 64-byte FIFO maintain high data throughput. Endpoint (Control Endpoint) uses endpoints directions, remaining eight endpoints allocated either type transfers: Bulk Interrupt. Code development easily managed without hardware In-Circuit Emulator using serial JTAG debug interface. JTAG also used InSystem Programming (ISP) little seconds, perfect manufacturing development. 8032 core coupled Programmable System Device (PSD) architecture optimize 8032 memory structure, offering independent banks Flash memory that placed virtually address within 8032 program data address space, easily paged beyond bytes using on-chip programmable decode logic. Dual Flash memory banks provide robust solution remote product updates field through In-Application Programming (IAP). Dual Flash banks also support EEPROM emulation, eliminating need external EEPROM chips. General purpose programmable logic (PLD) included build endless variety glue-logic, saving external logic devices. configured using software development tool, PSDsoft Express, available from www.st.com/psm, charge. uPSD34xx also includes supervisor functions such programmable watchdog timer lowvoltage reset. Note: list known limitations uPSD34xx devices, please refer IMPORTANT NOTES, page 262. 7/264 uPSD34xx SUMMARY DESCRIPTION Figure Block Diagram uPSD34xx 16-bit Timer/ Counters External Interrupts Turbo 8032 Core Programmable Decode Page Logic Flash Memory: 64K, 128K, 256K Bytes Flash Memory: Bytes SRAM: Bytes P3.0:7 UART0 GPIO, Port (80-pin only) GPIO, Port General Purpose Programmable Logic, Macrocells GPIO, Port GPIO, Port GPIO, Port PA0:7 PB0:7 PD1:2 10-bit Optional IrDA Encoder/Decoder SYSTEM P1.0:7 GPIO, Port PC0:7 JTAG 8032 Address/Data/Control (80-pin device only) Supervisor: Watchdog Low-Voltage Reset VCC, VDD, GND, Reset, Crystal UART1 16-bit PWM, CAPCOM, TIMER P4.0:7 USB+, USB- GPIO, Port Dedicated Pins v2.0, Full Speed FIFOs AI09695b 8/264 uPSD34xx DESCRIPTIONS DESCRIPTIONS Figure TQFP52 Connections P1.6/SPITXD(2)/ADC6 P1.7/SPISEL(2)/ADC7 AVCC/VREF(3) RESET_IN PD1/CLKIN JTAG JTAG DEBUG 3.3V USB+ P1.5/SPIRXD(2)/ADC5 P1.4/SPICLK(2)/ADC4 P1.3/TXD1(IrDA)(2)/ADC3 P1.2/RXD1(IrDA)(2)/ADC2 P1.1/T2X(2)/ADC1 P1.0/T2(2)/ADC0 VDD(1) XTAL2 XTAL1 P3.7/SCL P3.6/SDA P3.5/C1 P3.4/C0 USB- PC2/VSTBY JTAG JTAG SPISEL(2)/PCACLK1/P4.7 SPITXD(2)/TCM5/P4.6 SPIRXD(2)/TCM4/P4.5 T2X(2)/TCM1/P4.1 T2(2)/TCM0/P4.0 RXD0/P3.0 TXD0/P3.1 EXTINT0/TG0/P3.2 TXD1(IrDA)(2)/PCACLK0/P4.3 SPICLK(2)/TCM3/P4.4 RXD1(IrDA)(2)/TCM2/P4.2 EXTINT1/TG1/P3.3 AI09696 Note: applications, must connected 5.0V source. 3.3V applications, must connected 3.3V source. These signals used different ports (Port Port flexibility. Default Port1. AVREF 3.3V AVCC shared 52-pin package only. channels must 3.3V AVREF 52-pin package. 9/264 uPSD34xx DESCRIPTIONS Figure TQFP80 Connections P1.6/SPITXD(3)/ADC6 P1.7/SPISEL(3)/ADC7 P3.2/EXINT0/TG0 P3.0/RXD0 P3.1/TXD0 RESET_IN PSEN AVCC VREF PD2/CSI P3.3/TG1/EXINT1 PD1/CLKIN JTAG JTAG DEBUG PC4/TERR 3.3V USB+(1) VDD(2) USB- PC3/TSTAT PC2/VSTBY JTAG SPISEL(2)/PCACLK1/P4.7 SPITXD(2)/TCM5/P4.6 JTAG P1.5/SPIRXD(3)/ADC5 P1.4/SPICLK(3)/ADC4 P1.3/TXD1(IrDA)(3)/ADC3 P1.2/RXD1(IrDA)(3)/ADC2 P1.1/T2X(3)/ADC1 P1.0/T2(3)/ADC0 VDD(1) XTAL2 XTAL1 P3.7/SCL P3.6/SDA P3.5/C1 SPIRXD(2)/TCM4/P4.5 SPICLK(2)/TCM3/P4.4 TXD1(IrDA)(2)/PCACLK0/P4.3 RXD1(IrDA)(2)/TCM2/P4.2 T2X(2)/TCM1/P4.1 T2(2)/TCM0/P4.0 P3.4/C0 AI09697 Note: Connected Note: USB+ needs 1.5k pull-up resistor. applications, must connected 5.0V source. 3.3V applications, must connected 3.3V source. These signals used different ports (Port Port flexibility. Default Port1. 10/264 uPSD34xx DESCRIPTIONS Table Definitions Port MCUAD0 MCUAD1 MCUAD2 MCUAD3 MCUAD4 MCUAD5 MCUAD6 MCUAD7 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P3.0 P3.1 P3.2 Signal Name ADC0 ADC1 RxD1 ADC2 TXD1 ADC3 SPICLK ADC4 SPIRxD ADC5 SPITXD ADC6 SPISEL ADC7 RxD0 TXD0 EXINT0 INT1 TCM0 80-Pin 52-Pin In/Out No.(1) Basic External Multiplexed Address/ Data A0/D0 Multiplexed Address/ Data A1/D1 Multiplexed Address/ Data A2/D2 Multiplexed Address/ Data A3/D3 Multiplexed Address/ Data A4/D4 Multiplexed Address/ Data A5/D5 Multiplexed Address/ Data A6/D6 Multiplexed Address/ Data A7/D7 General port General port General port General port General port General port General port General port General port General port General port Function Alternate Alternate P3.3 P3.4 P3.5 P3.6 P3.7 P4.0 General port General port General port General port General port General port Timer Count input (T2) Timer Trigger input (T2X) UART1 IrDA Receive (RxD1) UART IrDA Transmit (TxD1) Clock (SPICLK) Receive (SPIRxD) Transmit (SPITxD) Slave Select (SPISEL) UART0 Receive (RxD0) UART0 Transmit (TxD0) Interrupt input (EXTINT0)/Timer gate control (TG0) Interrupt input (EXTINT1)/Timer gate control (TG1) Counter input (C0) Counter input (C1) serial data (I2CSDA) clock (I2CSCL) Program Counter Array0 PCA0-TCM0 Channel input (ADC0) Channel input (ADC1) Channel input (ADC2) Channel input (ADC3) Channel input (ADC4) Channel input (ADC5) Channel input (ADC6) Channel input (ADC7) Timer Count input (T2) 11/264 uPSD34xx DESCRIPTIONS Port P4.1 P4.2 P4.3 P4.4 P4.5 P4.6 P4.7 VREF PSEN RESET_IN XTAL1 XTAL2 DEBUG JTAGTMS JTAGTCK Signal Name TCM1 RXD1 TCM2 TXD1 PCACLK0 SPICLK TCM3 SPIRXD TCM4 SPITXD SPISEL PCACLK1 80-Pin 52-Pin In/Out No.(1) Function Alternate PCA0-TCM1 PCA0-TCM2 PCACLK0 Program Counter Array1 PCA1-TCM3 PCA1-TCM4 PCA1-TCM5 PCACLK1 Basic General port General port General port General port General port General port General port Reference Voltage input READ Signal, external WRITE Signal, external PSEN Signal, external Address Latch signal, external Active reset input Oscillator input system clock Oscillator output system clock Debug Unit General port General port General port General port General port General port General port General port General port General port General port General port General port General port General port General port JTAG (TMS) JTAG (TCK) Alternate Timer Trigger input (T2X) UART1 IrDA Receive (RxD1) UART1 IrDA Transmit (TxD1) Clock (SPICLK) Receive (SPIRxD) Transmit (SPITxD) Slave Select (SPISEL) Port pins support: Macro-cell outputs, inputs, Latched Address (A0-A7), Peripheral Mode Port pins support: Macro-cell outputs, inputs, Latched Address (A0-A7) 12/264 uPSD34xx DESCRIPTIONS Port JTAGTDI JTAGTDO CLKIN Signal Name VSTBY TSTAT TERR 80-Pin 52-Pin In/Out No.(1) Function Alternate SRAM Standby voltage input (VSTBY) Optional JTAG Status (TSTAT) Optional JTAG Status (TERR) Basic General port General port General port JTAG (TDI) JTAG (TDO) General port General port Alternate Macrocell output, input PLD, Macrocell output, input PLD, Macrocell output, input General port pin; 1.5k pull-up resistor required. Module Analog Input Module 3.3V Module 3.3V PLD, Macrocell output, input Clock input Chip select Module USB+ USB- 3.3V-VCC AVCC 3.3V 3.3V Note: Signal Available 52-pin package. 13/264 uPSD34xx HARDWARE DESCRIPTION HARDWARE DESCRIPTION uPSD34xx modular architecture built from stacked process. There die, designated "MCU Module" this document, other designated "PSD Module" (see Figure page 15). cases, Module operates 3.3V with tolerant I/O. Module either 3.3V die, depending uPSD34xx device described below. Module consists fast 8032 core, that operates with clocks instruction cycle, many peripheral system supervisor functions. Module provides 8032 with multiple memories (two Flash SRAM) program data, programmable logic address decoding general-purpose logic, additional I/O. Module communicates with Module through internal address data busses (AD0 AD15) control signals (RD, PSEN, ALE, RESET). There slightly different characteristics each module. I/Os module designated Ports I/Os Module designated Ports uPSD34xx devices, 3.3V Module stacked with Module. this case, uPSD34xx device must supplied with 3.3VCC Module 5.0VDD Module. Ports Module 3.3V ports with tolerance devices (they directly driven external devices they directly drive external devices while producing 2.4V max). Ports Module true ports. 3.3V uPSD34xxV devices, 3.3V Module stacked with 3.3V Module. this case, 3.3V uPSD34xx device needs supplied with single 3.3V voltage source both VDD. pins Ports tolerant connected external peripherals devices desired. Ports Module 3.3V ports, which tolerant external devices. Refer Table port type voltage source requirements. 80-pin uPSD34xx devices provide access 8032 address, data, control signals external pins connect external peripheral memory devices. 52-pin uPSD34xx devices provide access 8032 system bus. non-volatile memory configuration portions uPSD34xx device programmed through JTAG interface special programming voltage needed. This same JTAG port also used debugging 8032 core runtime providing breakpoint, single-step, display, trace features. non-volatile security programmed block access JTAG interface security. security defeated only erasing entire device, leaving device blank ready again. Table Port Type Voltage Source Combinations Device Type uPSD34xx 3.3V: uPSD34xxV Module 3.3V 3.3V Module 5.0V 3.3V Ports Module 3.3V (Ports tolerant) 3.3V (Ports tolerant) Ports Module 3.3V. tolerant 14/264 uPSD34xx HARDWARE DESCRIPTION Figure Functional Modules Port UART0, Intr, Timers Port imer, ADC, Port PCA, PWM, UART1 Port pins Module Port Port urbo 8032 Core Dual UARTs Interrupt imer Counters Byte SRAM Clock Unit 10-bit Counters Unit Transceiver Pins 3.3V Dedicated Memory Interface Prefetch, Branch Cache 8-Bit/16-Bit Die-to-Die Enhanced Interface Page Register 8032 Internal Ext. Reset Input DEBUG Internal Reset Reset Logic Reset Main Flash Decode Secondary Flash Reset SRAM Module Internal CPLD MACROCELLS Pins 3.3V uPSD34xx Port JTAG GPIO Port A,B,C GPIO Port GPIO AI10409 15/264 uPSD34xx MEMORY ORGANIZATION MEMORY ORGANIZATION 8032 core views memory module "internal" memory views memory module "external" memory, Figure Internal memory Module consists DATA, IDATA, SFRs. These standard 8032 memories reside bytes SRAM located fixed address space starting address 0x0000. External memory Module consists four types: main Flash (64K, 128K, 256K bytes), smaller secondary Flash (32K), SRAM (4K, 32Kbytes), block Module control registers called csiop (256 bytes). These external memories reside programmable address ranges, specified using software tool PSDsoft Express. Module section this document more details these memories. External memory accessed 8032 separate byte address spaces. address space program memory other adFigure uPSD34xx Memories Internal SRAM Module External Memory Module dress space data memory. Program memory accessed using 8032 signal, PSEN. Data memory accessed using 8032 signals, 8032 needs access more than bytes external program data memory, must paging banking) techniques provided Page Register Module. Note: When referencing program data memory spaces, nothing with 8032 internal SRAM areas DATA, IDATA, Module. Program data memory spaces only relate external memories Module. External memory Module overlap internal SRAM memory Module same physical address range (starting 0x0000) without interference because 8032 core does assert signals when accessing internal SRAM. Fixed Addresses Indirect Addressing Main Flash Bytes SRAM Bytes External memories placed virtually address using software tool PSDsoft Express. SRAM Flash memories placed 8032 Program Space Data Space using PSDsoft Express. memory 8032 Data Space XDATA. IDATA Bytes Direct Addressing Bytes 64KB 128KB 256KB Secondary Flash SRAM 32KB AI10410b DATA Direct Indirect Addressing 32KB 16/264 uPSD34xx MEMORY ORGANIZATION Internal Memory (MCU Module, Standard 8032 Memory: DATA, IDATA, SFR) DATA Memory. first bytes internal SRAM ranging from address 0x0000 0x007F called DATA, which accessed using 8032 direct indirect addressing schemes typically used store variables stack. Four register banks, each with registers R7), occupy addresses 0x0000 0x001F. Only these four banks enabled time. next locations 0x0020 0x002F contain directly addressable locations that used software flags. SRAM locations 0x0030 above used variables stack. IDATA Memory. next bytes internal SRAM named IDATA range from address 0x0080 0x00FF. IDATA accessed only through 8032 indirect addressing typically used hold stack well data variables. stack reside both DATA IDATA memories reach size limited only available space combined bytes these memories (since stack accesses always done using indirect addressing, boundary between DATA IDATA does exist with regard stack). Memory. Special Function Registers (Table page occupy separate physical memory, they logically overlap same bytes IDATA, ranging from address 0x0080 0x00FF. SFRs accessed only using direct addressing. There active registers used many functions: changing operating mode 8032 core, controlling 8032 peripherals, controlling I/O, managing interrupt functions. remaining unused SFRs reserved should accessed. SFRs both byte- bit-addressable. Bit-addressable SFRs those whose address ends hex. External Memory (PSD Module: Program memory, Data memory) Module four memories: main Flash, secondary Flash, SRAM, csiop. MODULE section more detailed information these memories. Memory mapping Module implemented with Decode (DPLD) optionally Page Register. user specifies decode equations individual segments each memories using software tool PSDsoft Express. This very easy point-and-click process allowing total flexibility mapping memories. Additionally, each memories placed various combinations 8032 program address space 8032 data address space using software tool PSDsoft Express. Program Memory. External program memory addressed 8032 using 16-bit Program Counter (PC) accessed with 8032 signal, PSEN. Program memory present address program space between 0x0000 0xFFFF. After power-up reset, 8032 begins program execution from location 0x0000 where reset vector stored, causing jump initialization routine firmware. address 0x0003, just following reset vector interrupt service locations. Each interrupt assigned fixed interrupt service location program memory. interrupt causes 8032 jump that service location, where commences execution service routine. External Interrupt (EXINT0), example, assigned service location 0x0003. EXINT0 going used, service routine must begin location 0x0003. Interrupt service locations spaced 8-byte intervals: 0x0003 EXINT0, 0x000B Timer 0x0013 EXINT1, forth. interrupt service routine short enough, reside entirely within 8-byte interval. Longer service routines jump instruction somewhere else program memory. Data Memory. External data referred XDATA addressed 8032 using Indirect Addressing 16-bit Data Pointer Register (DPTR) accessed 8032 signals, XDATA present address data space between 0x0000 0xFFFF. Note: uPSD34xx dual data pointers (source destination) making XDATA transfers much more efficient. Memory Placement. Module architecture allows placement external memories into different combinations program memory data memory spaces. This means main Flash, secondary Flash, SRAM viewed 8032 various combinations program memory data memory defined PSDsoft Express. example this flexibility, applications that require great deal Flash memory data space (large lookup tables extended data recording), larger main Flash memory placed data space smaller secondary Flash memory placed program space. opposite realized different application more Flash memory needed code less Flash memory data. 17/264 uPSD34xx 8032 CORE PERFORMANCE ENHANCEMENTS default, SRAM csiop memories Module must always reside data memory space they treated 8032 XDATA. main Flash secondary Flash memories reside program space, data space, both. These memory placement choices specified PSDsoft Express programmed into non-volatile sections uPSD34xx, active power-up after reset. possible override these initial settings during runtime In-Application Programming (IAP). Standard 8032 architecture cannot write program memory space prevent accidental corruption firmware. However, this becomes obstacle typical 8032 systems when remote update firmware Flash memory required using IAP. module provides solution remote updates allowing 8032 firmware temporarily "reclassify" Flash memory reside data space during remote update, then returning Flash memory back program space when finished. Register (Table 104., page 174) Module section this document more details. 8032 CORE PERFORMANCE ENHANCEMENTS Before describing performance features uPSD34xx, first look standard 8032 architecture. clock source 8032 creates basic unit timing called machine-cycle, which period clocks standard 8032 MCUs. instruction traditional 8032 MCUs consists byte instructions that execute different combinations machine-cycles. example, there one-byte instructions that execute machine-cycle clocks), one-byte instructions that execute four machine-cycles clocks), two-byte, two-cycle instructions clocks), addition, standard 8032 architecture will fetch bytes from program memory almost every machinecycle, regardless needs them (dummy fetch). This means one-byte, one-cycle instructions, second byte ignored. These one-byte, one-cycle instructions account half 8032's instructions (126 opcodes). There inefficiencies wasted cycles idle times that eliminated. uPSD34xx 8032 core offers increased performance number ways, while keeping exact same instruction standard 8032 (all opcodes, number bytes instruction, native number machine-cycles instruction identical original 8032). first performance boosted reducing machine-cycle period just clocks compared clocks standard 8032. This shortened machine-cycle improves instruction rate one- two-byte, one-cycle instructions factor three (Figure page compared standard 8051 architectures, significantly improves performance multiple-cycle instruction types. example Figure shows continuous execution stream one- two-byte, one-cycle instructions. uPSD34xx will yield MIPS peak performance this case while operating 40MHz clock rate. typical application however, effective performance will lower since programs only one-cycle instructions, special techniques implemented uPSD34xx keep effective MIPS rate close possible peak MIPS rate times. This accomplished with instruction Pre-Fetch Queue (PFQ), Branch Cache (BC), 16-bit program memory shown Figure page 18/264 uPSD34xx 8032 CORE PERFORMANCE ENHANCEMENTS Figure Comparison uPSD34xx with Standard 8032 Performance 2-byte, 1-cycle Instructions Instruction Turbo uPSD34xx Execute Instruction Pre-Fetch Next Instruction Instruction Execute Instruction Pre-Fetch Next Instruction Instruction Execute Instruction Pre-Fetch Next Instruction clocks (one machine cycle) machine cycle machine cycle Clock clocks (one machine cycle) Instruction Standard 8032 Fetch Byte Instruction Execute Instruction Fetch Second Dummy Byte Dummy Byte Ignored (wasted access) Turbo uPSD34xx executes instructions same amount time that standard 8032 executes only Instruction AI10411 Figure Instruction Pre-Fetch Queue Branch Cache Branch Code Branch Cache (BC) Branch Code Compare Branch Branch Code Code Branch Branch Code Code Branch Code Branch Code Load Branch Address Match Instruction Byte 16-bit Program Memory Module Current Branch Address Instruction Byte Instruction Byte Address Bytes Instruction Wait 8032 Address Wait Instruction Pre-Fetch Queue (PFQ) AI10431 19/264 uPSD34xx 8032 CORE PERFORMANCE ENHANCEMENTS Pre-Fetch Queue (PFQ) Branch Cache (BC) always working minimize idle time inherent 8032 architecture, eliminate wasted memory fetches, maximize memory bandwidth MCU. does this running asynchronously relation MCU, looking ahead pre-fetch bytes (word) code from program memory during idle periods. Only necessary word will fetched dummy fetches like standard 8032). will queue four code bytes advance execution, which significantly optimizes sequential program performance. However, when program execution becomes non-sequential (program branch), typical pre-fetch queue will empty itself reload code, causing stall. Turbo uPSD34xx diminishes this problem using Branch Cache with PFQ. four-way, fully associative cache, meaning that when program branch occurs, branch destination address compared simultaneously with four recent previous branch destinations stored Each four cache entries contain four bytes code related branch. there match), then four code bytes matching program branch transferred immediately simultaneously from PFQ, execution that branch continues with minimal delay. This greatly reduces chance that will stall from empty PFQ, improves performance embedded control systems where quite common branch loop relatively small code localities. default, enabled after power-up reset. 8032 disable runtime desired writing specific (BUSCON). memory module operates with variable wait states depending value specified named BUSCON. example, uPSD34xx device operating 40MHz crystal frequency requires four memory wait states (equal four clocks). this example, once word code, wait states become transparent full MIPS achieved when program stream consists sequential one- two-byte, machine-cycle instructions shown Figure page (transparent because machine-cycle four clocks which equals memory pre-fetch wait time that also four clocks). also important understand operation multi-cycle instructions. Example, Multi-cycle Instructions look string two-byte, two-cycle instructions Figure page There three instructions executed sequentially this example, instructions Each time divisions figure machine-cycle four clocks, there phases reference this discussion. Each instruction pre-fetched into advance execution MCU. Prior Phase pre-fetched instruction bytes Instruction During Phase one, both bytes loaded into execution unit. Also Phase prefetching Instruction (bytes from program memory. Phase processing Instruction internally while pre-fetching Instruction Phase both bytes instruction loaded into execution unit begins pre-fetch bytes next instruction. Phase Instruction processed. uPSD34xx instructions exact scale standard 8032 instructions with regard number cycles instruction. Figure 10., page shows equivalent instruction sequence from example above standard 8032 comparison. Aggregate Performance stream two-byte, two-cycle instructions Figure page running 40MHz, uPSD34xx will yield MIPs. stream one- two-byte, one-cycle instructions Figure page same yield MIPs. Effective performance will depend number things: clock frequency; mixture instructions types (bytes cycles) application; amount time empty stalls (mix instruction types misses Branch Cache); operating voltage. uPSD34xx device operates with four memory wait states, 3.3V device operates with five memory wait states yielding MIPS peak compared MIPs peak device. same number wait states will apply both program fetches data READ/WRITEs unless otherwise specified named BUSCON. general, aggregate performance increase expected over standard 8032 application running same clock frequency. 20/264 uPSD34xx 8032 CORE PERFORMANCE ENHANCEMENTS Figure Operation Multi-cycle Instructions Three 2-byte, 2-cycle Instructions uPSD34xx Pre-Fetch Inst Pre-Fetch Inst Pre-Fetch next Inst Inst Byte Inst Byte Inst Byte Next Inst Continue Pre-Fetch 4-clock Macine Cycle Phase Phase Process Phase Phase Process Phase Phase Process Next Inst Execution Previous Instruction Instruction Instruction Instruction AI10432 Figure uPSD34xx Multi-cycle Instructions Compared Standard 8032 Three 2-byte, 2-cycle Instructions, uPSD34xx Standard 8032 Clocks Total clocks cycle) uPSD34xx Inst Inst Inst Cycle Clocks clocks cycle) 8032 Byte Byte Process Inst Cycle AI10412 Byte Byte Process Inst Byte Byte Process Inst 21/264 uPSD34xx MODULE DISCRIPTION MODULE DISCRIPTION This section provides detail description Module system functions peripherals, including: 8032 Registers Special Function Registers 8032 Addressing Modes uPSD34xx Instruction Summary Dual Data Pointers Debug Unit Interrupt System Clock Generation Power Saving Modes Oscillator External Components Ports Interface Supervisory Functions Standard 8032 Timer/Counters Serial UART Interfaces IrDA Interface Interface Interface Analog Digital Converter Programmable Counter Array (PCA) Interface Note: full description 8032 instruction found uPSD34xx Programmers Guide. 8032 REGISTERS uPSD34xx following 8032 core registers, also shown Figure Figure 8032 Registers R0-R7 DPTR(DPH) AI06636 Accumulator Register Stack Pointer Program Counter Program Status Word General Purpose Register (Bank0-3) Data Pointer Register DPTR(DPL) Stack Pointer (SP) 8-bit register which holds current location stack. incremented before value pushed onto stack, decremented after value popped stack. initialized after reset. This causes stack begin location (top stack). avoid overlapping conflicts, user must initialize stack four banks registers used, well stack 8032 memory locations used. Data Pointer (DPTR) DPTR 16-bit register consisting 8-bit registers, DPH. DPTR Register used base register create address indirect jumps, table look-up operations, external data transfers (XDATA). When used addressing, DPTR Register used general purpose 16-bit data register. Very frequently, DPTR Register used access XDATA using External Direct addressing mode. uPSD34xx special registers (DPTC, DPTM) control secondary DPTR Register speed memory-to-memory XDATA transfers. Having dual DPTR Registers allows rapid switching between source destination addresses (see details DUAL DATA POINTERS, page 38). Program Counter (PC) 16-bit register consisting 8-bit registers, PCH. This counter indicates address next instruction program memory fetched executed. reset forces location 0000h, which where reset jump vector stored. Accumulator (ACC) This 8-bit general purpose register which holds source operand receives result arithmetic operations. Register also source destination logic data movement operations. instructions, combined with Register hold 16-bit operands. referred instruction set. Register Register general purpose 8-bit register temporary data storage also used 16bit register when concatenated with Register with instructions. 22/264 uPSD34xx 8032 REGISTERS General Purpose Registers There four banks eight general purpose 8bit registers R7), only bank eight registers active given time depending setting word (described next). generally used assist manipulating values moving data from memory location another. These register banks physically reside first locations 8032 internal DATA SRAM, starting address 00h. reset, only first bank eight registers active (addresses 07h), stack begins address 08h. Program Status Word (PSW) 8-bit register which stores several important bits, flags, that cleared many 8032 instructions, reflecting current state core. Figure 12., page shows individual flags. Carry Flag (CY). This flag when last arithmetic operation that executed results carry (addition) borrow (subtraction). cleared other arithmetic operations. flag also affected Shift Rotate Instructions. Auxiliary Carry Flag (AC). This flag when last arithmetic operation that executed results carry into (addition) borrow from (subtraction) high-order nibble. cleared other arithmetic operations. Figure Program Status Word (PSW) Register Carry Flag Auxillary Carry Flag General Purpose Flag Register Bank Select Flags select Bank0-3) AI06639 General Purpose Flag (F0). This bit-addressable, general-purpose flag under software control. Register Bank Select Flags (RS1, RS0). These bits select which bank eight registers used during register accesses (see Table Overflow Flag (OV). flag when: ADD, ADDC, SUBB instruction causes sign change; instruction results overflow (result greater than 255); instruction causes divide-by-zero condition. flag cleared ADD, ADDC, SUBB, MUL, instructions other cases. CLRV instruction will clear flag time. Parity Flag (P). flag eight bits Accumulator odd, cleared even. Table .Register Bank Select Addresses Register Bank 8032 Internal DATA Address Reset Value Parity Flag assigned Overflow Flag 23/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) SPECIAL FUNCTION REGISTERS (SFR) group registers designated Special Function Register (SFR) shown Table page SFRs control operating modes core also control peripheral interfaces pins Module. SFRs accessed only using Direct Addressing method within address range from internal 8032 SRAM. Sixteen addresses address space both byte- bit-addressable. bit-addressable SFRs noted Table possible addresses occupied. remaining unoccupied addresses (designated "RESERVED" Table should written. Reading unoccupied locations will return undefined value. Note: There separate control registers Module, designated csiop, they described MODULE, page 164. pins, PLD, other functions Module controlled SFRs. SFRs categorized follows: core registers: PSW, DPTL, DPTH, DPTC, Module Port registers: P1SFS0, P1SFS1, P3SFS, P4SFS0, P4SFS1 Standard 8032 Timer registers TCON, TMOD, T2CON, TH0, TH1, TH2, TL0, TL1, TL2, RCAP2L, RCAP2H Standard Serial Interfaces (UART) SCON0, SBUF0, SCON1, SBUF1 Power, clock, timing registers PCON, CCON0, CCON1, BUSCON Hardware watchdog timer registers WDKEY, WDRST Interrupt system registers IPA, Prog. Counter Array (PCA) control registers PCACL0, PCACH0, PCACON0, PCASTA, PCACL1, PCACH1, PCACON1, CCON2, CCON3 capture/compare registers CAPCOML0, CAPCOMH0, TCMMODE0, CAPCOML1, CAPCOMH1, TCMMODE2, CAPCOML2, CAPCOMH2, TCMMODE2, CAPCOML3, CAPCOMH3, TCMMODE3, CAPCOML4, CAPCOMH4, TCMMODE4, CAPCOML5, CAPCOMH5, TCMMODE5, PWMF0, PMWF1 interface registers SPICLKD, SPISTAT, SPITDR, SPIRDR, SPICON0, SPICON1 interface registers S1SETUP, S1CON, S1STA, S1DAT, S1ADR Analog Digital Converter registers ACON, ADCPS, ADAT0, ADAT1 IrDA interface register IRDACON interface registers UADDR, UPAIR, WE0-3, UIF0-3, UCTL, USTA, USEL, UCON, USIZE, UBASEH, UBASEL, USCI, USCV 24/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Table Memory with Direct Address Reset Value Addr (hex) Name Name <Bit Address> Reg. Reset Value Descr. (hex) with Link RESERVED Stack Pointer (SP), page Data Pointer (DPTR), SP[7:0] DPL[7:0] DPH[7:0] RESERVED DPTC DPSEL[2:0] Table 13., page Table 14., page Table 26., page Table 41., page Table 42., page Standard Timer SFRs, Table 31., page Table 32., page Table 27., page Table 30., page Table 34., page Table 35., page DP MD1[1:0] MD0[1:0] PCON SMOD0 SMOD1 RCLK1 TCLK1 IDLE 88(1) TCON <8Fh> <8Eh> <8Dh> <8Ch> <8Bh> <8Ah> <89h> <88h> TMOD P1SFS0 GATE GATE TL0[7:0] TL1[7:0] TH0[7:0] TH1[7:0] P1SFS0[7:0] P1SFS1 P1SFS1[7:0] 90(1) P1.7 <97h> P1.6 <96h> P1.5 <95h> P1.4 <94h> P1.3 <93h> P1.2 <92h> P1.1 <91h> P1.0 <90h> P3SFS P3SFS[7:0] P4SFS0 P4SFS0[7:0] P4SFS1 P4SFS1[7:0] 25/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Addr (hex) Name Name <Bit Address> ADCCE ADCPS[2:0] Reset Reg. Value Descr. (hex) with Link Table 90., page Table 91., page Table 92., page Table 89., page Table 47., page Figure 28., page ADCPS ADAT0 ADATA[7:0] ADAT1 ADATA[9:8] ACON AINTF AINTEN ADEN ADS[2:0] ADST ADSF 98(1) SCON0 <9Fh> <9Eh> <9Dh> <9Ch> <9Bh> <9Ah> <99h> <9h8> SBUF0 SBUF0[7:0] RESERVED RESERVED RESERVED BUSCON EPFQ WRW1 WRW0 RDW1 RDW0 Table 37., page RESERVED RESERVED RESERVED RESERVED PCACL0 PCACL0[7:0] Table 93., page Table 93., page Table 96., page Table 98., page Table 40., page Table 18., page PCACH0 PCACH0[7:0] PCACON0 EN_ALL EN_PCA EOVF1 PCA_IDL CLK_SEL[1:0] PCASTA OVF1 INTF5 INTF4 INTF3 OVF0 INTF2 INTF1 INTF0 WDRST WDRST[7:0] EADC ESPI EPCA EI2C 26/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Addr (hex) A8(1) Name Name <Bit Address> <AFh> <ADh> <ACh> <ABh> <AAh> <A9h> <A8h> Reset Reg. Value Descr. (hex) with Link Table 17., page TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE CAPCOML CAPCOMH WDKEY CAPCOML0[7:0] CAPCOMH0[7:0] PWM[1:0] PWM[1:0] PWM[1:0] Table 93., page Table 39., page Table 93., page Table 28., page Table 99., page WDKEY[7:0] CAPCOML P3.7 <B7h> P3.6 <B6h> P3.5 <B5h> CAPCOML1[7:0] B0(1) CAPCOMH CAPCOML CAPCOMH PWMF0 P3.4 <B4h> P3.3 <B3h> P3.2 <B2h> P3.1 <B1h> P3.0 <B0h> CAPCOMH1[7:0] CAPCOML2[7:0] CAPCOMH2[7:0] PWMF0[7:0] RESERVED RESERVED Table 93., page PADC PSPI PPCA PI2C Table 20., page Table 19., page B8(1) <BDh> <BCh> <BBh> <BAh> <B9h> <B8h> RESERVED PCACL1 PCACH1 PCACON1 EN_PCA EOVF1 PCACL1[7:0] PCACH1[7:0] PCA_IDL CLK_SEL[1:0] Table 93., page Table 97., page 27/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Addr (hex) Name Name <Bit Address> Reg. Reset Value Descr. (hex) with Link Table 29., page Table 99., page TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE TCMMODE EINTF E_COMP CAP_PE CAP_NE MATCH TOGGLE CAPCOML CAPCOMH CAPCOML CAPCOMH CAPCOML CAPCOMH PWMF1 T2CON <CFh> EXF2 <CEh> RCLK <CDh> P4.7 <C7h> P4.6 <C6h> P4.5 <C5h> P4.4 <C4h> P4.3 <C3h> P4.2 <C2h> PWM[1:0] PWM[1:0] PWM[1:0] P4.1 <C1h> P4.0 <C0h> C0(1) C8(1) CAPCOML3[7:0] CAPCOMH3[7:0] CAPCOML4[7:0] CAPCOMH4[7:0] CAPCOML5[7:0] CAPCOMH5[7:0] PWMF1[7:0] TCLK <CCh> EXEN2 <CBh> <CAh> C/T2 <C9h> <C8h> Table 43., page Table 93., page RESERVED RCAP2L RCAP2H IRDACON IRDA_EN BIT_PULS RCAP2L[7:0] RCAP2H[7:0] TL2[7:0] TH2[7:0] CDIV4 CDIV3 CDIV2 CDIV1 CDIV0 Table 50., page Program Status Word (PSW), Standard Timer SFRs, D0(1) <D7h> <D6h> <D5h> RS[1:0] <D4h, D3h> <D2h> <D0> SPICLKD RESERVED SPICLKD[5:0] Table 65., page Table 66., page SPISTAT BUSY TEISF RORISF TISF RISF 28/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Addr (hex) Name SPITDR SPIRDR SPICON0 Name <Bit Address> Reg. Reset Value Descr. (hex) with Link FLSB Table 64., page Table 63., page Table 64., page Table 48., page Figure 28., page SPITDR[7:0] SPIRDR[7:0] SPIEN SSEL SPICON1 TEIE RORIE D8(1) SCON1 <DE> <DD> <DC> <DB> <DA> <D9> <D8> SBUF1 SBUF1[7:0] RESERVED S1SETUP SS_EN SMPL_SET[6:0] Table 59., page Table 54., page Table 56., page Table 57., page Table 58., page Accumulat (ACC), S1CON ADDR S1STA STOP INTR TX_MD B_BUSY B_LOST ACK_R S1DAT S1DAT[7:0] S1ADR S1ADR[7:0] E0(1) A[7:0] <bit addresses: E7h, E6h, E5h, E4h, E3h, E2h, E1h, E0h> RESERVED UADDR UPAIR UIE0 UIE1 UIE2 UIE3 UIF0 OUTF USBADDR[6:0] IN4IE PR3OUT PR1OUT RSTIE IN3IE PR3IN PR1IN UMIE IN0IE OUT0I NAK0I RESU SUSPND EOPIE IN2IE IN1IE OUT4IE OUT3IE OUT2IE OUT1IE NAK4IE NAK3IE NAK2IE NAKF RSTF SUSPND NAK1IE EOPF 29/264 uPSD34xx SPECIAL FUNCTION REGISTERS (SFR) Addr (hex) F0(1) CCON0 CCON1 CCON2 PLLM[4] PLLEN UPLLCE USEL UCON USIZE UBASEH UBASEL USCI USCV BASEADDR[7:6] Name UIF1 UIF2 UIF3 UCTL USTA Name <Bit Address> IN4F OUT4F NAK4F RESERVED EP[2:0] USCI[2:0] Register (B), page IN3F OUT3F NAK3F RCVT IN2F OUT2F NAK2F IN1F IN0F Reset Reg. Value Descr. (hex) with Link OUT1F OUT0F NAK1F NAK0F WAKE USBEN VISIBLE SETUP B[7:0] <bit addresses: F7h, F6h, F5h, F4h, F3h, F2h, F1h, F0h> ENABLE SIZE[6:0] BASEADDR[15:8] USCV[7:0] RESERVED RESERVED DBGCE CPU_ CPUPS[2:0] PLLD[3:0] PCA0CE PCA0PS[3:0] STALL TOGGLE Table 22., page PLLM[3:0] Table 94., page Table 95., page CCON3 PCA1CE RESERVED RESERVED RESERVED RESERVED RESERVED PCA1PS[3:0] Note: This addressed individual bits (Bit Address mode) addressed entire byte (Direct Address mode). 30/264 uPSD34xx 8032 ADDRESSING MODES 8032 ADDRESSING MODES 8032 uses different addressing modes listed below: Register Direct Register Indirect Immediate External Direct External Indirect Indexed Relative Absolute Long Register Addressing This mode uses contents registers (selected last three bits instruction opcode) operand source destination. This mode very efficient since additional instruction byte needed identify operand. example: Move contents accumulator Immediate Addressing This mode uses 8-bits data constant) contained second byte instruction, stores into memory location register indicated first byte instruction. Thus, data immediately available within instruction. This mode commonly used initialize registers SFRs perform mask operations. There also 16-bit version this mode loading DPTR Register. this case, bytes following instruction byte contain 16-bit value. example: Move constant, 40h, into accumulator DPTR, 1234# Move constant, 1234h, into DPTR Direct Addressing This mode uses 8-bit address, which contained second byte instruction, directly address operand which resides either 8032 DATA SRAM (internal address range 00h07Fh) resides 8032 (internal address range 80h-FFh). This mode quite fast since range limit bytes internal 8032 SRAM. example: Move contents DATA SRAM location into accumulator External Direct Addressing This mode will access external memory (XDATA) using 16-bit address stored DPTR Register. There only instructions using this mode both accumulator either receive byte from external memory addressed DPTR send byte from accumulator address DPTR. uPSD34xx special feature alternate contents (source destination) DPTR rapidly implement very efficient memory-to-memory transfers. example: MOVX @DPTR Move contents accumulator XDATA address contained DPTR MOVX @DPTR, Move XDATA accumulator Note: details POINTERS, page DUAL DATA Register Indirect Addressing This mode uses 8-bit address contained either Register indirectly address operand which resides 8032 IDATA SRAM (internal address range 80h-FFh). Although 8032 registers also occupy same physical address range IDATA, SFRs will accessed Register Indirect mode. SFRs only accesses using Direct address mode. example: Move into accumulator contents IDATA SRAM that pointed address contained External Indirect Addressing This mode will access external memory (XDATA) using 8-bit address stored either Register This fastest access XDATA (least cycles), because only 8-bits available address, this mode limits XDATA size only bytes (the traditional Port 8032 available uPSD34xx, possible write upper address byte). This mode supported uPSD34xx. example: MOVX @R0,A Move into accumulator XDATA that pointed address contained 31/264 uPSD34xx 8032 ADDRESSING MODES Indexed Addressing This mode used MOVC instruction which allows 8032 read constant from program memory (not data memory). MOVC often used read look-up tables that embedded program memory. final address produced this mode result adding either 16-bit DPTR value contents accumulator. value accumulator referred index. data fetched from final location program memory stored into accumulator, overwriting index value that previously stored there. example: MOVC @A+DPTR; Move code byte relative DPTR into accumulator MOVC @A+PC Move code byte relative into accumulator Absolute Addressing This mode will append high-order bits address next instruction low-order bits ACALL AJUMP instruction produce 16-bit jump address. jump will within same byte page program memory first byte following instruction. example: AJMP 0500h next instruction located address 4000h, resulting jump will made 4500h. Long Addressing This mode will 16-bits contained bytes following instruction byte jump destination address LCALL LJMP instructions. example: LJMP 0500h Unconditionally jump address 0500h program memory Relative Addressing This mode will two's-compliment number stored second byte instruction program counter short jumps within +128 addresses relative program counter. This commonly used looping very efficient since additional cycle needed fetch jump destination address. example: SJMP Jump bytes ahead program memory) address which SJMP instruction stored. SJMP 1000h, program execution jumps 1034h. Addressing This mode allows setting clearing individual without disturbing other bits within 8-bit value internal SRAM. Addressing only available certain locations 8032 DATA memory. Valid locations DATA addresses addresses whose base address ends with (Example: SFR, base address A8h, each eight bits addressed individually address A8h, A9h, AFh.) example: SETB individual (Enable Interrupts) inside Register, 32/264 uPSD34xx uPSD34xx INSTRUCTION SUMMARY uPSD34xx INSTRUCTION SUMMARY Tables through list instructions supported uPSD34xx, including number bytes number machine cycles required implement each instruction. This standard 8051 instruction set. meaning "machine cycles" many 8032 core machine cycles required execute instruction. "native" duration machine cycles memory wait state settings SFR, BUSCON, clock divider selections SFR, CCON0 (i.e. machine cycle typically clocks uPSD34xx). However, individual machine cycle grow duration when either things happen: Table Arithmetic Instruction Mnemonic(1) ADDC ADDC ADDC ADDC SUBB SUBB SUBB SUBB Direct #data direct #data direct #data direct direct DPTR register direct byte indirect SRAM immediate data register with carry direct byte with carry indirect SRAM with carry immediate data with carry Subtract register from with borrow Subtract direct byte from with borrow Subtract indirect SRAM from with borrow Subtract immediate data from with borrow Increment Increment register Increment direct byte Increment indirect SRAM Decrement Decrement register Decrement direct byte Decrement indirect SRAM Increment Data Pointer Multiply Divide Decimal adjust Description Length/Cycles byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/4 cycle byte/4 cycle byte/1 cycle stall imposed while loading 8032 PreFetch Queue (PFQ); occurrence cache miss Branch Cache (BC) during branch program execution flow. 8032 CORE PERFORMANCE ENHANCEMENTS, page more details. generally speaking, during typical program execution, empty misses, producing very good performance without extending duration machine cycles. uPSD34xx Programmers Guide describes each instruction operation detail. Note: mnemonics copyrighted ©Intel Corporation 1980. 33/264 uPSD34xx uPSD34xx INSTRUCTION SUMMARY Table Logical Instruction Mnemonic(1) Description Logical Instructions SWAP direct #data direct, direct, #data direct #data direct, direct, #data direct #data direct, direct, #data register direct byte indirect SRAM immediate data direct byte immediate data direct byte register direct byte indirect SRAM immediate data direct byte immediate data direct byte Swap nibbles within Exclusive-OR register Exclusive-OR direct byte Exclusive-OR indirect SRAM Exclusive-OR immediate data Exclusive-OR direct byte Exclusive-OR immediate data direct byte Clear Compliment Rotate left Rotate left through carry Rotate right Rotate right through carry byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle Length/Cycles Note: mnemonics copyrighted ©Intel Corporation 1980. 34/264 uPSD34xx uPSD34xx INSTRUCTION SUMMARY Table Data Transfer Instruction Mnemonic(1) MOVC MOVC MOVX MOVX MOVX MOVX PUSH XCHD direct #data direct #data direct, direct, direct, direct direct, direct, #data @Ri, @Ri, direct @Ri, #data DPTR, #data16 @A+DPTR @A+PC @DPTR @Ri, @DPTR, direct direct direct Move register Move direct byte Move indirect SRAM Move immediate data Move register Move direct byte register Move immediate data register Move direct byte Move register direct byte Move direct byte direct Move indirect SRAM direct byte Move immediate data direct byte Move indirect SRAM Move direct byte indirect SRAM Move immediate data indirect SRAM Load Data Pointer with 16-bit constant Move code byte relative DPTR Move code byte relative Move XDATA (8-bit addr) Move XDATA (16-bit addr) Move XDATA (8-bit addr) Move XDATA (16-bit addr) Exchange register with Push direct byte onto stack direct byte from stack Exchange direct byte with Exchange indirect SRAM with Exchange low-order digit indirect SRAM with Description Length/Cycles byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/1 cycle byte/2 cycle byte/1 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/1 cycle byte/2 cycle byte/2 cycle byte/1 cycle byte/1 cycle byte/1 cycle Note: mnemonics copyrighted ©Intel Corporation 1980. 35/264 uPSD34xx uPSD34xx INSTRUCTION SUMMARY Table Boolean Variable Manipulation Instruction Mnemonic(1) SETB SETB /bit /bit bit, bit, Clear carry Clear direct carry direct Compliment carry Compliment direct direct carry compliment direct carry direct carry compliment direct carry Move direct carry Move carry direct Jump carry Jump carry Jump direct Jump direct Jump direct clear Description Length/Cycles byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/1 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/1 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle Note: mnemonics copyrighted ©Intel Corporation 1980. 36/264 uPSD34xx uPSD34xx INSTRUCTION SUMMARY Table Program Branching Instruction Mnemonic(1) Description Program Branching Instructions ACALL LCALL RETI AJMP LJMP SJMP CJNE CJNE CJNE CJNE DJNZ DJNZ addr11 addr16 @A+DPTR direct, #data, #data, @Ri, #data, direct, addr11 addr16 Absolute subroutine call Long subroutine call Return from subroutine Return from interrupt Absolute jump Long jump Short jump (relative addr) Jump indirect relative DPTR Jump zero Jump zero Compare direct byte ACC, jump equal Compare immediate ACC, jump equal Compare immediate register, jump equal Compare immediate indirect, jump equal Decrement register jump zero Decrement direct byte jump zero byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle byte/2 cycle Length/Cycles Note: mnemonics copyrighted ©Intel Corporation 1980. Table Miscellaneous Instruction Mnemonic(1) Description Miscellaneous Operation byte/1 cycle Length/Cycles Note: mnemonics copyrighted ©Intel Corporation 1980. Table Notes Instruction Addressing Modes direct #data #data16 addr16 addr11 Register currently selected register bank. 8-bit address internal 8032 DATA SRAM (locations 7Fh) registers (locations FFh). 8-bit internal 8032 SRAM (locations FFh) addressed indirectly through contents 8-bit constant included within instruction. 16-bit constant included within instruction. 16-bit destination address used LCALL LJMP. 11-bit destination address used ACALL AJMP. Signed (two-s compliment) 8-bit offset byte. Direct addressed internal 8032 DATA SRAM (locations 2Fh) registers (88h, 90h, 98h, A8h, B8h, C0h, C8h, D0h, D8h, E0h, F0h). 37/264 uPSD34xx DUAL DATA POINTERS DUAL DATA POINTERS XDATA accessed External Direct addressing mode, which uses 16-bit address stored DPTR Register. Traditional 8032 architecture only DPTR Register. This burden when transferring data between XDATA locations because requires heavy working registers manipulate source destination pointers. However, uPSD34xx data pointers, storing source address other storing destination address. These pointers configured automatically increment decrement after each data transfer, further reducing burden 8032 making this kind data movement very efficient. Data Pointer Control Register, DPTC (85h) default, DPTR Register uPSD34xx will behave different than standard 8032 MCU. DPSEL0 register DPTC shown Table selects which "background" data pointer registers (DPTR0 DPTR1) will function traditional DPTR Register given time. After reset, DPSEL0 cleared, enabling DPTR0 function DPTR, firmware access DPTR0 reading writing traditional DPTR Register addresses 83h. When DPSEL0 set, then DPTR1 Register functions DPTR, firmware access DPTR1 through registers 83h. pointer which selected DPSEL0 remains background accessible 8032. DPSEL0 never set, then uPSD34xx will behave like traditional 8032 having only DPTR Register. further speed XDATA XDATA transfers, bit, automatically toggle data pointers, DPTR0 DPTR1, each time standard DPTR Register accessed MOVX instruction. This eliminates need firmware manually manipulate DPSEL0 between each data transfer. Detailed description register DPTC shown Table Table DPTC: Data Pointer Control Register (SFR 85h, reset value 00h) Details Symbol DPSE0 Reserved Manually Select Data Pointer Auto Toggle between DPTR0 DPTR1 Reserved DPTR0 Selected DPTR DPTR1 Selected DPTR Definition DPSEL0 38/264 uPSD34xx DUAL DATA POINTERS Data Pointer Mode Register, DP(86h) "background" data pointers, DPTR0 DPTR1, configured automatically increment, decrement, stay same after MOVX instruction accesses DPTR Register. Only currently selected pointer will affected increment decrement. This feature controlled DPRegister defined Table automatic increment decrement function effective only MOVX instruction, MOVC other instruction that uses DTPR Register. Firmware Example. 8051 assembly code illustrated Table shows transfer block data bytes from XDATA address region another XDATA address region. Auto-address incrementing auto-pointer toggling will used. Table DPTM: Data Pointer Mode Register (SFR 86h, reset value 00h) Details Symbol DPTR1 Mode Bits MD[11:10] DPTR1 Change Reserved Auto Increment Auto Decrement DPTR0 Mode Bits MD[01:00] DPTR0 Change Reserved Auto Increment Auto Decrement Definition Reserved MD11 MD10 MD01 MD00 Table 8051 Assembly Code Example LOOP: MOVX(1) #COUNT DPTR, #SOURCE_ADDR 85h, #01h DPTR, #DEST_ADDR 85h, #40h 86h, #0Ah @DPTR initialize size data block transfer load XDATA source address base into DPTR0 load DPTC access DPTR1 pointer load XDATA destination address base into DPTR1 load DPTC access DPTR0 pointer auto toggle load DPto auto-increment both pointers load XDATA byte from source into ACC. after load completes, DPTR0 increments DPTR switches DPTR1 store XDATA byte from destination. after store completes, DPTR1 increments DPTR switches DPTR0 continue until done disable auto-increment disable auto-toggle, back single DPTR mode MOVX(1) @DPTR, DJNZ(1) LOOP 86h, 85h, Note: code loop where data transfer takes place only lines code. 39/264 uPSD34xx DEBUG UNIT DEBUG UNIT 8032 Module supports run-time debugging through JTAG interface. This same JTAG interface also used In-System Programming (ISP) physical connections described Module section, JTAG JTAG Debug, page 226. Debugging with serial interface such JTAG non-intrusive gain access internal state 8032 core various memories. traditional external hardware emulator cannot completely effective uPSD34xx because Pre-Fetch Queue Branch Cache. nature hide visibility actual program flow through traditional external connections, thus requiring on-chip serial debugging instead. Debugging supported Windows based software tools used 8051 code development from party vendors listed www.st.com/psm. Debug capabilities include: Halt Start execution Reset Single Step Match Breakpoints Range Breakpoint (inside outside range) Program Tracing Read Modify core registers, DATA, IDATA, SFR, XDATA, Code External Debug Event Pin, Input Output Some points regarding JTAG Debugger. JTAG Debugger access registers, data memory, code memory while executing full speed cycle-stealing. This means "watch windows" displayed periodically updated during full speed operation. Registers data content also modified during full speed operation. There on-chip storage Program Trace data, instead this data scanned from uPSD34xx through JTAG channel runtime host proccessing. such, full speed program tracing possible only when 8032 operating below approximately MIPS performance. Above MIPS, program will real-time while tracing. MIPS performance determined combination choice clock frequency, settings registers BUSCON CCON0. Breakpoints optionally halt MCU, and/ assert external Debug Event pin. Breakpoint definitions qualified with read write operations, also qualified with address code, SFR, DATA, IDATA, XDATA memories. Three breakpoints will compare address, fourth breakpoint compare address also data content. Additionally, fouth breakpoint logically combined (AND/OR) with other three breakpoints. Debug Event configured host generate output pulse external triggering when break condition met. also configured event input breakpoint logic, causing break falling-edge external event signal. used, Debug Event should pulled described section, Debugging 8032 Module., page 232. duration pulse, generated when Event configured output, clock cycle. This active-low signal, first edge when event occurs high-to-low. clock Watchdog Timer, ADC, interface stopped breakpoint halt. Watchdog Timer should disabled while debugging with JTAG, else reset will generated upon watchdog time-out. 40/264 uPSD34xx INTERRUPT SYSTEM INTERRUPT SYSTEM uPSD34xx 12-source, priority level interrupt structure summarized Table Firmware assign each interrupt source either high priority writing bits SFRs named, IPA, shown Table interrupt will serviced long interrupt equal higher priority already being serviced. interrupt equal higher priority being serviced, interrupt will wait until finished before being serviced. lower priority interrupt being serviced, will stopped interrupt serviced. When interrupt finished, lower priority interrupt that stopped will completed. interrupt requests same priority level received simultaneously, internal polling sequence determines which request selected service. Thus, within each priority levels, there second priority structure determined polling sequence. Firmware individually enable disable interrupt sources writing bits SFRs named, IEA, shown Table 16., page named contains global disable (EA), which cleared disable interrupts once, shown Table 17., page Figure 13., page illustrates interrupt priority, polling, enabling process. Each interrupt source least interrupt flag that indicates whether interrupt pending. These flags reside bits various SFRs shown Table 16., page interrupt flags latched into interrupt control system beginning each machine cycle, they polled beginning following machine cycle. polling determines flags set, interrupt control system automatically generates LCALL user's Interrupt Service Routine (ISR) firmware stored program memory appropriate vector address. specific vector address each interrupt sources listed Table 16., page However, this LCALL jump blocked following conditions: interrupt equal higher priority already progress current machine cycle final cycle execution instruction progress current instruction involves write SFRs: IEA, current instruction RETI Note: Interrupt flags polled based sample taken previous machine cycle. interrupt flag active cycle denied serviced conditions above, then later active when conditions above finally satisfied, previously denied interrupt will serviced. This means that active interrupts remembered. Every poling cycle new. Assuming listed conditions satisfied, executes hardware generated LCALL appropriate ISR. This LCALL pushes contents onto stack (but does save PSW) loads with appropriate interrupt vector address. Program execution then jumps vector address. Execution precedes ISR. necessary firmware clear pending interrupt flag some interrupt sources, because interrupt flags automatically cleared hardware when called, shown Table 16., page interrupt flag cleared after servicing interrupt, unwanted interrupt will occur upon exiting ISR. After interrupt serviced, last instruction executed RETI. RETI informs that longer progress pops bytes from stack loads them into Execution interrupted program continues where left off. Note: must with RETI instruction, RET. will inform interrupt control system that complete, leaving think still progress, making future interrupts impossible. 41/264 uPSD34xx INTERRUPT SYSTEM Table Interrupt Summary Interrupt Source Polling Vector Priority Addr Flag Name (SFR.bit position) Intr Pending Interrupt (TCON.1) (TCON.5) (TCON.3 (TCON.7) (SCON0.0) (SCON0.1) (T2CON.7) EXF2 (T2CON.6) TEISF, RORISF, TISF, RISF (SPISTAT[3:0]) INTR (S1STA.5) AINTF (ACON.7) OFVx, INTFx (PCASTA[0:7]) (SCON1.0) (SCON1.1) Flag AutoCleared Hardware? Edge Level Edge Level Enable Name (SFR.bit position) Intr Enabled Intr Disabled (IE.0) (IE.1) (IE.2) (IE.3) (IE.4) Priority Name (SFR.bit position) High Priority Priority (IP.0) (IP.1) (IP.2) (IP.3) (IP.4) Reserved External Interrupt INT0 Timer Overflow External Interrupt INT1 Timer Overflow UART0 Timer Overflow UART1 (high) 0063h 0003h 000Bh 0013h 001Bh 0023h 002Bh (IE.5) (IP.5) 0053h 0033h 0043h 003Bh 005Bh ESPI (IEA.6) EUSB (IEA.0) EI2C (IEA.1) EADC (IEA.7) EPCA (IEA.5) (IEA.4) PSPI (IPA.6) PUSB (IPA.0) PI2C (IPA.1) PADC (IPA.7) PPCA (IPA.5) (IPA.4) (low) 004Bh Note: interrupt flag registers UIF0-3. 42/264 uPSD34xx INTERRUPT SYSTEM Figure Enabling Polling Interrupts Interrupt Sources Reserved Priority IE/IEA IP/IPA High INT0 Timer INT1 Timer UART0 Interrupt Polling Sequence Timer UART1 Global Enable AI07844 43/264 uPSD34xx INTERRUPT SYSTEM Individual Interrupt Sources External Interrupts Int0 Int1. External interrupt inputs pins EXTINT0 EXTINT1 (pins 3.3) either edge-triggered level-triggered, depending bits named TCON. When external interrupt generated from edge-triggered (falling-edge) source, appropriate flag (IE0 IE1) automatically cleared hardware upon entering ISR. When external interrupt generated from level-triggered (low-level) source, appropriate flag (IE0 IE1) automatically cleared hardware. Timer Overflow Interrupt. Timer Timer interrupts generated flag bits when there overflow condition respective Timer/Counter register (except Timer Mode Timer Overflow Interrupt. This interrupt generated logical flag bits, EXE2. must read flag bits determine cause interrupt. overflow Timer EXE2 generated falling edge signal external pin, (pin P1.1). UART0 UART1 Interrupt. Each UARTs have identical interrupt structure. each UART, single interrupt generated logical flag bits, (byte received) (byte transmitted). must read flag bits named SCON0 UART0, SCON1 UART1 determine cause interrupt. Interrupt. interrupt four interrupt sources, which logically ORed together when interrupting MCU. must read flag bits determine cause interrupt. flag for: data transmit (TEISF); data receive overrun (RORISF); transmit buffer empty (TISF); receive buffer full (RISF). Interrupt. flag INTR variety conditions occurring interface: received slave address (ADDR flag); received general call address flag); received STOP condition (STOP flag); successful transmission reception data byte.The must read flag bits determine cause interrupt. Interrupt. flag AINTF when A-to-D conversion completed. Interrupt. eight interrupt sources, which logically ORed together when interrupting MCU.The must read flag bits determine cause interrupt. Each TCMs generate "match capture" interrupt flag bits OFV5.0 respectively. Each 16-bit counters generate overflow interrupt flag bits INTF1 INTF0 respectively. Tables through Table 20., page have detailed definitions interrupt system SFRs. Interrupt. interrupt multiple sources. must read Interrupt Flag Registers (UIF0-3) determine source interrupt. interrupt activated following four group interrupt sources: Global: interrupt flag when following events occurs: Reset, Suspend, Resume, Packet; FIFO: interrupt flag when Point FIFO becomes empty; FIFO: interrupt flag when Point FIFO becomes full; FIFO NAK: interrupt flag when Point FIFO ready (in-bound) packet. 44/264 uPSD34xx INTERRUPT SYSTEM Table Interrupt Enable Register (SFR A8h, reset value 00h) Details Symbol Function Global disable bit. interrupts disabled. Each interrupt source individually enabled disabled setting clearing enable bit. modify this bit. used JTAG debugger instruction tracing. Always read write back same value when writing this SFR. Enable Timer Interrupt Enable UART0 Interrupt Enable Timer Interrupt Enable External Interrupt INT1 Enable Timer Interrupt Enable External Interrupt INT0 5(1) 4(1) 3(1) 2(1) 1(1) 0(1) Note: Enable Interrupt, Disable Interrupt Table IEA: Interrupt Enable Addition Register (SFR A7h, reset value 00h) EADC Details 7(1) 6(1) 5(1) 4(1) 1(1) Symbol EADC ESPI EPCA EI2C EUSB Enable Interrupt Enable Interrupt Enable Programmable Counter Array Interrupt Enable UART1 Interrupt Reserved, logic '1.' Reserved, logic '1.' Enable Interrupt Enable Interrupt Function ESPI EPCA EI2C EUSB Note: Enable Interrupt, Disable Interrupt 45/264 uPSD34xx INTERRUPT SYSTEM Table Interrupt Priority Register (SFR B8h, reset value 00h) Details Symbol Reserved Reserved Timer Interrupt priority level UART0 Interrupt priority level Timer Interrupt priority level Function 4(1) 3(1) 2(1) 1(1) 0(1) External Interrupt INT1 priority level Timer Interrupt priority level External Interrupt INT0 priority level Note: Assigns high priority level, Assigns priority level Table IPA: Interrupt Priority Addition register (SFR B7h, reset value 00h) PADC Details 7(1) 6(1) 5(1) 4(1) 1(1) Symbol PADC PSPI PPCA PI2C PUSB Interrupt priority level Interrupt priority level Interrupt level UART1 Interrupt priority level Reserved Reserved Interrupt priority level Interrupt priority level Function PSPI PPCA PI2C PUSB Note: Assigns high priority level, Assigns priority level 46/264 uPSD34xx CLOCK GENERATION CLOCK GENERATION Internal system clocks generated clock generation unit derived from signal, XTAL1, shown Figure XTAL1 frequency fOSC, which comes directly from external crystal oscillator device. named CCON0 (Table 22., page controls clock generation unit. There clock signals produced clock generation unit: MCU_CLK PERIPH_CLK MCU_CLK This clock drives 8032 core Watchdog Timer (WDT). frequency MCU_CLK equal fOSC default, divided much 2048, shown Figure bits CPUPS[2:0] select eight different divisors, ranging from 2048. frequency available immediately after CPUPS[2:0] bits written. final frequency MCU_CLK fMCU. MCU_CLK blocked either bit, IDL, named PCON during Power-down Mode Idle Mode respectively. MCU_CLK clock further divided required WDT. details SUPERVISORY FUNCTIONS, page PERIPH_CLK This clock drives uPSD34xx peripherals except WDT. Frequency PERIPH_CLK always fOSC. Each peripherals independently divide PERIPH_CLK scale appropriately use. PERIPH_CLK runs times except when blocked named PCON during Power-down Mode. JTAG Interface Clock. JTAG interface Debugging uses externally supplied JTAG clock, coming TCK. This means JTAG interface always available, JTAG Debug interface available when enabled, even during Idle mode Powerdown Mode. However, since participates JTAG debug process, MCU_CLK halted during Idle Power-down Modes, majority debug functions available during these power modes. JTAG debug interface capable executing reset command while these power modes, which will exit back normal operating mode where debug commands available again. CCON0 contains bit, DBGCE, which enables breakpoint comparators inside JTAG Debug Unit when set. DBGCE default after reset, firmware clear this run-time. Disabling these comparators will reduce current consumption Module, recommended Debug Unit will used (such production version end-product). USB_CLK. uPSD34xx dedicated analog phase locked loop (PLL) that configured generate 48MHz USB_CLK clock wide range fOSC frequencies. USB_CLK must 48MHz function properly. enabled after power power lock time clock about 200µs, firmware should wait that much time before enabling USB_CLK setting USBCE CCON0 Register '1.' disabled Power-down mode, also disabled enabled writing PLLEN CCON0 Register. output clock frequency (fUSB_CLK) determined using following formula: USBCLK PLLM PLLD where PLLM PLLD multiplier divisor that specified CCON1 Register. fOSC, PLLM PLLD range must meet following conditions generate stable USB_CLK: PLLM (binary: [11111] PLLM[4:0] [11110]), PLLD (binary: [1111] PLLD[3:0] [1110]), fOSC/(PLLD+2) must equal greater than 3MHz. requires 48MHz clock operate correctly. PLLM[4:0] PLLD[3:0] values must selected generate USB_CLK that close 48MHz possible different oscillator frequencies (fOSC). Table 21., page lists some PLLM PLLD values that used common fOSC frequencies. 47/264 uPSD34xx CLOCK GENERATION Table PLLM PLLD Values Different fOSC Frequencies fOSC (MHz) 40.0 36.0 33.0 30.0 24.0 16.0 12.0 PLLM[4:0] decimal binary 10110 00110 11110 01110 10010 11100 11110 10110 11110 11110 decimal PLLD[3:0] binary 1000 0001 1001 0011 0011 0011 0010 0000 0000 1111 fUSB_CLK (MHz) 48.0 48.0 48.0 48.0 48.0 48.0 48.0 48.0 48.0 48.0 Figure Clock Generation Logic PCON[1]: Power-Down Mode PCON[2:0]: CPUPS[2:0], Clock Pre-Scaler Select XTAL1 (default) PCON[0]: IDL, Idle Mode XTAL1 (fOSC) XTAL1 XTAL1 XTAL1 XTAL1 XTAL1 XTAL1 /1024 XTAL1 /2048 MCU_CLK (fMCU) (to: 8032, WDT) Clock Divider PERIPH_CLK (fOSC) (to: TIMER0/1/2, UART0/1, PCA0/1, SPI, I2C, ADC) USB_CLK PCON[1] CCON0[6] AI10433 48/264 uPSD34xx CLOCK GENERATION Table CCON0: Clock Control Register (SFR F9h, reset value 50h) PLLM[4] Details Symbol PLLM[4] PLLEN Definition Upper 5-bit PLLM[4:0] Multiplier (Default: PLLM 00h) Enable Disable operation Enable operation (Default condition after reset) Clock Enable clock disabled (Default condition after reset) clock enabled Debug Unit Breakpoint Comparator Enable DBGCE JTAG Debug Unit comparators disabled JTAG Debug Unit comparators enabled (Default condition after reset) Automatic Clock Recovery CPUAR There change CPUPS[2:0] when interrupt occurs. Contents CPUPS[2:0] automatically become 000b whenever interrupt occurs. MCUCLK Pre-Scaler 000b: fMCU fOSC (Default after reset) 001b: fMCU fOSC/2 010b: fMCU fOSC/4 011b: fMCU fOSC/8 100b: fMCU fOSC/16 101b: fMCU fOSC/32 110b: fMCU fOSC/1024 111b: fMCU fOSC/2048 PLLEN UPLLCE DBGCE CPUAR CPUPS[2:0] UPLLCE CPUPS Table CCON1 Control Register (SFR FAh, reset value 00h) PLLM[3:0] Details Symbol PLLM[3:0] PLLD[3:0] Definition Lower bits 5-bit PLLM[4:0] Multiplier (Default after reset: PLLM 00h) PLLM[4] CCON0 Register. 4-bit Divider (Default after reset: PLLD PLLD[3:0] 49/264 uPSD34xx POWER SAVING MODES POWER SAVING MODES uPSD34xx combination die, modules, each module having current consumption characteristics. This section describes reduced power modes Module. section, Power Management, page reduced power modes Module. Total current consumption combined modules determined specifications this document. Module three software-selectable modes reduced power operation. Idle Mode Power-down Mode Reduced Frequency Mode Idle Mode Idle Mode will halt 8032 core while leaving peripherals active (Idle Mode blocks MCU_CLK only). lowest current consumption this mode, recommended disable unused peripherals, before entering Idle mode (such Debug Unit breakpoint comparators). following functions remain fully active during Idle Mode (except disabled settings). External Interrupts INT0 INT1 Timer Timer Timer Supervisor reset from: LVD, JTAG Debug, External RESET_IN_, Interface UART0 UART1 Interfaces Interface Programmable Counter Array Interface interrupt generated these peripherals, reset generated from supervisor, will cause Idle Mode exit 8032 will resume normal operation. output state pins ports remain unchanged during Idle Mode. enter Idle Mode, 8032 executes instruction named PCON, shown Table 26., page This last instruction executed normal operating mode before Idle Mode activated. Once Idle Mode, status entirely preserved, there changes PSW, ACC, SFRs, DATA, IDATA, XDATA. following factors related Idle Mode exit: Activation enabled interrupt will cause cleared hardware, terminating Idle Mode. interrupt serviced, following Return from Interrupt instruction (RETI), next instruction executed will which follows instruction that PCON SFR. After reset from supervisor, cleared, Idle Mode terminated, restarts after three machine cycles. Power-down Mode Power-down Mode will halt 8032 core peripherals (Power-down Mode blocks MCU_CLK, USB_CLK, PERIPH_CLK). This lowest power state Module. When Module also placed Powerdown mode, lowest total current consumption combined achieved uPSD34xx. Power Management, page Module section details also place Module Power-down mode. sequence 8032 instructions important when placing both modules into Power-down Mode. instruction that sets named PCON (Table 26., page last instruction executed prior Module going into Power-down Mode. Once Power-down Mode, on-chip oscillator circuitry clocks stopped. SFRs, DATA, IDATA, XDATA preserved. Power-down Mode terminated only reset from supervisor, originating from RESET_IN_ pin, Low-Voltage Detect circuit (LVD), JTAG Debug reset command. Since clock active during Powerdown mode, possible supervisor generate reset. Table 24., page summarizes status pins peripherals during Idle Power-down Modes Module. Table 25., page shows state 8032 address, data, control signals during these modes. Reduced Frequency Mode 8032 consumes less current when operating lower clock frequency. reduce clock frequency run-time writing three bits, CPUPS[2:0], named CCON0 described Table 22., page These bits effectively divide clock frequency (fOSC) coming from external crystal oscillator device. clock division range from 2048, resulting frequency fMCU. This clock division does affect peripherals, except WTD. clock driving same clock driving 8032 core shown Figure 14., page 50/264 uPSD34xx POWER SAVING MODES firmware reduce clock frequency run-time consume less current when performing tasks that time critical, then restore full clock frequency required perform urgent tasks. Returning full clock frequency done automatically upon interrupt, CPUAR named CCON0 (the interrupt will force CPUPS[2:0] 000). This excellent conserve power using frequency clock until event occurs that requires full performance. Table 22., page details CPUAR. Specifications this document estimate current consumption based clock frequency. Note: Some bits PCON shown Table 26., page related power control. Table Module Port Peripheral Status during Reduced Power Modes Mode Idle Power-down Ports Maintain Data Maintain Data SPI, I2C, UART0,1 Active Disabled PCA, TIMER 0,1,2 Active Disabled Active Disabled Active Disabled INT0,1 Active Disabled SUPERVISORY Active(1) Disabled Note: Watchdog Timer active during Idle Mode. Other supervisor functions active: LVD, external reset, JTAG Debug reset. Table State 8032 Signals during Power-down Idle Modes Mode Idle Power-down PSEN_ AD0-7 A8-15 51/264 uPSD34xx POWER SAVING MODES Table PCON: Power Control Register (SFR 87h, reset value 00h) SMOD0 Details Symbol Baud Rate Double (UART0) SMOD0 Doubling Doubling (See UART Baud Rates, page details.) Baud Rate Double UART (UART1) SMOD1 Doubling Doubling (See UART Baud Rates, page details.) Reserved Only power-on reset sets this (cold reset). Warm reset will this bit. '0,' Cleared zero with firmware '1,' only power-on reset generated Supervisory circuit (see Power-up Reset, page details). Received Clock Flag (UART1) (See Table 43., page flag description.) Transmit Clock Flag (UART1) (See Table 43., page flag description) Activate Power-down Mode Power-down Mode Enter Power-down Mode Activate Idle Mode Idle Mode Enter Idle Mode Function SMOD1 RCLK1 TCLK1 RCLK1 TCLK1 52/264 uPSD34xx OSCILLATOR EXTERNAL COMPONENTS OSCILLATOR EXTERNAL COMPONENTS oscillator circuit uPSD34xx devices single stage, inverting amplifier Pierce oscillator configuration. internal circuitry between pins XTAL1 XTAL2 basically inverter biased transfer point. Either external quartz crystal ceramic resonator used feedback element complete oscillator circuit. Both operated parallel resonance. Ceramic resonators lower cost, typically have wider frequency tolerance than quartz crystals. Alternatively, external clock source from oscillator other active device drive uPSD34xx oscillator circuit input directly, instead using crystal resonator. minimum frequency quartz crystal, ceramic resonator, external clock source 3MHz used. minimum 8MHz used. maximum 40MHz cases. This frequency fOSC, which divided internally CLOCK described GENERATION, page XTAL1 high gain amplifier input, XTAL2 output. drive uPSD34xx device externally from oscillator other active device, XTAL1 driven XTAL2 left opencircuit. This external source should drive logic voltage level below, logic high 0.7V above, 5.5V VCC. XTAL1 input tolerant. Most quartz crystals range 25MHz 40MHz operate third overtone frequency mode. external tank circuit XTAL2 output oscillator circuit needed achieve third overtone frequency, shown Figure 15., page Without this circuit, crystal will oscillate fundamental frequency mode that about desired overtone frequency. Note: Figure 15., page crystals which specified operate fundamental mode (not overtone mode) need circuit components. Since quartz crystals ceramic resonators have their characteristics based their manufacturer, wise also consult manufacturer's recommended values external components. Figure Oscillator Clock Connections XTAL1 (in) XTAL2 (out) Crystal Resonator Usage XTAL (fOSC) XTAL (fOSC) Ceramic Resonator Crystal, fundamental mode (3-40MHz) Crystal, overtone mode (25-40MHz) 50pF 15-33pF 20pF None None 10nF None None 2.2µH Direct Drive XTAL1 (in) XTAL2 (out) External Ocsillator Active Clock Source Connect AI09198 53/264 uPSD34xx PORTS MODULE PORTS MODULE Module three 8-bit ports: Port Port Port Module four other ports: Port This section describes only ports Module. ports will function bi-directional General Purpose (GPIO), port pins have alternate functions assigned run-time writing specific SFRs. default operating mode (during after reset) three ports GPIO input mode. Port pins that have external connection will float because each internal weak pull-up (~150K ohms) VCC. ports tolerant, meaning they driven/pulled externally 5.5V without damage. pins Port have higher current capability than pins Ports Three additional ports (only 80-pin uPSD34xx devices) dedicated bring 8032 address, data, control signals external pins. port, named MCUAD[7:0], eight multiplexed address/data bidirectional signals. third port control outputs: read, write, program fetch, address latch. These ports typically used connect external parallel peripherals memory devices, they used GPIO. Notice that eight upper address signals come pins port. high-order address signals required external pins (MCU addresses A[15:8]), then these address signals brought needed output pins Address mode pins Module ports. Module section, "Latched Address Output Mode, page details. Figure 16., page represents flexibility function routing controlled SFRs. Each pins three ports, individually routed pin-by-pin basis desired function. Port Operating Modes port pins operate GPIO alternate functions (see Figure 17., page through Figure 19., page 58). Depending selected function, particular operating mode will automatically used: GPIO Quasi-bidirectional mode UART0, UART1 Quasi-bidirectional mode Quasi-bidirectional mode Open drain mode Analog input mode output Push-Pull mode input Input only (Quasi-bidirectional) Timer 0,1,2 Input only (Quasi-bidirectional) GPIO Function. Ports GPIO mode operate quasi-bidirectional pins, consistent with standard 8051 architecture. GPIO pins individually controlled three SFRs: SFR, (Table 27., page SFR, (Table 28., page SFR, (Table 29., page These SFRs accessed using Addressing mode, efficient control individual port pins. GPIO Output. Simply stated, when logic written these port SFRs while GPIO mode, corresponding port will enable low-side driver, which pulls ground, same time releases high-side driver pull-ups, resulting logic output. When logic written SFR, low-side driver released, high-side driver enabled just MCU_CLK period rapidly make 0-to1 transition pin, while weak active pull-ups (total ~150K) enabled. This structure consistent with standard 8051 architecture. high side driver momentarily enabled only 0to-1 transitions, which implemented with delay function latch output pictured Figure 17., page Figure 18., page Figure 19., page After high-side driver disabled, weak pull-ups remain enabled resulting logic output pin, sourcing external device. Optionally, external pull-up resistor added additional source current needed while outputting logic '1.' 54/264 uPSD34xx PORTS MODULE GPIO Input. GPIO port input, low-side driver ground must disabled, else true logic level being driven external device will masked (always reads logic '0'). make port "input ready", corresponding must have been logic prior reading that input. reset condition forces SFRs FFh, thus three ports input ready after reset. When used input, stronger pullup maintains solid logic until external device drives input low. this time, pull-up automatically disabled, only pull-up will source external device consistent with standard 8051 architecture. GPIO Bi-Directional. possible operate individual port pins bi-directional mode. output, firmware would simply write corresponding logic needed. before using input, firmware must first ensure that logic last value written corresponding prior reading that input. GPIO Current Capability. GPIO Port sink twice much current than either Port Port when low-side driver outputting logic (IOL). specifications this document full details. Reading Port Reading Port Latch. When firmware reads GPIO ports, sometimes actual port sampled hardware, sometimes port latch read actual pin, depending type instruction used. These data paths shown Figure 17., page through Figure 19., page latches read (and pins) only when read part read-modify-write instruction write destination bits port SFR. These instructions are: ANL, ORL, XRL, JBC, CPL, INC, DEC, DJNZ, MOV, CLR, SETB. other types reads port SFRs will read actual logic level port latch. This consistent with 8051 architecture. 55/264 uPSD34xx PORTS MODULE Figure Module Port Function Routing Module Ports GPIO UART0 TIMER0/1 GPIO TIMER2 UART1 GPIO 8032 CORE Addr Data[7:0] Address [15:8] 80-pin Devices Only (Available Module Pins) PSEN, AI09199b 56/264 uPSD34xx PORTS MODULE Figure Cell Block Diagram Port Select_Alternate_Func DELAY, MCU_CLK Digital_Alt_Func_Data_Out P1.X Read Latch (for R-M-W instructions) MCU_Reset 8032 Data GPIO P1.X Write Latch P1.X Latch DELAY, MCU_CLK SIDE HIGH SIDE WEAK PULL-UP, STONGER PULL-UP, P1.X P1.X Read Analog_Alt_Func_En Digital_Pin_Data_In Analog_Pin_In AI09600 Figure Cell Block Diagram Port Enable_I2C Select_Alternate_Func DELAY, MCU_CLK Digital_Alt_Func_Data_Out P3.X Read Latch (for R-M-W instructions) MCU_Reset 8032 Data GPIO P3.X Write Latch P3.X Latch DELAY, MCU_CLK SIDE Disables High-Side Driver WEAK PULL-UP, STONGER PULL-UP, HIGH SIDE P3.X P3.X Read Digital_Pin_Data_In AI09601 57/264 uPSD34xx PORTS MODULE Figure Cell Block Diagram Port Enable_Push_Pull Select_Alternate_Func DELAY, MCU_CLK Digital_Alt_Func_Data_Out P4.X Read Latch (for R-M-W instructions) MCU_Reset 8032 Data GPIO P4.X Write Latch P4.X Latch DELAY, MCU_CLK SIDE Alternate Function WEAK PULL-UP, STONGER PULL-UP, HIGH SIDE P4.X P4.X Read Digital_Pin_Data_In AI09602 Table Port Register (SFR 90h, reset value FFh) P1.7 Details Symbol P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Port Port Port Port Port Port Port Port Function(1) P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 Note: Write output. Read input, prior READ, this must have been firmware reset event. 58/264 uPSD34xx PORTS MODULE Table Port Register (SFR B0h, reset value FFh) P3.7 Details Symbol P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 Port Port Port Port Port Port Port Port Function(1) P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 Note: Write output. Read input, prior READ, this must have been firmware reset event. Table Port Register (SFR C0h, reset value FFh) P4.7 Details Symbol P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 Port Port Port Port Port Port Port Port Function(1) P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 Note: Write output. Read input, prior READ, this must have been firmware reset event. 59/264 uPSD34xx PORTS MODULE Alternate Functions. There five SFRs used control mapping alternate functions onto port pins, these SFRs depicted switches Figure 16., page Port uses SFR, P3SFS (Table 30., page 61). Port uses SFRs, P1SFS0 (Table 31., page P1SFS1 (Table 32., page 61). Port uses SFRs, P4SFS0 (Table 34., page P4SFS1 (Table 35., page 62). Since these SFRs cleared reset, then default port pins function GPIO (not alternate function) until firmware initializes these SFRs. Each each three ports independently assigned different function pinby-pin basis. peripheral functions Timer UART1, split independently between Port Port additional flexibility giving wider choice peripheral usage limited number device pins. When selected alternate function UART0, UART1, SPI, then related pins quasibidirectional mode, including highside driver rapid 0-to-1 output transitions. high-side driver enabled just MCU_CLK period 0-to-1 transitions delay function "digital_alt_func_data_out" signal pictured Figure 17., page through Figure 19., page alternate function Timer Timer Timer input, then related pins quasibidirectional mode, input only. alternate function ADC, then each pull-ups, high-side driver, low-side driver disabled. analog input routed directly unit. Only Port supports analog functions (Figure 17., page 57). Port tolerant. alternate function I2C, related pins will open drain mode, which just like quasi-bidirectional mode high-side driver enabled cycle when outputting 0-to-1 transition. Only low-side driver internal weak pull-ups used. Only Port supports open-drain mode (Figure 18., page 57). requires external pull-up resistor each signal, typically 4.7K VCC. alternate function output, then related pins push-pull mode, meaning pins actively driven held logic highside driver, actively driven held logic low-side driver. Only Port supports pushpull mode (Figure 19., page 58). Port push-pull pins source current when driving logic '1,' sink current when driving logic '0.' This current significantly more than capability pins Port Port (see Table 156., page 238). example, assign these port functions: Port UART1, ADC[1:0], P1[7:4] GPIO Port UART0, I2C, P3[5:2] GPIO Port TCM0, SPI, P4[3:1] GPIO following values need written SFRs: P1SFS0 00001111b, P1SFS1 00000011b P3SFS 11000011b, P4SFS0 11110001b, P4SFS1 11110000b, 60/264 uPSD34xx PORTS MODULE Table P3SFS: Port Special Function Select Register (SFR 91h, reset value 00h) P3SFS7 Details Default Port Function Port P3SFS[i] Port Pin, GPIO GPIO GPIO GPIO GPIO GPIO GPIO GPIO P3SFS[i] Port Pin, UART0 Receive, RXD0 UART0 Transmit, TXD0 Intr 0/Timer Gate, EXT0INT/TG0 Intr 1/Timer Gate, EXT1INT/TG1 Counter Input, Counter Input, Data, I2CSDA Clock, I2CCL Alternate Port Function P3SFS6 P3SFS5 P3SFS4 P3SFS3 P3SFS2 P3SFS1 P3SFS0 Table P1SFS0: Port Special Function Select Register (SFR 8Eh, reset value 00h) P1SF07 Details P1SF06 P1SF05 P1SF04 P1SF03 P1SF02 P1SF01 P1SF00 Table P1SFS1: Port Special Function Select Register (SFR 8Fh, reset value 00h) P1SF17 P1SF16 P1SF15 P1SF14 P1SF13 P1SF12 P1SF11 P1SF10 Table P1SFS0 P1SFS1 Details Default Port Function Port P1SFS0[i] P1SFS1[i] Port Pin, GPIO GPIO GPIO GPIO GPIO GPIO GPIO GPIO Alternate Port Function P1SFS0[i] P1SFS1[i] Port Pin, Timer Count Input, Timer Trigger Input, UART1 Receive, RXD1 UART1 Transmit, TXD1 Clock, SPICLK Receive, SPIRXD Transmit, SPITXD Select, SPISEL_ Alternate Port Function P1SFS0[i] P1SFS1[i] Port Pin, Input, ADC0 Input, ADC1 Input, ADC2 Input, ADC3 Input, ADC4 Input, ADC5 Input, ADC6 Input, ADC7 61/264 uPSD34xx PORTS MODULE Table P4SFS0: Port Special Function Select Register (SFR 92h, reset value 00h) P4SF07 Details P4SF06 P4SF05 P4SF04 P4SF03 P4SF02 P4SF01 P4SF00 Table P4SFS1: Port Special Function Select Register (SFR 93h, reset value 00h) P4SF17 P4SF16 P4SF15 P4SF14 P4SF13 P4SF12 P4SF11 P4SF10 Table P4SFS0 P4SFS1 Details Default Port Function Port P4SFS0[i] P4SFS1[i] Port Pin, GPIO GPIO GPIO GPIO GPIO GPIO GPIO GPIO Alternate Port Function P4SFS0[i] P4SFS1[i] Port Pin, PCA0 Module TCM0 PCA0 Module TCM1 PCA0 Module TCM2 PCA0 Clock, PCACLK0 PCA1 Module TCM3 PCA1 Module TCM4 PCA1 Module TCM5 PCA1 Clock, PCACLK1 Alternate Port Function P4SFS0[i] P4SFS1[i] Port Pin, Timer Count Input, Timer Trigger Input, UART1 Receive, RXD1 UART1 Transmit, TXD1 Clock, SPICLK Receive, SPIRXD Transmit, SPITXD Select, SPISEL_ 62/264 uPSD34xx INTERFACE INTERFACE Module programmable interface which modified 8032 with multiplexed address data lines. supports four types data transfer (16- 8-bit), each transfer to/from memory location external Module: Code Fetch cycle using PSEN signal: fetch 16-bit code word filling pre-fetch queue. fetches code byte from execution; Code Read cycle using PSEN: read 16-bit code word using MOVC (Move Constant) instruction. code word routed directly by-pass PFQ; XDATA Read cycle using signal: read data byte using MOVX (Move eXternal) instruction; XDATA Write cycle using signal: write data byte using MOVX instruction PSEN Cycles PSEN cycle, module fetches instruction from 16-bit program memory module. multiplexed address/data AD[15:0] connected module 16bit data transfer. uPSD34xx does support external PSEN cycles cannot fetch instruction from other external program memory devices. READ WRITE Cycles XDATA READ WRITE cycle, MCU's multiplexed AD[15:0] connected module, only lower bytes AD[7:0] used 8-bit data transfer. AD[7:0] lines also connected pins 80-pin package accessing external devices. high address byte A[15:8] needed external devices, Port Module configured provide latched A[15:8] address outputs. Connecting External Devices uPSD34xx supports 8-bit only external Data memory devices. READ WRITE data transfer carried AD[7:0] which available 80-pin package. address lines brought external devices three ways: Configure Ports Module Address Output mode, shown Figure Port together with external latch, shown Figure 21., page external latch latches address byte from AD[7:0] with signal.This configuration design where Port needed CPLD functions; Configure microcell CPLD output address line CPLD output pins. This most flexible implementation requires CPLD resources. Ports Module configured PSDsoft provide latched address A[7:0] A[15:8] (see Module Detailed Operation, page details enable Address Output mode). latched address outputs ports configurable. example, Port pins PB[2:0] enabled provide A[10:8] remaining pins configured other functions such generating chip selects external devices. Figure Connecting External Devices using Ports Address AD[15:0] uPSD34xx Module AD[7:0] AD[15:8] PSEN Module A8-15 A0-7 Port Port D[7:0] AI10434 External 8-bit Device 63/264 uPSD34xx INTERFACE Figure Connecting External Devices using Port External Latch Address AD[15:0] uPSD34xx Module AD[7:0] AD[15:8] PSEN Module Port A8-15 D[7:0] AI10435 A7-0 External 8-bit Device Programmable Timing length cycles user programmable time. number MCU_CLK periods cycle specified register named BUSCON (see Table 37., page 65). default, BUSCON Register loaded with long cycle times MCU_CLK periods) after reset condition. important that post-reset initialization firmware sets cycle times appropriately most performance, according Table 38., page Keep mind that Module faster Turbo Mode (default) slower less power consuming Non-Turbo Mode. cycle times must programmed BUSCON optimize each mode shown Table Module Detailed Operation, page more details. possible specify BUSCON Register different number MCU_CLK periods various address ranges. example, user cannot specify MCU_CLK periods read cycles address range Module, MCU_CLK periods read cycles different address range external device. However, user specify number clock periods PSEN read cycles different number clock periods cycles (see Figure Figure 22., page 65). Controlling BUSCON Register allows firmware enable disable run-time. Sometimes desired disable ensure deterministic execution. dynamic action cause varying program execution times depending events that happen prior particular section code interest. this reason, recommended implement timing loops firmware, instead many hardware timers uPSD34xx. default, enabled after reset condition. Important: Disabling will seriously reduce performance. 64/264 uPSD34xx INTERFACE Figure PSEN Cycle MCU_CLK Clock D0-D15(1) AD0-AD15 A0-A15 (2,3) RD/PSEN 5-Clock Cycle AI10436 Note: PSEN cycle 16-bit, while cycle 8-bit only. PSEN cycle progress aborted before completion Branch Cache (BC) determines current code fetch cycle needed. Whenever same number MCU_CLK periods specified BUSCON both PSEN cycles, cycle timing typically identical each these types cycles. this case, only time PSEN read cycles longer than read cycles when issues stall while reloading. stalls affect read cycles. comparison, many traditional 8051 architectures, cycles always longer than PSEN cycles. Table BUSCON: Control Register (SFR 9Dh, reset value EBh) EPFQ Details Symbol EPFQ Enable Pre-Fetch Queue disabled enabled (default) Enable Branch Cache disabled enabled (default) Wait, number MCU_CLK periods write cycle during MOVX instruction 00b: clock periods 01b: clock periods 10b: clock periods (default) 11b: clock periods Wait, number MCU_CLK periods read cycle during MOVX instruction 00b: clock periods 01b: clock periods 10b: clock periods (default) 11b: clock periods Code Wait, number MCU_CLK periods PSEN read cycle during code byte fetch during MOVC code byte read instruction. Periods will increase with stall 00b: clock periods exception, MOVC instructions this setting results clock periods 01b: clock periods 10b: clock periods 11b: clock periods (default) Definition WRW[1:0] RDW[1:0] CW[1:0] WRW[1:0] RDW[1:0] CW[1:0] 65/264 uPSD34xx INTERFACE Table Number MCU_CLK Periods Required Optimize Transfer Rate Clock Frequency, MCU_CLK (fMCU) 40MHz, Turbo mode PSD(2) 40MHz, Non-Turbo mode 36MHz, Turbo mode 36MHz, Non-Turbo mode 32MHz, Turbo mode 32MHz, Non-Turbo mode 28MHz, Turbo mode 28MHz, Non-Turbo mode 24MHz, Turbo mode 24MHz, Non-Turbo mode 20MHz below, Turbo mode 20MHz below, Non-Turbo mode CW[1:0] Periods 3.3V(1) 5V(1) RDW[1:0] Periods 3.3V(1) 5V(1) WRW[1:0] Periods 3.3V(1) 5V(1) Note: Module "Turbo mode PSD" means that Module faster, Turbo mode (default condition). Module Non-Turbo mode slower, consumes less current. Module section, titled "PLD Non-Turbo Mode" details. 66/264 uPSD34xx SUPERVISORY FUNCTIONS SUPERVISORY FUNCTIONS Supervisory circuitry Module will issue internal reset signal Module simultaneously Module result following four events: external RESET_IN asserted Voltage Detect (LVD) circuitry detected voltage below specific threshold (power-on voltage sags) JTAG Debug interface issued reset command Watch Timer (WDT) timed resulting internal reset signal, MCU_RESET, will force 8032 into known reset state while asserted, then 8032 program execution will jump reset vector program address 0000h just after MCU_RESET deasserted. Module will also assert active internal reset signal, RESET, Module. needed, signal RESET driven external system components through output Module. When driving this Figure Supervisor Reset Generation "RESET_OUT" signal from output, user choose make either active-high activelow logic, depending equation. External Reset Input Pin, RESET_IN RESET_IN connected directly mechanical reset switch other device which pulls signal ground invoke reset. RESET_IN pulled internally enters Schmitt trigger input buffer with voltage hysteresis VRST_HYS immunity effects slow signal rise fall times, shown Figure RESET_IN also filtered reject voltage spike less than duration tRST_FIL. RESET_IN signal must maintained logic least duration tRST_LO_IN while oscillator running. resulting MCU_RESET signal will last only long RESET_IN signal active stretched). Refer Supervisor specifications Table 178., page this document these parameter values. PULL-UP RESET_IN Noise Filter Clock Sync JTAG Debug DELAY, tRST_ACTV MCU_RESET Peripherals RESET Module AI09603 67/264 uPSD34xx SUPERVISORY FUNCTIONS Voltage Detect, internal reset generated circuit when drops below reset threshold, VLV_THRESH. After returns reset threshold, MCU_RESET signal will remain asserted tRST_ACTV before released. circuit always enabled (cannot disabled SFR), even Idle Mode Power-down Mode. input voltage hysteresis VRST_HYS will reject voltage spikes less than duration tRST_FIL. Important: voltage threshold VLV_THRESH, suitable monitoring both 3.3V supply Module 3.3V supply Module 3.3V uPSD34xxV devices, since these supplies same circuit board. However, uPSD34xx devices, VLV_THRESH suitable monitoring voltage supply (VLV_THRESH low), good monitoring 3.3V supply. case uPSD34xx devices, external means required monitor separate supply, desired. Power-up Reset power internal reset generated circuit latched logic named PCON (Table 26., page 52). Software read this determine whether last reset result power (cold reset) reset from some other condition (warm reset). This must cleared with software. JTAG Debug Reset JTAG Debug Unit generate reset debugging purposes. This reset source also available when Idle Mode PowerDown Mode (the user JTAG debugger exit these modes). Watchdog Timer, When enabled, will generate reset whenever overflows. Firmware that behaving correctly will periodically clear before overflows. Run-away firmware will able clear WDT, reset will generated. Figure Watchdog Counter 8-bits 8-bits 8-bits default, disabled after each reset. Note: active during Idle mode Power-down Mode. There SFRs that control WDT, they WDKEY (Table 39., page WDRST (Table 40., page 70). WDKEY contains 55h, disabled. value other than WDKEY will enable WDT. default, after reset condition, WDKEY automatically loaded with 55h, disabling WDT. responsibility initialization firmware write some value other than WDKEY after each reset used. consists 24-bit up-counter (Figure 24), whose initial count 000000h default after every reset. most significant byte this counter controlled SFR, WDRST. After being enabled WDKEY, 24-bit count increased each machine cycle. When count overflows beyond FFFFFh (224 machine cycles), reset issued automatically disabled (WDKEY again). prevent from timing generating reset, firmware must repeatedly write some value WDRST before count reaches FFFFFh. Whenever WDRST written, upper bits 24-bit counter loaded with written value, lower bits counter cleared 0000h. time-out period adjusted writing value other that WDRST. example, WDRST written with 04h, then will start counting 040000h, 040001h, 040002h, each machine cycle. this example, time-out period shorter than WDRST written with 00h, because up-counter. value WDRST should never written that results time-out period shorter than time required complete longest code task application, else unwanted overflows will occur. SFR, WDRST AI09604 68/264 uPSD34xx SUPERVISORY FUNCTIONS formula determine time-out period WDTPERIOD tMACH_CYC NOVERFLOW NOVERFLOW number up-counts required reach FFFFFFh. This determined value written SFR, WDRST. tMACH_CYC average duration machine cycle. default, machine cycle always MCU_CLK periods uPSD34xx, following factors sometimes more MCU_CLK periods machine cycle: number MCU_CLK periods assigned memory cycles determined SFR, BUSCON. this setting greater than then machine cycles have additional MCU_CLK periods during memory transfers. Whether PFQ/BC circuitry issues stall during particular machine cycle. stall adds more MCU_CLK periods machine cycle until stall removed. tMACH_CYC also affected absolute time single MCU_CLK period. This number fixed following factors: Frequency external crystal, resonator, oscillator: (fOSC) settings CCON0, which divide fOSC change MCU_CLK example, assume following: fOSC 40MHz, thus period 25ns. CCON0 10h, meaning clock division, period MCU_CLK also 25ns. BUSCON C1h, meaning enabled, each memory cycle MCU_CLK periods, adding additional MCU_CLK periods machine cycles during memory transfers. Assume there stalls from PFQ/BC. reality, there occational stalls their occurance minimal impact timeout period. WDRST contains 00h, meaning full upcounts required reach FFFFFh generate reset. this example, tMACH_CYC 100ns MCU_CLK periods 25ns) NOVERFLOW 16777216 up-counts WDTPERIOD 100ns 16777216 1.67 seconds actual value will slightly longer PFQ/ Firmware Example: following 8051 assembly code illustrates operate WDT. simple statement reset initialization firmware enables WDT, then periodic write clear main firmware required keep from overflowing. This firmware based example above (40MHz fOSC, CCON0 10h, BUSCON C1h). example, reset initialization firmware (the function that executes after jump reset vector): enable writing value WDKEY other than Somewhere flow main program, this statement will execute periodically reset before time-out period 1.67 seconds. example: reset WDT, loading 000000h. Counting will automatically resume long WDKEY 69/264 uPSD34xx SUPERVISORY FUNCTIONS Table WDKEY: Watchdog Timer Register (SFR AEh, reset value 55h) WDKEY[7:0] Details Symbol Definition disables from counting. automatically loaded this after reset condition, leaving disabled default. [7:0] WDKEY value other than written this will enable WDT, counting begins. Table WDRST: Watchdog Timer Reset Counter Register (SFR A6h, reset value 00h) WDRST[7:0] Details Symbol Definition This upper byte 24-bit up-counter. Writing this sets upper byte counter written value, clears lower bytes counter 0000h. Counting begins when WDKEY does contain 55h. [7:0] WDRST 70/264 uPSD34xx STANDARD 8032 TIMER/COUNTERS STANDARD 8032 TIMER/COUNTERS There three 8032-style 16-bit Timer/Counter registers (Timer Timer Timer that configured operate timers event counters. There additional 16-bit Timer/Counters Programmable Counter Array (PCA), seePCA Block, page details. Standard Timer SFRs Timer Timer have very similar functions, they share SFRs control: TCON (Table 41., page TMOD (Table 42., page 74). Timer SFRs that form 16-bit counter, that hold reload values, that scale clock depending timer/counter mode: high byte, address byte, address Timer similar SFRs: high byte, address byte, address Timer control SFR: T2CON (Table 43., page Timer SFRs that form 16-bit counter, perform other functions: high byte, address byte, address Timer SFRs capture reload: RCAP2H high byte, address RCAP2L byte, address Clock Sources When enabled "Timer" function, Registers incremented every 1/12 oscillator frequency (fOSC). This timer clock source effected clock dividers CCON0, stalls from PFQ/BC, transfer cycles. Timers always clocked 1/12 fOSC. When enabled "Counter" function, Registers incremented response 1-to-0 transition sampled their corresponding external input pin: Timer Timer Timer this function, external clock input sampled counter rate 1/12 fOSC. When logic determined sample, logic next sample period, count incremented very next sample period (period1: sample=1, period2: sample=0, period3: increment count while continuing sample). This means maximum count rate 1/24 fOSC. There restrictions duty cycle external input signal, ensure that giv Other recent searchesZWD150PAF - ZWD150PAF ZWD150PAF Datasheet STE2001 - STE2001 STE2001 Datasheet NJG1600KB2 - NJG1600KB2 NJG1600KB2 Datasheet GP1UE29QK0VF - GP1UE29QK0VF GP1UE29QK0VF Datasheet CY74FCT652T - CY74FCT652T CY74FCT652T Datasheet CSTCE12M0G55Z-R0 - CSTCE12M0G55Z-R0 CSTCE12M0G55Z-R0 Datasheet 2SJ401 - 2SJ401 2SJ401 Datasheet
Privacy Policy | Disclaimer |