za030 Z.BUS secl za530 sec Serial _ .....' ...;.... CO_m_m_UftI_·c:a_ti_·O_DS_CO_D_b'o_U_e_r_, Tec:lmic:al Manual -II - September 1986 II , ..II II1II II •II 18030 I-BUS SCCI Z8530 SCC Serial . - eolllDluniealioDS Controller I' : I • • I . .: .. '''' :: . ::- .' I 1 ;;' . Ij" . - I "II. _ Related Zilog Documents ~. Data Book, 00-2034-04 Z803018530 SCC Product Specification, 00-2439-01 Design Considerations Using Quartz Crystals With Zilog's Components, 00-2802~01 Z80, Z8000, and Z-BUS are registered trademarks of Zilog, Inc. MULTIBUS is a registered trademark of Intel Corp. Copyright 1982, 1983, 1986 by Zilog, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Zilog. The information contained herin is subject to change without notice. Zitog assumes no responsibility for the uses of any circuitry other than circuitry embodied in a Zilog product. No other circuit patent licenses are implied. All specifications (parameters) are subject to change wnhout notice. The applicable Zilog test documentation will specify which parameters .~. are tested. Table of Contents PREFACE v CHAPTER 1 GENERAL INFORMATION 1-1 1.0 INTRODUCTION 1-1 1.1 CAPABILITIES ... 1-1 1.2 BLOCK DIAGRAM 1-2 1.3 PIN FUNCTIONS 1-2 1.4 PIN DESCRIPTIONS 1-2 1.4.1 Pin Descriptions (Z8030 SCC only) 1-3 1.4.2 Pin Descriptions (Z8530 SCC only) 1-4 1.4.3 Pin Descriptions (both Z8030 and Z8530) 1-4 CHAPTER 2 OVERVIEW 2-1 2.0 INTRODUCTION 2-1 2.1 REGISTER FUNCTIONS ... 2-1 2.2 DATA PATHS ... 2-2 2.2.1 Transmitter 2-2 2.2.2 Receiver ... 2-2 2.2.3 Baud Rate Generator 2-4 2.2.4 Digital Phase-Locked Loop (DPLL) 2-4 2.2.5 Clocking Options 2-4 2.2.6. Data Encoding 2-5 2.3 DATA COMMUNICATIONS CAPABILITIES ... 2-5 2.3.1 Asynchronous 2-5 2.3.2 Monosync Mode ... 2-5 2.3.3 Bisynchronous Mode 2-6 2.3.4 External Sync Mode 2-6 2.3.5 SDLC Mode 2-6 2.3.6 SDLC Loop Mode 2-7 2.4 I/O CAPABILITIES 2-8 2.4.1 Polling ... 2-8 2.4.2 Interrupts 2-8 2.4.3 Block Transfers 2-9 CHAPTER 3 INTERFACING THE SCC 3-1 3.0 INTRODUCTION 3-1 3.1 INTERFACING THE AmZ8030 3-1 3.1.1 Z8030 Read Cycle Timing 3-1 3.1.2 Z8030 Write Cycle Timing ... 3-2 3.1.3 Z8030 Interrupt Acknowledge Cycle Timing 3-2 3.1.4 Z8030 Register Access 3-2 3.1.5 Z8030 Reset 3-3 3.2 INTERFACING THE AmZ8530 3-3 3.2.1 28530 Read Cycle Timing 3-4 3.2.2 28530 Write Cycle Timing ... ... 3-4 3.2.3 Z8530 Interrupt Acknowledge Cycle Timing 3-5 3.2.4 28530 Register Access 3-5 3.2.5 28530 Reset 3-8 ':" CHAPTER 4 1/0 Programming Capabilities ... 4-1 4.0 INTRODUCTION 4-1 ~ 4.1 POLLING 4-1 4.2 INTERRUPT OPERATIONS 4-1 Interrupt Without Acknowledge 4-1 Interrupt with Acknowledge 4-1 Interrupt Sources 4-2 Daisy-Chain Priority Resolution 4-2 External Daisy Chain Operations 4-3 4.2.1 Receive Interrupts ... 4-3 Receive Interrupts Disabled ... 4-3 Receive Interrupt on First Character or Special Condition 4-3 Interrupt on All Receive Characters or Special Conditions 4-5 Receive Interrupt on Special Conditions 4-5 4.2.2 Transmit Interrupts ... 4-5 4.2.3 External/Status Interrupts 4-6 4.3 BLOCK TRANSFERS 4-7 4.3.1 Wan on Transmn 4-7 4.3.2 Wait on Receive 4-8 4.3.3 DMA Requests 4-8 4.3.4 DMA Request on Transmit (using W/REQ) 4-8 4.3.5 DMA Request on Transmit (using OTR/REO) 4-8 4.3.6 DMA Request on Receive 4-10 CHAPTER 5 PROGRAMMING DATA COMMUNICATION MODES 5-1 5.0 INTRODUCTION 5-1 5.1 ASYNCHRONOUS MODE ... 5-1 5.1.1 Asynchronous Receive 5-1 5.1.2 Asynchronous Transmit 5-2 5.2 SYNCHRONOUS MODE ... 5-3 5.2.1 Synchronous Receive 5-3 5.2.2 Synchronous Transmit 5-7 5.2.3 Transmitter to Receiver Synchronization 5-8 5.3 SDLCMODE ... 5-9 5.3.1 SDLC Receive 5-10 5.3.2 SDLC Transmit 5-13 5.3.3 SDLC Loop Mode 5-14 CHAPTER 6 SUPPORT CIRCUITRY PROGRAMMING 6-1 6.0 INTRODUCTION 6-1 6.1 CLOCK OPTIONS 6-1 6.2 BAUD RATE GENERATOR 6-1 6.3 DATA ENCODING 6-4 6.4 DIGITAL PHASE-LOCKED LOOP 6-5 6.5 NRZI MODE OPERATION ... 6-5 6.6 FM MODE OPERATION 6-6 6.7 DPLL INITIALIZATION 6-8 6.8 INTERNAL LOOPBACK/AUTO ECHO 6-8 CHAPTER 7 REGISTER DESCRIPTION 7-1 7.0 INTRODUCTION 7-1 7.1 WRITE REGISTERS 7-1 7.1.1 Write Register 0 (Command Register) 7-1 7.1.2 Write Register 1 (TransmiVReceive Interrupt and Data Transfer Mode Definition) 7-3 7.1.3 Write Register 2 (interrupt vector) 7-5 7.1.4 Write Register 3 (Receive Parameters and Control) 7-5 7.1.5 Write Register 4 (Transmit/Receiver Miscellaneous ~ Parameters and Modes) 7-7 7.1.6 Write Register 5 (Transmit Parameter and Controls) 7-8 7.1.7 Write Register 6 (Sync Characters or SDLC Address Field) 7-9 7.1.8 Write Register 7 (SYNC Character or SDLC Flag) 7-10 7.1.9 Write Register 8 (transmit buffer) 7-10 7.1.10 Write Register 9 (Master Interrupt Control) 7-10 7.1.11 Write Register 10 (Miscellaneous Transmitter/Receiver Control Sns) 7-11 7.1.12 Write Register 11 (Clock Mode Control) 7..14 7.1.13 Write Register 12 (Lower Byte of Baud Rate Generator Time Constant) 7-15 7.1.14 Write Register 13 (Upper Byte of Baud Rate Generator Time Constant) 7-16 7.1.15 Write Register 14 (Miscellaneous Control Bns) 7-16 7.1.16 Write Register 15 (External/Status Interrupt Control) 7-17 7.2 READ REGISTERS 7-18 7.2.1 Read Register 0 (Transmit/receive buffer Status and External Status) 7-18 7.2.2 Read Register 1 7-20 7.2.3 Read Register 2 7-21 ~\ 7.2.4 Read Register 3 7-21 7.2.5 Read Register 8 7-21 7.2.6 Read Register 10 7-21 7.2.7 Read Register 12 7-22 7.2.8 Read Register 13 7-22 7.2.9 Read Register 15 7-22 ~ CHAPTER 8 SCC APPLICATION NOTES 8-1 8.1 Z8530 and Z8030 SCC Initialization: A Worksheet 8-1 8.1.1 Introduction 8-1 8.1.2 Register Overview ... 8-1 8.1.3 Initialization Procedure 8-1 8.1.4 Initialization Table Generation 8-1 8.1.5 Reset Conditions 8-4 8.2 Polled Asynchronous Mode 8-4 8.2.1 Introduction 8-4 8.2.2 SCC Interface 8-4 8.2.3 SCC Innialization 8-4 8.2.3.1 SCC Operating Mode Programming 8-5 8.2.3.2 sec Operating Mode Enables 8-5 8.2.4 Transmit and Receive Routines 8-5 8.3 Interrupt Without INTACK Asynchronous Mode 8-6 8.3.1 Introduction 8-6 8.3.2 sec Interface 8-6 8.3.3 sce Innialization 8-7 8.3.3.1 sce Operating Mode Programming 8-7 8.3.3.2 SCC Operating Mode Enables 8-8 8.3.3.3 SCC Operating Mode Interrupts 8-8 8.3.4 Interrupt Routine 8-8 ~ I iii PREFACE Thank you for your interest in the SCC, one of the you will want to read the Applications Section in most versatile and most popular Serial Data Chapter 8, and the Interrupt Routine Section in the Communications ICs. This manual is intended to same chapter. provide answers to all technical questions about the Z8030 and the Z8530, the two slightly differ- If you are programming a system using the SCC, ent versions of the SCC. The Product Specifi- you will be more interested, on the worksheet in cation, document 00-2439-01, contains ac and dc Chapter 8. characteristics. Please ready this Preface where we try to anticipate your questions. Points To Watch Out For: • If you are new to serial data communications, you 1. Follow the worksheet for initialization (Chapter will need additional tutorial information. Of the 8.1). Unexplainable operations may occur if many introductory texts on this subject, this procedure is not followed. Technical Aspects of Data Communications by John E. McNamara, published by Digital Press 2. Watch out for Write Recovery time violation (DEC) 1982, is one of the best. (Chapter 3). Both the CPU clock rate and the SCC clock rate will affect the Write Recovery • If you have designed with simpler UARTs and time. USARTs, and HDLC/SDLe devices, the SCC offers you far greater flexibility, but also requires 3. Ensure Mode bits are not changed when an in-depth study and understanding of the writing Commands. (Chapter 8.1.2). Each impact and the use of its many powerful Mode bit affects only one function and a ~ features. This manual contains important Command bit entry requires a rewrite of the \ information. entire register; therefore, care must be taken to insure the integrity of the Mode bits whenever • If you are familiar with the Z80-SI0, you will feel a new command is issued. right at home with the SCC, for it is really a functionally enhanced superset of the Z80-SI0. 4. Data must be valid prior to falling edge of WR or OS. Most users read only chapters that are of interest to them. If you are designing the microcomputer 5. If not used, INTACK should be tied high. hardware structure using the SCC as a peripheral, v \"" ,,,~ ./ ':..,-. i(~ .-~..f ' ".\ ." • - :.. • .. t • • ~ ••' CHAPTER 1 GENERAL INFORMATION 1.0 INTRODUCTION 1.1 CAPABILITIES The SCC Serial Communications Controller is a Two independent full-duplex channels. dual-channel, multiprotocol data communications peripheral designed for· use with 8- and 16-bit Synchronousllsosynch~onous data rates: microprocessors. The SCC functions as a serial-to- parallel, parallel-to-serial converter/controller. The • Up to 1/4 of the PCLK (Le., 1 Mbitlsec. maximum SCC can be software-configured to satisfy a wide data rate with 4 MHz PCLK. Using external variety of serial communications applications. The phase-lock loop. device contains a variety of new, sophisticated • Up to 375 Kbitlsec. with a 6 MHz clock rate. Up internal functions including on-chip baud rate to 250 Kbitlsec. with a 4 MHz clock rate (FM generators, digital phase-lock loops, and crystal encoding using digital phase-locked loop). oscillators, which dramatically reduce the need for • Up to 187.5 Kbitlsec. with a 6 MHz clock rate Up extemallogic. to 125 KbiVsecond with a 4 MHz clock rate (NRZI encoding using digital phase-locked loop). The SCC handles asynchronous formats, Synchronous byte-oriented protocols such as IBM Asyn~hronous capabilities: Bisync, and Synchronous bit-oriented protocols such as HDLC and IBM SDLC. This versatile • 5, 6, 7, or 8 bits per character device supports virtually any serial data transfer • 1,1-1/2, or2 stop bits application (telecommunications, cassette, disk- • Odd or even parity eUe, tape drivers, etc.). • Times 1, 16, 32, or 64 clock modes • Break generation and detection The device can generate and check CRC codes in • Parity, overrun and framing error detection. any Synchronous mode and can be programmed to check data integrity in various modes. The SCC Byte-oriented synchronous capabilities: also. has facilities for modem controls in both channels. In applications where these controls are o Internal or external character synchronization not needed, the modem controls can be used for • 10r 2 sync characters (6 or 8 bits/character) in general-purpose I/O. separate registers • Automatic Cyclic redundancy check (CRC) gen- With access to 14 Write registers and 7 Read eration/detection registers per channel, the user can configure the SCC so that it can handle all asynchronous formats SDLC/HLDC capabilities: regardless of data size, number of stop bits, or parity requirements. The SCC also accommodates • Abort sequence generation and checking all synchronous formats· including character, byte, • Automatic zero insertion and deletion and bit-oriented protocols. o Automatic flag insertion between messages • Address field recognition Within each operating mode, the SCC also allows • I-field residue handling for protocol variations by checking odd or even • CRC generation/detection parity bits, character insertion or deletion, CRC • SOLC loop mode with EOP recognition/loop generation and checking, break and abort gener- entry and exit. ation and detection, and many other protocol- dependent features. Receiver data registers quadruply buffered. Transmitter data registered The SCC is offered in two versions. The Z8030 is double buffered. directly compatible with the Z8000 and 8086 CPUs. The Z8530 is designed for non-multiplexed NRZ, NRZI, or FM encoding/decoding. buses and is easily interfaced to CPUs such as the 8080, Z80, 6800, 68000 and *Multibus. Baud-rate generator in each channel. 1-1 Digital phase-locked loop for clock tional lines used to transfer data between recovery. the CPU and the SCC (Addresses in the 28030 are latched by AS). The direction of these lines Crystal oscillator. depends on whether the SCC is selected and whether the operation is a Read or a Write. 1.2 BLOCK DIAGRAM The Timing and Control groups designate tne type of transaction to occur and when this transaction Figure 1-1 and Figure 2-1 are block diagrams of the will occur. The Interrupt group provides inputs and SCC. Received data enters the receive data pins outputs to conform to the Z-BUS specifications for and follows one of several data paths, depending handling and prioritizing interrupts. The remaining on the state of the control logic. The contents of groups are divided into Channel A and Channel B the registers and the state of the external control groups for serial data (transmit or receive), pins establish the internal control logic. peripheral control (such as DMA or modem), and Transmitted data 'follows a similar pattern of control, the input and output lines for the receive and register, and external pin definition. transmifclocks. 1.3 PIN FUNCTIONS 1.4 PIN DESCRIPTIONS The SCC pins are divided into seven functional The see is available with two sets of bus interface groups: Address/Data, Bus Timing and Reset, timings: one for multiplexed systems and one for Device Control, Interrupt" Serial Data (both nonmultiplexed. channels), Peripheral Control (both channels), and Clocks (both channels). Figure 1-2, 1-3 show the The pin descriptions here describe the Z8030- pins in each functional group 'for both the 28030 specific pins, the Z8S30-specific pins, and the pins and Z8530. Notice the pin functions unique to that are identical for both versions. Figure 1-3 each version in the Address/Data group~ Bus designates the pin locations and signal names for Timing and Reset group, and Control groups. the Z8030 SCC. Figure 1-4 designates the pin locations and signal names for the Z8S30 SCC The Address/Data group consists of the bidirec- version. } SERIAL DATA . . - J CHANNEL CLOCKS SYNC WAIT/REQUEST INTERNAL CONTROL LOGIC .....- }' MODEM. DMA. OR OTHER CONTROLS ADDRESSI~ DATA~ CPU BUS 110 CONTROL ...--} MODEM. DMA. OR ,OTHER CONTROLS INTERRUPT INTERRUPT CONTROL CONTROL LINES LOGIC ) SERIAL OATA ..- I t 11 +5 V GND PCLK CHANNEL CLOCKS SYNC WAIT/REQUEST ~" 07613A 1-1 Figure 1-1 Z-SCC Block Diagram 1-2 1.4.1 Pin Descriptions (Z8030 see only) bus transaction to OCCUL ' AOQ-A07. Address/Data Bus (bidirectional, active cs1. Chip Select 1 (input, active HIGH). This HIGH 3-state). These muttiplexed lines carry second select signal must also be ,active before register addresses to the SCC as well as data or the intended bus transaction can occur. CS1 must control information to and from the SCC. remain active throughout the transaction. AS. Address Strobe (input, active LOW). Addres- os. Data Strobe (input, active LOW). This signal ses on ADo-AD7 are latched by the rising edge of provides timing for the transfer of data into and out this signal. of the sec. If AS and OS are both LOW, this is interpreted as a Reset. CSo. Chip Select 0 (input active LOW). This signal is latched concurrently with the addresses RIW. ReadlWrite (input, Read active HIGH). This on AOQ-AD7 and must be active for the intended signal specifies whether the operation to be ........ ........ AD7 TxDA } SERIAL DATA ....... ........ 07 TxDA } SERIAL ADs RxDA 06 RxDA . . . - DATA ........ ADs TRxCA fiiiCA ....... } CHANNEL 05 } CHANNEL ADDRII., DATA BUS ..-. ...... ....-. AD. 'AD 3 AD2 iiTiCA SYiiCA W/REQA CLOCKS CHANNEL CH.A DATA BUS ....... D• 03 02 RTiCA SYNCA W/REQA ...... CLOCKS CHANNEL CH·A CONTROLS CONTROLS' ,~. ....... AD 1 ADo AS iifiiiREQi RTSA FOR MODEM, DMA,OR ....-. Do 01 DTRiiiEQA RTSA FOR MODEM, DMA,OR BUS { - . . CT$A OTHER BUS {---. Fffi CTSA ~ OTHER TIMING os DCDA TIMING WR DCDA ...- I:: 1= AIIDRESET - . . AND RESET - - - . RNi TxDB AlB TxDB } SERI~L CONTROL CS, RxOB CE RxOB . . . - DATA CONTROL CSo TiiiCi D/C TRxCB I=: } CHANNEL iNT RTxCB iNT RTxCB CLOCKS INTACK SYNCB INTACK SYNCB INTERRUPT I: : lEI WiiiEQi CHANNEL CH·B INTERRUPT lEI W/REQB CHANNEL CH·B lEO DTR/REQB CONTROLS lEO OTR/REOB CONTROLS FOR MODEM, FOR MODEM, RTSB DMA,OR RTSB DMA, OR Z8030 CTSB OTHIR Z8530 CTSB OTHER z-see DCDB z-see DCOB t +5V GND PCLK +5 V t t GND PCLK Figure 1·2 Pin Functions SCC/AmZ-SCC AD, 1 40 ADo 01 40 Do AD3 2 39 AD2 03 39 O2 ADs 3 38 AD. 05 38 D. AD 7 4, 37 ADs 07 37 Os iNT 5 36 os iNT 36 AD lEO 8 35 AS lEO 35 WR lEI 7 34 RtW lEI 34 Ai,B iNTACK 8 33 CSo INTACK 8 33 CE +5V 9 32 CS1 +5V 9 32 D/C W/REQA 10 Z8030 31 GND Z8530 W/REQA 10 31 GNO SYNCA 11 z-sec 30 W/REQB z-sec SYNCA 11 30 W/REQB RTxCA 12 29 SYNCB RTxCA 12 29 SYNCB RxOA 13 28 RTxCB RxOA 13 28 RTxCB TRxCA 14 27 RxDB TRxCA 14 27 RxDB TxDA 15 26 TRxCB TxDA 15 26 TRxCB DTR/REQA 16 25 TxDB DTR/REQA 16 25 TxOB RTSA 17 24 OTR/REQB RTSA 17 24 DTR/REQB CTSA 18 23 RTSB CTSA 18 23 RTSB 07613A 1-3 DCDA 19 22 CTSB DCDA 19 22 ~ CTSB PCLK 20 21 DCDB PCLK 20 21 07613A 1-4 I DCDB Figure 1-3 Pin Designation for AmZ8030 see Figure 1-4 Pin Designation for AmZ8530 see 1-3 performed is a Read or a Write. puts (transmit) or as request lines for the DMA con- troller. The SCC allows full duplex DMA transfers. 1.4.2 Pin Descriptions (Z8530 see only) lEI. Interrupt Enable In (input, active HIGH). lEI is used with IEO to form an interrupt daisy chain AlB. Channel AlChannel B Select (input, Chan- when there is more than' one interrupt-driven nel A active HIGH). This signal selects the channel device. A HIGH on lEI indicates that no other in which the Read or Write operation occurs. higher priority device has an Interrupt Under Service (IUS) or is requesting an interrupt.' CEo Chip' Enable (input, active LOW). This sig- nal selects the SCC for operation. It must remain lEO. Interrupt Enable Out (output, active HIGH). active throughout the bus transaction. lEO is HIGH only if lEI is HIGH and the CPU is not servicing an SCC or SCC interrupt or the controller 00-07. Data Lines (bidirectional, 3-state). is not requesting an interrupt (interrupt These I/O lines carry data or control information to acknowledge cycle only). lEO is connected to the and from the SCC. next lower priority device's lEI input and thus inhibits interrupts from lower priorny devices. O/C. DatalGontrol (input, Data active HIGH). This signal defines the type of information transfer per- INTACK. . Interrupt Acknowledge (input, active formed by the SCC: data or control. LOW). This signal indicates an active interrupt acknowledge cycle. During this cycle, the interrupt RD. Read (input, Active LOW). This signal indi- daisy chain settles. When RO or OS becomes cates a Read operation and when the SCC is active, the SCC places an interrupt vector on the selected, enables the SCC bus drivers. During the data bus (if lEI is HIGH). INTACK is latched by the ~" interrupt acknowledge cycle, this signal gates the rising edge otAS or PCLK. interrupt vector onto the bus if the SCC is the highest priority device requesting an interrupt. INT. Interrupt Request (output, open-drain, ac- tive LOW). This signal is activated when the SCC is WR. Write (input, active LOW). When the SCC is requesting an interrupt selected, this signal indicates a Write operation. The coincidence of RD and WR is interpreted as a PCLK. Glock (input). This is the master clock Reset. used to synchronize internal signals. PCLK is not required to have any phase relationship with the master system clock. PCLK is a TIL level signal. 1.4.3 Pin Descriptions (both Z8030 and Z8530) RTSA, RTSS. Request to Send (outputs, ac- CTSA, CTSS. Clear to Send (inputs, active LOW). tive LOW). When the Request to Send (RTS) bn If these pins are programmed as auto enables, a in Write Register 5 (Figure 7-7) is set, the RTS LOW on these inputs enables the respective signal goes LOW. When the RTS bit is reset in the transmitters. If not programmed as auto enables, Asynchronous mode and auto enables is on, the they may be used as general-purpose inputs. signal goes HIGH after the transmitter is empty. In 80th inputs are Schmitt-trigger buffered to Synchronous mode or in Asynchronous mode accommodate slow rise-time inputs. The SCC with auto enables off, the RTS pins strictly follow detects transitions on these inputs and can the state of the RTS bit. 80th pins can be used as interrupt the CPU on either logic level transitions. general-purpose outputs. OCOA, DCOS. Data Carrier Detect (inputs, active RTxCA, RTxCB. ReceivelTransmit Clocks (in- LOW). These pins function as receiver enables if puts, active LOW). The functions of these pins they are programmed as auto enable bits; are under program control. In each channel, RTxC otherwise they may be used as general-purpose may supply the receive clock, the transmit clock, input pins. 80th pins are Schmitt-trigger buffered the clock for the baud rate generator, or the clock to accommodate slow rise-time signals. The SCC for the digital phase-locked loop (refer to Section 4 detects transitions on these pins and can interruptfor bit configurations). These pins can also be the CPU on enher logic level transnions. programmed for use the the respective SYNC pins O~lrL(,T as a crystal oscillator. The receive clock may be 1, OTR/REQA, OTR/REQS. Data Carrier Detect (lair 16, 32, or 64 times the data rate in asynchronous _ , active LOW). These pins function as receiver modes. enables if they are programmed into the OTR bit. They can also be used as general-purpose out- RxDA, RxDB. Receive Data (inputs, active HIGH). 1--4 These input signals receive serial data at standard not latched, so these outputs are active each time TTL levels. a sync character is recognized (regardless of character boundaries). In SOLC mode, these pins I~· SYNCA, SYNCB. Synchronization (inputs/out- act as outputs and are valid on receipt of a flag. puts, active LOW). These pins can act as either inputs, outputs, or as part of the crystal oscillator TRxCA, TRxCB. Transmit/Receive Clocks (in- circuit. In the Asynchronous Receive mode puts or outputs, active LOW). The functions of (crystal oscillator option not selected), these pins these pins are under program control. TRxC may are inputs similar to CTS and OCD. In this mode, supply the receive clock or the transmit clock in the transitions on these lines affect the state of the Input mode or supply the output of the digital Sync/Hunt status bits in Read Register 0 (Figure 7- phase-locked loop, the crystal oscillator, the baud 18), but have no other function. rate generator, or the transmit clock in the output mode. (Refer to Section 4 for bit configuration.) In External Synchronization mode with the crystal oscillator not selected, these lines also act as TxDA, TxDB. Transmit Data (outputs, active inputs. In this mode, SYNC must be driven LOW HIGH). This output signal transmits serial data at two receive clock cycles after the last bit in the sync standard TTL levels. character is received. Character assembly begins on the rising edge of the receive clock immediately W/REQA, W/REQB. Wait/Request (outputs, preceding the activation of SYNC. open drain when programmed for Wait function, driven HIGH or LOW when programmed for a In the Internal Synchronization mode, (Monosync Request function). These dual-purpose outputs and Bisync) with the crystal oscillator not selected, can be programmed as Request (receive) lines for these pins act as outputs and are active only dur- a OMA controller or as Wait lines to synchronize the ,~ ing the part of the receive clock cycle in which sync CPU to the SCC data rate. The reset state is Wait. characters are recognized. The sync condition is The SCC allows full duplex DMA transfer. 1-5 ~ r-.' '. ;'''''-._--,0 ;" '.·.:';:·;:1:':; o( i: /~ / CHAPTER 2 OVERVIEW 2.0 INTRODUCTION Table 2-1 Register Set The SCC internal structure provides all the Read Register Functions interrupt and control logic necessary to interface RRO Transmit/Receive buffer status, and External with" multiplexed and non-multiplexed' buses. status Interface logic is also provided to monitor modem RR1 Special Recieve Condition status, residue or peripheral control inputs and outputs. All of the codes, error conditons control signals are general purpose and can be RR2 Modified (Channel 8 only) interrupt vector applied to various peripheral devices as well as and Unmodified interrupt vector (Channel A used for modem control. only) RR3 Interrupt Pending bits (Channel A only) The ce.nter for data activity revolves around the RR8 Receive buffer internal read and w"rite registers. The programming RR10 Miscellaneous XMTR, RCVR status parameters of these registers provides the SCC with functional RR12 Lower byte of baud rate generator time constant "personality"; Le., register values can be assigned RR13 Upper byte of baud rate generator time constant before or during program sequencing to RR15 External/Status interrupt control determine how the SCC will establish a given information communication protocol. Write Register Functions, 2.1 REGISTER FUNCTIONS WRO "Command Register, (Register Pointers, Z8530 only), CRC initialization, resets for various All modes of communication are established by the modes bit values of the write registers. As data is received WR1 Interrupt conditions, Wait/DMA request control or transmitted, read register values may change. WR2 Interrupt vector (access through either channel) These changed values can promote software WR3 Receive/Control parameters, number of bits per action or internal hardware action for further character, Rx CRC enable register changes. . WR4 Transmit/Receive miscellaneous parcameters and codes, clock rate, number of sync The register set for each channel includes 14 write characters, stop bits, parity registers and seven read registers. Ten write WR5 Transmit parameters and control, number of Tx registers are used for control, two for sync charac- bits per character, Tx CRC enable WRG Sync character (1 st byte) or SDLC flag ter generation, and two for baud rate generation. WR8 Transmit buffer In addition there are two write registers' which are WR9 Master interrupt control and reset (accessed shared by both channels; one is thein~errupt through either channel), reset bits, 'control vector register and one is the master interrurpt interrupt daisy chain control and reset register.. Four read registers WR10 Miscellaneous transmitter/receiver control bits, indicate status information, two are for baud rate NRZI, NRZ, FM encoding, CRC reset generation, and one for the receive buffer. In WR11 Clock mode control, source of Rx and Tx clocks addition there are two read registers which are WR12 Lower byte of baud rate generator time constant shared by both channels; -one for the interrupt WR13 Upper byte of baud rate generator time constant pending bits and one for interrupt vector. WR14 Miscellaneous control bits: baud rate generator, Phase-Locked Loop control, auto echo, local Table 2-1 lists the assigned functions for each read loopback WR14 External/Status interrupt control information- . and write register. The SCC contains only one control external conditions causing interrupts WR2 (interrupt vector) and one WR9 (master inte- rrupt control). Both registers are accessed and shared by either channel. Chapter 7 provides a de- tailed bit legend and description of each register. 2-1 2.2 DATA PATHS r~gister ..This arrangement creates a 3-byte delay time, which allows the CPU time to service an Figure 2-1 illustrates the data paths involved in the interrupt at the beginning of a block of high-speed six major areas of the SCC: data. With each Receive Data FIFO, the Error FIFO ~. stores parity and framing errors and other types of • Transmitter status information. The Error FI Fa is readable in • Receiver Read Register 1. • Baud rate generator Incoming data is routed through one of several • DPLL paths depending on the mode and character • Clocking options length. In ·Asynchronous mode. serial data enters • Data encoding.. the 3-bit delay (Figure 2-1) if the.characte:r length of seven or eight bits is selected. If a character length of five or six bits is selected, data enters the All communication modes are established by receive shift register directly. programming the write registers. As. data is received or transmitted. read register values may In sy~chronous modes, the data path is change. altering the direction of the data path. determined by the phase of the receive process These changed values can promote software currently ,in operation. A synchronous receive action or internal hardware action for further operation begins with a. hunt phase in which a bit register changes. pattern that matches the programmed sync characters {6-. 8-. or 16-bit is searched. . 2.2.1 Transmitter The incomi,ng data then passes, through the Sync ~egister and is compared to a sync character stored The.transmitter has an 8-bit Transmit Data register In WR6 or WR7 (depending on which mode it is in). (WR8) loaded from the internal data bus and a The Monosync mode matches the sync character Transmit Shift register loaded from either WR6. programmed in WR7 and the character assembled WR7. or the Transmit Data register. In byte- in the. Receive Sync .register to establish oriented modes. WR6 and WR7 can be synchronization. programmed with sync characters. In Monosync mode. an 8-bit or 6-bit sync character ,is used Synchronization is achie'{ed, differently in the (WR6). whereas a 16-bit sync character is used Bisync mode. Incoming data is shifted to the (WR6 and WR7) in Bisync mode. In bit-oriented Receive Shift register while the next eignt bits of synchronous modes. the flag contained in WR7 is the message are assembled in the Receive Sync loaded into the Transmit Shift register at the register. If these two .. characters match the beginning and end of a message. . programmed characte.rs in WR6 and WR7. synchronization is established. Incoming data can If asynchronous data is processed, WR6 and WR7 then bypass the· Receive Sync, register and enter are not used and the Transmit' Shift register is .the 3-bit delay directly~ formatted with start. and stop bits shifted out to the transmit multiplexer at the sele.cted clock rate. The SOLC mode of operation uses the Receive Synchronous data (except SOLC/HOLC) is shifted Sync. register to.monitor the receive data stream to the CRC generator as well as to the transmit and to perform zero deletion when necessary; Le.• multiplexer. when. five continu.ous "1 s" are received. ,the sixth bit is· inspected and deleted from the data ,stream if SD~C/HOLC data iS~'shifted to the CRC Generator , it is "0." The seventh bit is .inspected only if the and out through the zero insertion logic (which is sixth bit equals·one. If the seventh bit is ~ro," a flag disabled while the flags are being sent). A "0" is sequence has been received and the receiver is inserted in all address. control. information, and synchronized to that flag. If the seventh bit is a "1," frame check fields following five contiguous "1 s" in an abort or an EOP (End Of Poll). is recognized. the data stream. The result of the CRC generator depenqing on the selection of either the normal for SOLC data is also routed through the zero "SOLC mode or SOLC Loop mode. insertion logic and then to the transmn multiplexer. The same path is taken by incoming data for both 2.2.2 Receiver SDLC modes. The reformatted data enters the 3- bit delay and is transferred to the Receive Shift The receiver has a three deep 8-bit Data FIFO register. The SOLC receive operation begins in (paired with an 8-bit Error FIFO). and an 8-bit shift the hunt phase by attempting to match the 2-2 ) ) ) ) CPUUO BR GENERATOR BR GENERATOR INPUT OUTPUT t +16 +32 N +64 W TRANSMIT CLOCK R.O BR GENERATOR OUTPUT RECEIVE CLOCK OPLL---+I I OPLL OUTPUT CLOCK TRANSMIT CLOCK fAxC MUX ATlle OPLL CLOCK BR GENERATOR CLOCK SYNC (OSCILLATOR) 07513A 2-1 Figure 2-1 Data Paths assembled character in the Receive Shift Register new time constant with the clock used to drive the with the flag pattern in WR7. Then the flag generator. When the time constant is to be character is recognized, subsequent data is routed changed, the generator should be stopped by through the same path, regardless of character writing to an enable bit in WR14. This ensures the length. loading of a correct time constant. Either the CRC-16 or CRC-SOLC cyclic If neither the transmit clock nor the receive clock redundancy check (CRC) polynomial can be used are programmed to come from the TRXC pin, the for both Monosync and Bisync modes, but only output of the baud rate generator ma~made the CRC-SOLC polynomial is used for SOLC available for external use on the TRXC pin. operation. The data path taken for each mode is Section 3.9 presents the formula for determining also different. Bisync protocol is a byte-oriented the time constant for a given baud rate. operation that requires the CPU to decide whether or not a data character is to be included 'in CRC calculation. An 8-bit delay in all synchronous 2.2.4 Digital Phase-Locked Loop (DPLL) modes except SOLC is allowed for this process. In SOLC mode, all bytes are included in the CRC The SCC contains a digital phase-locked loop that calculation. can be used to recover clock information from a data stream with NRZI or FM coding. The OPLL is driven by a clock nominally 32 (NRZI) or 16 (FM) 2.2.3 Baud Rate Generator times the data rate. The OPLL uses this clock, along with the data stream, to construct a receive Each channel in the SCC contains a programmable clock for the .data. This clock can then be used as baud rate generator. Each generator consists of the SCC receive clock, the transmit clock, or both. two 8-bit, time-constant registers forming a 16-bit Section 3.10 details the clock recovery for each of time constant, a 16-bit down counter, and a flip- the different forms of encoding. flop on the output that makes the output a squ are wave. On start-up, the flip-flop on the output is set High so that it starts in a known state, the value in 2.2.5 Clocking Options the time-constant register is again loaded into the counter, and the counter begins counting down. The SCC can select several clock sources for When a count of zero is reached, the output of the ' internal and external use. Write Register 11 is the baud rate generator toggles, the value in the time- Clock Mode Control register for both the receive constant register is loaded into the counter, and and transmit clocks. It determines the type of the process starts over. The time constant can be signal on the SYNC and RTxC pins and the changed at any time, but the new value does not direction of the TRxC pin. take effect until the next load of the counter. Write Register 11 also controls the output of the No attempt is made to synchronize the loading of a baud rate generator, the OPLL output, and the 07666A 2-2 Figure 2-2 Data Encoding Methods 2-4 selection of either a TI1 or XTAL output for the notifying the receiver of an incoming message. RTxC pin. (Section 3.11 gives a detailed description of the clocking options.) The start bit also initiates a clock 'circuit to provide latching pulses during expected data bit· intervals. The parity bit is provided for error checking. The 2.2.6. Data Encoding parity bit is calculated in both the receiver and the transmitter; the two results are compared to ensure Figure 2-2 illustrates the four encoding methods that the expected and the' actual bit values match. used by the ·SCC. In NRZ encoding, a "1" is represented by a High level and a ClO" is The stop bit returns the "message unit to the represented by a Low level. In NRZI encoding, a quiescent marking state; Le.,· a constant high state "1" is represented by no change in level and a "0" condition lasts until the next High-to-Low start bit is represented by a change in level. In FM1 (more indicates an incoming data byte. During reception, properly, biphase mark), a transition occurs at the the start and stop bits are stripped away and beginning of every 'bit cell. A "1" is represented by checked for errors, leaving only the working data an additional transition at the center of the bit cell for CPU interaction. The number of selected bits and a "0" is represented by the absence of a for each asynchronous function may differ transition at the center of the bit cell. In' FMO (more between the transmitter and the receiver. properly, biphase space), a transition occurs at the beginning of every bit cell. A "0" is represented by an additional transition at the center of the bit cell 2.3.2 Monosync Mode and ·a "1" is represented by the absence of a transition at the center of the bit cell. Monosync and Bisync modes require clocking information to be transmitted along with the .data In addition to these four methods, the SCC can be either by a method of encoding data that contains used to decode Manchester (biphase level) data clocking information, or by a modem that encodes by using the DPLL in the FM mode and program- or decodes clock information in the modulation ming the receiver for NRZ data. Manchester process. encoding always produces a transition at the center of the bit cell. If the transition is Low to Start and stop bits are not required in synchronous High, the bit is "0." ·If the transition is High to Low, modes. All bits are used to transmit data. This the bit is "1." eliminates the ''waste'' characteristic of' asynchro- nous communication. 2.3 DATA COMMUNICATIONS CAPABILITIES Figure 2-4 shows the character format for synchro- nous transmission. For example, bits 1-8 might be SCC logic handles all asynchronous, byte-oriented one character and bits 9-13 part of another synchronous, and bit-oriented synchronous character; or bit 1 might be part of one character, modes of operation. The following section briefly bits 2-9 part of a second character, and bits 10-13 describes asynchronous, synchronous, and SOLC part of a third character. The framing (where each modes of communication. character begins) of each character is accom- plished by defining a synchronization character, commonly called a "sync character." 2.3.1 Asynchronous The CPU places the receiver in Hunt mode Figure 2-3 represents a typical asynchronous whenever transmission begins (or whenever a data message format using one start bit, seven data dropout has occurred and the hardware bits, one parity bit, and one stop bit. A start bit is a determines that resynchronization is necessary). High-to-Low transition detected by an asynchro- In Hunt mode, the receiver shifts a bit into the nous receiver and is actually an information' bit Receive Shift register and compares the contents X a HIGH OR LOW 07666A 2-3 figure 2-3 Asynchronous Message Format 2-5 of the .Receive Shift register and with the sync In SOLC mode, a secondary station can be the character (stored in another register), repeating initiator. the process until a match occurs. When a.match occurs, the receiver. begins transferring bytes to The basic format for SDLC is a "frame" (Figure 2-7). the receive FIFO. ' The information field is not restricted in format or content and can be of any reasonable length (including zero). Its maximum length is that which 2.3.3 Bisynchronous Mode can be expected to arrive at the receiver error- free most of the time. Hence, the determination of The Bisync mode of operation (Figure 2-5) is maximum length is a function of communication ~imilar .to the Monosync mode, except that two channel error rate. sync characters are provided instead of one. Bisync attempts a more structured approach to The two flags that delineate the SOLC frame serve synchronization through the use of special as reference points when positioning the address characters as message "headers" or "railers". A and control fields,· and they initiate the detailed description of IBM's Bisync can be found transmission error check. The ending flag in McNamara's Book (See Preface). indicates to the receiving station that the 16 bits just received constitute the frame check. The ending flag could be fol1owed by another frame, 2.3.4 External Sync Mode another flag, or an idle. This means that when two frames follow one another, the intervening flag External Sync mode (Figure 2-6) eliminates the may simultaneously be the ending flag of the first use of sync characters· in the serial data stream by frame and the begin-ning flag of .the next frame. providing an external sync signal to mark the Since the SOLC mode does not use characters of beginning of a data field; Le., an external input pin defined length, but rather works on a bit-by-bit (Sync), waits for an .active state change to indicate basis, the 01111110 (7EH) flag can be recognized the beginning of an information field. at anytime. To ensure that the flag is· not sent accidentally, 2.3.5 SOLe Mode SOLC procedures require a binary "0" to be inserted by the transmitter after the transmission of Synchronous Data Link Control mode (SOLC) any five contiguous "1 s." The receiver then re- uses synchronization characters similar to Bisync moves the "0" following a received succession of and Monosync modes (such as flags and pad five "1 s." Inserted and removed "Os" are not in- characters), but it is a bit-oriented protocol instead cluded in the CRC calculation. of byte-oriented protocol. The address field is 8 bits long and designates the Any data communication link involves at least two number of secondary station to which the com- stations. The station that is responsible for the mands or data from the primary .station are sent. data link and issues the commands to control the The control field is eight bits long and is used to link is called the "primary station." The other initiate all SOLC activ~ies (see Section 3.6). station is a "secondary station." Not all information transfers need to be initiated by a primary station. The see can also serve the High-level synchro- ---.J ~ 1 BIT TIME MODEM CLOCK BIT 10 11 12 13 .... BIT STATE 0 DATA I I 1.1------ SYNC CHARACTER ------.~I...- ------- DATA CHARACTER ------l~ ..... I I 07666A 2-4 Figure 2-4 Monosync Data Character Format 2-6 nous Data Link Communication (HOLC) protocol, EOP to· a uO~' before· transmitting it. This turns the which is identical to SOLC. except for differences EOP into a Flag sequence. The secondary station in framing. now places its message on the loop and ,~ terminates its message with an EOP. Any secon- dary stations further down the loop with messages 2.3.6 SOLe Loop Mode to transmit can then append its message to the message of the first secondary station by the same The SCC supports SOLC Loop mode in ,addition to process. All secondary stations without messages normal SOLC. SOLC Loop mode is very similar to to send merely echo the incoming messages and norm,al SOLC but is usually used in application are prohibited from placing messages on the loop, where a point-to-point network is not appropriate except upon recognizing an EOP. (for example, Point-Of-Sale terminals). In an SOLe Loop there is a primary station, called the There are also restrictions as to when and how a controller, that manages the message traffic flow secondary station physically becomes part of the on the loop, and there are any number of loop. A secondary station that has just powered secondary stations. up must monitor the loop, without the one- bit-time delay, until it recognizes an EOP. When an EOP is A sec9floary station in an SOLC loop is always recognized the one-bit-time delay is switched on. listening to the messages being sent around the This does not distu rb the loop because the line is loop, and must pass these messages to the rest of marking idle between the time that the controller the loop by retransmitting them with a one-bit- time sends the EOP and the time that it receives the delay. The secondary station can only place its EOP back. The secondary station that has gone own message on the loop at specific times. The on-loop cannot place a message on the loop until controller signals that secondary stations may the next time that an EOP is issued by the transmit messages by sending a special character, controller. A secondary station goes off-loop in a called an EOP (End of Poll), around the loop. The similar manner. When given a command to go off- EOP character is the bit pattern 11111110. loop, the secondary station waits until the next Because of zero insertion during messages this bit EOP to remove the'one-bit-time delay. pattern is unique and thus is easily recognized. To operate the see in SOLC Loop mode, the sec When a secondary station has a message to must first be programmed just as if normal SOLe transmit and it recognizes an EOP on the line, the were to be used. Loop mode is then selected by first thing. that it does is to change the last 1 or the writing the appropriate control word in WR10. The El EJ B IB HEADER TEXT ......----DIRECTION OF SERIAL DATA FLOW ~ 07666A 2·5 Figure 2-5 Bisynchronous Message Format SIGNAL Ee~ EXTERNAL SYNC 07666A 2·6 Figure 2-6 External Sync Format 07666A 2·7 Figure 2-7 SOLe Message Format 2-7 sec is now waiting for the EOP so that it can go on The. sec allows the user the option of using NRZI loop. While waiting for the EOP, the sec ties'TxD in SOLe Loop mode by programming WR20 to RxD with only the intemal· gate delays in the appropriately. With NRZI encoding, the outputs of signal path. When the first EOP is recognized by secondary stations in the loop may be inverted the sec,. the, Break!AbortlEOP bit is set in RRO, from their inputs because of messages that they generating an External/Status interrupt (if so have transmitted. Removing the stations from the enabled). At the same time, the On-Loop bit in loop (removing the one-bit time delay) may cause HR10 is set to indicate thatthe sec is indeed on- problems further down the loop because of extran- loop, and a one-bit time delay is inserted in the TxD eoustransitions on the line. The sec avoids this to the RxD patch. ' problem by making' transparent adjustments at the end of each frame it sends in response to an EOP. The sec is now on-loop but cannot transmit a A response frame from the sec is terminated by a message until a flag and the next EOP are flag and an EOP. Normally, the flag and the EOP received. The requirement that a flag be received share a zero, but if such sharing would cause the ensures that the sec cannot· erroneously send RxD and TxD pins to be of opposite polarity after messages. until the controller ends the current the EOP, the sec adds another zero between polling sequence and starts another one. the flag and the EOP. This causes an extra line transition so that Rxb and TxD are identical after A secondary station on the loop is prohibited from the EOP is sent. This extra zero is completely transmitting a message during a polling sequence transparent because it only means that the flag and unless it captures the line.at the moment the EOP the EOP no longer share a zero. All that a proper passes by. The sec does this automatically. If the loop exit needs, therefore,- is the removal of the CPU in the secondary station with sec needs to one-bit time delay. transmit a message, the Go-Aetive-On-Poll bit in WR10 must be set If this bit is set when the EOP is detected, the sec changes the EOP to' a flag 2.4 1/0 CAPABILITIES' and starts' sending another flag. The EOP is reported in the Break!AbortlEOP bit in RRO and The sec can work with three basic' forms of I/O the CPU should write its data bytes to the sec, operations: polling, interrupts, and block transfer. just as in normal SOLe frame transmission. When All three I/O types involve register manipulation ~\ the frame is compl.ete and CRe has been sent, the durng initialization and data transfer. However, the sec closes with a flag and reverts to One-Bit-Delay Interrupt mode also incorporates Z-BUS® interrupt mode. The last zero of the flag. along with the protocol for a faster and more efficient data marking line echoed from the RxD pin, form an transfer. EOP for secondary stations further down the loop. If the Go-Active-On-Poll bit is not set at the time the EOP passes by, the sec cannot send a message 2.4.1 'Polling until .a flag (terminating the current polling sequence) and another EOP are received. While During a polling sequence, the status of Read the sec is actually transmitting a message, the Register 0 is examined in each channel. This loop-sending bit in R10 is set to indicate this. register indicates whether or not a receive or transmit data transfer is needed and whether or not If SOLe loop is de-selected, the sec is designed any special condnions are present, e.g., errors. to exit from the loop gracefully. When SOLe Loop mode is de-selected by writing to WR10. the sec This method of I/O transfer avoids interrupts. All waits until the next polling cycle to remove the on- interrupt functions must be disabled in order to bit time delay. If a polling cycle is in progress at the operate the device in a polled environment. With time the command is written, the sec finishes no interrupts enabled, this mode of operation must sending any message that it may be transmitting, initiate a read cycle of Read Register 0 to detect an ends with an EOP, and disconnects TxD from RxD. incoming character before jumping to a data If no message was in progress, the sec immediat- handler routine. ely disconnects TxD from RxD. To ensure proper loop operation after the sec goes off the loop. and until the external relays take the sec 2.4.2 Interrupts completely out of the loop, the sec should be programmed for Mark idle instead of Flag idle. The sec· provides interrupt capability through the When the sec goes off the loop, the On-Loop bit use of pins and a hardware scheme that enhances is reset. the maximum speed of serial data. Whenever the 2-8 interrupt (INT) pin is active, the see is ready to 2.4.3 Block Transfers transfer data. The see provides a Block Transfer mode to Read and write registers are programmed so that accommodate epu block transfer functions and an interrupt vector points to an interrupt service DMA controllers. The Block Transfer mode uses routine. The interrupt vector can also be modified the W/REQ output in conjunction with the to reflect various status conditions. Therefore, as Wait/Request bits in Write Register 1. The \iV/REQ many as eight different interrupt routines can be output can be defined by software as a WAIT line in referenced. the CPU Block Transfer mode or as a REQUEST line in the DMA Block Transfer mode. Transmit interrupts, receive interrupts, and extemaVstatus interrupts are the main sources of To a DMA controller, the sec REQUEST output interrupts. Each interrupt source is enabled under indicates that the SCC is ready to transfer data to or program control, with channel A having a higher from memory. To the CPU, the WAIT output priority than channel B and with receive, transmit, indicates that the SCC is not ready to transfer data, and external/status interrupts prioritized respec- thereby requesting the CPU to extend the I/O tively within each channel. (Section 4 provides a cycle. (Section 3.5 describes the registers used in detailed description of the interrupt scheme and block transfers.) the various interrupt types.) 2-9 ,:~ / .; , '~ .• ,,' ~ t, .!;~ l CHAPTER 3 ~. INTERFACING THE sec 3.0 INTRODUCTION the state of INTACK and CS. In addition to timing bus transactions, AS is used by the interrupt This chapter covers the details of interfacing the section to set ·t~ Interrupt Pending (IP) bits. Z8030 and Z8530 to a system. The general·timing Because of this, AS must be kept cycling for. the requirements for both devices are described but interrupt section to function properly. The Z8030 the respective data sheets must be referred to for generates internal control signals in response to a specific A.C. numbers. register access. Since AS and 0$ have no phase relationship with PCLK, the circuitry generating these internal' control signals provide time for 3.1 INTERFACING THE Z8030 metastable conditions to disappear. This results in a recovery time related to PCLK. This recovery The Z-BUS compatible SCC is suited for system time applies only to transactions involving applications with multiplexed address/data buses the Z8030, and any intervening transactions are similar to the Z800 or Z8. The SCC complies with ignored. This recovery time is four PCLK cycles, Z~BUS protocol established in the Z-BUS Compo- measured from the falling edge of OS in the case nent Interconnect Summary, in the Zilog Data of a read or write of any register other than RR8 or Book, #00-2034-04. WR8. In the case of a read of RR80r a write to WR8, t~ecovery time is measured from the rising Two control signals, AS and OS, are used by the edge of OS. l8030 to time bus transactions. In addition, four other control signals (CS1 , CS1, R/W, and INTACK) are used to control the type of bus 3.1.1 Z8030 Read Cycle Timing transaction that will occur. A bus transaction is initiated by AS, the rising edge of which latches The Read cycle timing' for the Z8030 is shown in the register address on the Address/Data bus and Figure 3-1. The register address on ADO-AD7 CSo \ / ADO-AD7 X ADDRESS ) <~ -.JX DATA VALID >- R/W I I .~. \"--- ---1 1 07513A 3-1 Figure 3-1 Z8030 Read Cycle Timing 3-1 as well as the state of CSO and INTACK, are DS falls, the acknowledge cycle was intended for latched by the rising edge of AS. R/W must be the SCC. This being the case, the Z8030 sets the HIGH before OS falls to indicate a Read cycle. The appropriate Interrupt-Under-Service latch, as well Z8030 data bus drivers are enabled while CS1 is ~Iacing an interrupt vector on ADO-AD7. The HIGH and OS is LOW. INT pin also goes inactive in response of the falling edge of DS. Note that there should be only one DS per acknowledge cycle. Another important fact 3.1.2 Z8030 Write Cycle Timing is that the IP bits in the Z8030 are up-dated by AS, which may delay interrupt requests if the processor The Write cycle timing for the Z8030 is shown in does not supply AS strobes during the time Figure 3-2. The register address on ADO-AD7, as between accesses of the Z8030. well as the state if CSO and INTACK are latched by the rising edge of AS. Rm must be LOW when OS falls to indicate a Write cycle. The leading edge 3.1.4 Z8030 Register Access of the coincidence of CS1 HIGH and OS LOW latches the write data on ADO-AD7 as well as the The registers in the Z8030 are addressed via the state of RIW. address on ADO-AD7, latched by the rising edge of AS. The Shift Right/Shift Left bit in WROS controls which bits will be decoded to form the 3.1.3 Z8030 Interrupt Acknowledge Cycle Timing register address. It is placed in this register to simplify programming when the current state of the The Interrupt Acknowledge cycle timing for the Shift Right/Shift Left bit is not known. A hardware Z8030 is shown in" Figure 3.3. The address on reset forces Shift Left mode, where the address is ADO-AD7 and the state of CSO and INTACK are decoded from AD5-AD1. In Shift Right mode, the latched by the rising edge of AS. However, if address is decoded from AD4-ADO. The Shift INTACK is LOW, the address, CSO, CS1 and RIW Right/Shift Left bit is written via co"mmand to make are ignored for the duration of the interrupt the software writing to WRO independent of the acknowledge cycle. between the rising edge. of state of the Shift Right/Shift Left bit. While in Shift AS and the falling edge of OS, the internal and Left mode, the register address itself is placed on external daisy chains settle (this is A.C. parameter AD4-AD1 and the Channel Select bit, AlB, is #29 TdAS(OSA) in the data sheet. If there is an decoded from AD5. The register map for this case interrupt pending in the SCC, and lEI is HIGH when is shown in Table 3-1. In Shift Right mode, the CSo \ I 7 \ ADO-AD? X ADDRESS >0<~ DATA >C RIW \ r 7 07513A 3-2 Figure 3-2 Z8030 Write Cycle Timing 3-2 register address is again placed on AD4-AD1 but However. once this condition is removed, the the channel select AlB is decoded from ADO. The reset condition is asserted internally for an register map for this case is shown in Table 3-2. additional four to five PCLK cycles. During this Because the 28030 does not contain 16 read time any attempt to access the Z8030 will be registers. the decoding of the read registers is not ignored. The 28030 has three software resets, en- complete; this is indicated in Table 3-1 and Table 3- coded into two command bits in WR9. There are 2 by parentheses around the register name. two channel resets, which only affect one channel These addresses may also be used to access the in the device and some of the bits in the write read registers. Note also that the 28030 contains registers. The third command forces the same only one WR2 and WR9; these registers may be result as does a hardware reset. As in the case of written from either channel. Shift Left Mode is the hardware reset, the 28030 stretches the reset used when channel A and B are to be programmed signal an additional four to five PCLK cycles differently. This allows the software to sequence beyond the ordinary valid access recovery time. through the registers of one channel. The Shift The ·bits in WR9 may be written at the same time as Right Mode is used when the channels are pro- the reset command because these bits are affec- grammed the same. By incrementing the address. ted only by a hardware reset. The reset values of the programmer·can program the same data value the various registers are shown in Figure 3-4. into Channel A's register and Channel B's register. 3.2 INTERFACING THE Z8530 3.1.5 Z8030 Reset Two control signals, RD and WR, are used by the The Z8030 may be reset by either hardware of Z8530 to time bus transactions. In addition, four software. Hardware reset occurs when AS and OS other control signals, CE, DIG, AlB and INTACK, are both LOW ·at the same time, which is normally are used to control the type of bus transaction that an illegal condition. As long as both AS and OS are will occur. A bus transaction starts when the LOW. the 28030 recognizes the reset condition. addresses on DIG and AlB are asserted before RD i~ AS CSo ADo-AD7 ----e: '-_"""-.-1 J a - - - - - - \ ~----mI(~ _"X~_V_E_CT_O_R_.._J)t----- DS INTACK lEI lEO -----------io\'!1!~-----.-J'! INT 'I ;~ 07513A 3-3 Figure 3-3 Z8030 Interrupt Acknowledge Detalis 3-3 Table3·1 ZS030 Register Map (Shift Left) Table 3-2· Z8030 Register Map (Shift Right) ADS AD4 AD3 AD2 AD1 WRITE READ ADS AD4 AD3 AD2 AD1 WRITE READ 0 0 0 0 0 WROB RROB 0 0 0 0 0 WROB RROB 0 0 0 0 1 WR1B RR1B 0 0 0 0 . 1 WROA RROA 0 0 0 1 0 WR2 RR2B 0 0 0 1 0 WR1B RR1B 0 0 a 1 1 WR3B RR3B 0 0 0 1 1 WR1A RR1A 0 a 1 0 a WR4B (RRaB) a· a 1 0 0 WR2 RR28 0 0 1 0 1 WRSB (RR1B) 0 0 1 0 1 WR2 RR2A 0 0 1 1 0 WR6B (RR2B) a a 1 1 0 WR3B RR3B 0 0 1 1 1 WR7B (RR3B) 0 0 f 1 1 WR3A RR3A 0 1 0 a 0 WRS8 RRSB a 1 0 a 0 WR48 RRaB 0 1 a a 1 WR9 (RR13B) a 1 0 0 1 WR4A RROA 0 1 a 1 0 WR10B RR10B a 1 0 1 '0 . WR5B (RR1B) a 1 a 1 1 WR11B (RR1SB) a 1 a 1 1 WR5A (RR1A) a 1 1 0 0 WR12B RR12B a 1. 1 0 0 WR6B RR28 a 1 1 0 1 WR13B RR13B 0 1 1 0 1 WR6A RR2A a 1 1 1 0 WR14B (RR1aB) 0 1 1 1 0 WR7B (RR3B) 0 1 1 1 1 WR1SB RR15B a 1 1 1 1 WR7A (RR3A) 1 0 0 a 0 WROA RROA 1 0 a a 0 WRSB RRSB 1 0 0 0 1 WR1A RR1A 1 a a 0 1 WRSA RRSA 1 0 0 1 0 WR2 RR2A 1 0 0 1 a WR9 (RR13B) 1 0 0 1 1 WR3A RR3A 1 0 0 1 1 WR9 (RR13A) 1 0 1 0 0 WR4A (RROA) 1 0 1 0 0 WR10B RR10B 1 0 1 0 1 WRSA (RR1A) 1 0 1 0 1 WR10A RR10A ~. 1 0 1 1 0 WR6A (RR2A) 1 0 1 1 0 WR11B (RR15B) 1 0 1 1 1 WR7A (RR3A) . 1 0 1 1 1 WR11A (RR15A) 1 1 0 0 0 WR8A RRSA 1 1 0 a 0 WR12B RR12B ' 1 1 0 0 1 WR9 (RR13A) 1 1 0 0 1 WR12A RR12A 1 1 0 1 0 WR10A RR10A 1 1 0 1 0 WR13B RR13B 1 1 0 1 1 WR11A (RR15A) 1 1 a 1 1 WR13A RR13A ~ 1 1 1 a a WR12A RR12A 1 1 1 0 0 WR148 (RR10B) \ 1 1 1 0 1 WR13A RR13A 1 1 1 a 1 WR14A (RR1aA) 1 1 1 1 0 WR14A (RR10A) 1 1 1 1 0 WR15B RR1SB 1 1 1 1 1 WR15A RR15A 1 1 1 1 1 WR1SA RR1SA or WR fall. The coincidence of CE and RD or CE Figure 3-5. The address on AlB and D/C .is and WR latches the state of DIG and AlB and starts latched by the coincidence of RD and CE active. the internal operation. The INTACK signal must CE must remain LOW and INTACK must remain have been previously sampled High by a rising HIGH throughout the cycl~. The l8530 bus edge of PCLK for a read or write cycle to occur. In drivers are enabled while CE and RD are both addition to sampling INTACK, PCLK is used by 1he LOW. A read with DIG HIGH does not disturb the interrupt section to set the IP bits. The 28530 state of the pointers and a read cycle with DIG generates internal contrbl signals in response to a LOW resets the pointers to zero after the internal register access. Since RD and WR have no phase operation is complete. relationship with PCLK, the circuitry generating these internal control signals provides time for metastable conditions to disappear. This results in 3.2.2 Z8530 Write Cycle Timing a recovery time related to PCLK. This recovery time applies only between transactions involving The Write cycle timing for the l8530 is shown in the l8530, and any intervening transactions are Figure 3-6. The address on AlB and D/C, as well ignored. This recovery time is four PCLK cycles, as . the data on 00-07, is latched by the measured from the falling edge of RD or WR in the coincidence of WR and CE active. CE must remain case of a read or write of any register. LOW and INTACK must remain HIGH throughout the cycle. A write cycle with DIG HIGH does not 3.2.1 Z8530 Read Cycle Timing disturb the state of the pointers and a write cycle with ole LOW resets the pointers to zero after the The Read cycle timing for the l8530 is shown in internal operation is complete. 3-4 3.2~3 28530 Interrupt Acknowledge 00-07. If the falling edge of RD sets an I US bit in Cycle Timing the 28530, the INT pin goes active in response to the falling edge. Note that there should be only The Interrupt Acknowledge cycle timing for the one RO per Acknowledge cycle. Another impor- Z8530 is shown in Figure 3.7. The state of tant fact is that the IP bits in the Z8530 are updated INTACK is latched by the rising edge of PCLK. by PCLK divided by two, and this clock to update While INTACK is LOW, the state of AlB, CE, D/G, IPs is stopped while the pointers point to RR2 and and WR are ignored. Between the time INTACK is RR3. This prevents data changing during a read, first sampled LOW and the time RD. falls, the but will delay interrupt requests if the pointers are internal and external lEI/lEO daisy chains settle; left pointing at these registers. this is A.C. parameter #38 TdlAi (RD). If there is an interrupt pending in the Z8530, and lEI is HIGH when RD falls, the Interrupt Acknowledge cycle 3.2.4 Z8530 Register Access was intended for the Z8530.· This being the case, the Z8530 sets the appropriate Interrupt Under The registers in the Z8530 are accessed in a two- Service latch, and places an interrupt vector on step process, using a Register Pointer to perform HARDWARE RESET CHANNEL RESET 76543210 76543210 000000001 000 0 0 0 0 0 WRO o 0 o 0 . 0 0 o 0 .00 . 0 0 WRl WR2 . 0 WR3 • 1 . 1 WR4 o o 0 0 O. o . . 000 0 . WR5 WR6 WR7 1 1 0 000 . . 0 WR9 00000 0 0 0 o . 00000 WR10 00001 000 WR11 WR12 WR13 1 0 0 0 0 0 . 1 0 0 0 . WR14 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 WR15 o 1 1 0 0 o 1 100 RRO 00000 1 1 0 o 0 0 001 1 0 RRl o 0 000 000 o 0 0 0 0 0 0 0 RR3 07513A 3-4 o 0 0 0 0 0 0 0 o 0 000 0 0 0 RR10 Figure 3·4 Z8030 Register Reset Values 3-5 the addressing. To access a particular register, the pendently, of the state of the pointer' bits. pointer bits must be set by writing. to WRO. The This allows single-cycle access to the data pointer bits· may be written in either channel registers and does not disturb the pointer bits. because only one set exists in. the' Z85~O~ After The fact that the pointer bits are reset to "0," the pointer bits are set, the next read or write. cycle unless explicitly set otherwise, means that WRO of the 28530 having D/C LOW will. 'access the and RRO may also be accessed in a single cycle. desired register. At the conclusion of thi.s· read or That is, it is not necessary to wtite the pointer bits write cycle the pointer bits are reset to. "Os," so that with "0" before accessing WRO or RRO. There are the next control. write will be to the: pointers in three pointer bits in WRO, and these allow access WRO. A read or RR8 (the receive data buffer) or a to the registers with addresses 0 through 7. Note write to WR8 (the transmit data buffer) may either that'a command may be written to WRO at the same be done in this fashion or by accessing the 28530 time that the pointer bits are ·written. To access the having D/C pin HIGH. A read or write with DIG HIGH registers with addresses 8 through 15, a special accesses the data registers directly, and inde- command must accompany the pointer bits.' This Alii, D/C X,., .. ..-.. ~, Do-D7 ------~----__c 07513A 3-5 Figure 3-5 Z8530 Read Cycle Timing AlB, DIe X'- ... A_D_D_RE_S_SV_A_LI_D X'-__ ...... \~- \ I \'--ii-' ---'f Do-D7 ----------e{'- D_A_TA_V_A_L1_D ..J)...- ---- 07513A 3-6 .,Figure:3-6 Z8530 Write Cycle Timing 3-6 a: o t- oW > :.: ..- "M ...U I~ I~ ! 0 I! <{ c e:t) I 0 !!! u:; 0.. C " 0 3-7 precludes concurrently issuing a command. when Table 3-3 Z8530 Register Map pointing to these registers. The register map for the AmZ8530 is shown in Table 3.3. If, for some AlB PNT2 PNT1 Pt'WfilITE READ reason, the state of the pointer bits is unknown they may be reset to "0" by performing a read cycle o o o o WROB RROB with the D/C pin held LOW. Once the pointer bits o o o 1 WR18 RRIB have been set, the desired channel is selected by o o 1 o WR2 RR2B o o 1 1 WR3B RR3B the state of the AlB pin during the actual read or o 1 a a WR4B (RRaB) write of the desired register. o 1 o 1 WR5B (RR1B) o 1 1 a WRGB (RR2B) o 1 1 1 WR7B (RR3B) 1 o o a WROA RRaA 3.2.5 Z8530 Reset 1 o a 1 WR1A RR1A 1 o 1 a WR2 RR2A The Z8530 may be reset by either hardware or 1 o 1 1 WR3A RR3A software. Hardware reset occurs when RD and WR 1 1 o a WR4A (RRaA) are both LOW, simultaneously, which is normally 1 1 o 1 WR5A (RR1A) an illegal condition. As long as both RD and WR 1 1 1 a WR6A (RR2A) are LOW, the Z8530 recognizes the reset 1 1 1 1 WR7A (RR3A) condition. Once this condition is removed, With the Point High command: however, the reset condition is asserted interna~ly for an additional four to five PCLK cycles. During o a a 0 WR8B RR8B this time any attempt to access the Z8530 will be a 0 0 1 WR9 RRI3B ignored. The Z8530 has three software resets, o a 1 0 WR1aB RR10B encoded into command bits in WR9. There are a 0 1 1 WR11B (RR15B) two channel resets, which affe,ct only one channel o 1 a a WR12B RR12B in the device and some of the bits in the write o 1 a 1 WR13B RR13B .registers. The third command forces the same a 1 1 a WR14B (RR1aB) result as does a hardware reset. As in the case of a o 1 1 1 WR15B RR15B hardware reset, the Z8530 stretches the reset 1 0 0 a WR8A RR8A signal an additional four to five PCLK cycles 1 0 0 1 WR9 (RR13A) beyond the ordinary valid access recovery time. 1 0 1 a WR10A RR10A 1 0 1 1 WR11A (RR15A) The bits in WR9 may be written at the same time as 1 1 a 0 WR12A RR12A the reset command because these bits are 1 1 0 1 WR13A RR13A affected only by a hardware reset. The reset values 1 1 1 a WR14A RR14A of the various registers are shown in Figure 3-8. 1 1 1 1 WR15A RR15A 3-8 HARDWARE RESET CHANNEL RESET 6 0 2 I 0 0 WRO 0 0 0 0 WR1 WR2 0 WR3 WR4 0 0 0 0 0 0 WR5 WR6 WR7 0 0 0 0 WR9 0 0 0 0 WR10 0 WR11 WR12 WR13 0 WR14 0 0 0 0 WR15 RRO RR1 0 0 0 0 RR3 0 0 0 0 0 0 0 0 0 0 RR10 07513A 3-8 Figure 3-8 Z8530 Register Reset Values 3-9 ; .. · .~ CHAPTER 4 1/0 PROGRAMMING CAPABILITIES 4.0 INTRODUCTION a different vector if another interrupt occurs. The register is disabled from change during the read Regardless of the version of the SCC, all operation to prevent an error if a higher interrupt communication modes can use a choice of polling, occurs exactly during the read operation. interrupt and block transfer. These modes must be selected by the user to select the proper Once the status is· read, the interrupt routine must hardware a.nd software required to supply data at decode the interrupt pending, and clear the the rate required. condition. Removing· the interrupt condition will clear the IP and bring INT inactive, as long as there are no other IP bits set. For example, writing a 4.1 POLLING character to the ·transmit buffer will clear the transmit buffer empty IP. This is the simpliest mode to implement. The software must poll the SC.C to determine when When the interrupt IP, decoded from the status, is data is to be inputted or outputted from the SCC. cleared RR2 can be read again. This allows the In this mode, MIE (WR9 bit 3), and Wait/DMA interrupt routine to clear all of. the IP's within one Request Enable (WR1 bit7) are both reset to 0 to interrupt request to the CPU. disable any requests. The software must then poll RRO to determine the status of the receive buffer, transmit buffer and external status. Interrupt with Acknowledge After the SCC brings iNT active, the CPU must 4.2 INTERRUPTOPERATIONS respond by bringing INTACK active. After enough time has elapsed to allow the daisy-chain to settle, The SCC, as a microprocessor peripheral, will the SCC will set the IUS bit for the highest priority request an interrupt only when it needs servicing. IP. If the No Vector bit is not set (WR9 bit 1), the This allows the CPU to perform other operations SCC will then place the interrupt vector on the data while the SCC does not need service. The SCC bus during a read. To speed the intrrupt response has an internal priority resolution method to allow time, the SCC can also modify 3 bits in the vector the highest priortiy interrupt to be serviced first. to inidicate status. To include the status, the VIS bit (WR9 bit 0) must be set. The service routine The SCC is flexible with its interrupt method. The must then clear the interrupting condition. For interrupt may be acknowledged with a vector example, writing a character to the transmit buffer transferred, acknowledged without a vector, or not will clear the transmit buffer empty IP. After the acknowledged at all. interrupting condition is cleared, the routine can read RR3 to determine if any other IP'S are set and clear them. At the end of the interrupt routine, a Interrupt Without Acknowledge Reset IUS command (WRO) must be issued to unlock the daisy-chain and allow lower-priority In this mode, the Interrupt Acknowledge signal interrupt requestes. This is the only way, short of a does not have to be generated. This allows a software or hardware reset, that an IUS bit may be simpler hardware design that does not have to reset. meet the Interrupt acknowledge timing. Soon after the INT goes active, the interrupt controller will If the No Vector bit (WR9 bit 1) is set, the SCC will jump to the interrupt routine. In the interrupt not place the vector on the data bus. An interrupt routine, the code must read RR2 from Channel B controller must then vector the code to the to read the vector including status. When the interrupt routine. The interrupt routine must then vector is read from Channel S, it always includes read RR2 from Channel B to read the status. This the status regardless of the VIS bit (WR9 bit 0). is the same as the case of an interrupt without an The status given will decode the highest priority acknowledge except the IUS is set and the vector interrupt pending at the time it is read. The vector will not change until the Reset IUS command in is not latched so that the next read could produce RRO is issued. 4-1 Interrupt Sources the necessary conditions are met. If the IE bit is reset, no interrupt request will be generated by Each channel in the SCC contains 3 sources of that source. The IE bits are write-only in the SCC. interrupt, making a total of 6. These 3 sources of The IP bit for a given source of interrupt may be set interrupts are the receiver, the transmitter, and by the presence of an interrupt condition in the External/Status conditions. In addition, there are SCC and is reset directly by the processor, or several conditions that may cause these interrupts. indirectly by some action that the processor may take. If the corresponding IE bit is not set, the IP The receive interrupt request may either be for that source of interrupt will never be set. The IP caused by a receive character available or a special bits in the SCC are read-only in RR3A. The IUS condition. The receive character available interrupt bits are completely hidden from the processor's is generated when a character is loaded into the view. An IUS is set during an Interrupt FIFO and is ready to be read. The special Acknowledge cycle for the highest-priority IP. See conditions are receive FIFO overrun, CRC/fram- Table 4-1 for the interrupt priority. IUS is used to mingerror, End of frame, and parity. The parity control the operation of the interrupt daisy chain special -condition can be included as a special (see Section 4.1) by masking lower-priority condition or not depending on bit 2 WR1. The interrupts. At the end of an interrupt service special condition status can be read from RR1. routine, the processor must issue a Reset Highest IUS command in WRO to allow lower-priority The transmit interrupt request has only one interrupts. This is the only way, short of a 'software source. It can only be set when the transmit buffer or hardware reset, that an IUS bit may be reset. goes from full to empty. Note that this means that the transmit interrupt will not -be set until after the Table 4-1 Interrupt Source Priority first character is written to the SCC. Receiver Channel A High The External/status Interrupts have several Transmit Channel A sources which may be individually enabled in External/Status Channel A J, WR15. The sources are zero count, OeD, Receiver Channel B J, Sync/Hunt, CTS; transmitter underrunlEOM and Transmit Channel B Break/Abort. External/Status Channel B Low Each source of interrupt in the SCC has three controVstatus bits associated with it. There are Interrupt Enable (IE), Interrupt· Pending (IP), and Daisy-Chain Priority Resolution Interrupt Under Service (IUS) (See Figure 4.1). The IE bit is written by the processor and serves to The six sources of interrupt in the SCC are control interrupt requests from the SCC. If the IE prioritized in a fixed order via a daisy chctin; bit is set for a given source of interrupt; then that provision is made, via ~he lEI and lEO pins, for use source may cause an interrupt request when all of of an external daisy chain as well. All Channel A I I INTERRUPT VECTOR 0ElEl 00 lEI M iNTACK lEO FROM PULLUP RESISTOR OR lEO LINE OF HIGHER PRIORITY DEVICE J 1 r TO lEI INPUT OF LOWER PRIORITY DEVICE TO CPU FROM CPU STATUS DECODER 07513A 4-1 Figure 4-1 Peripheral Interrupt Structure 4-2 interrupts are higher-priority than any Channel B may be encoded and placed in enher bits 1-3 or in interrupts, with the receiver, transmitter, and bits 4-6. This operation is selected by program- External/Status interrupts prioritized in that order ming the Status High/Status Low bit in WR9. At within each channel. ~he SCC requests an the end of the interrupt service routine, the proces- interrupt by pulling the INT pin Low from its open- sor should issue the Reset Highest IUS command drain state. This is controlled by the IP bits and the to unlock the daisy chain and allow lower-priority lEI input, among other things. A flowchart of the interrupt requests. The IP is reset during the inter- interrupt sequence for the SCC is shown in Figure rupt service routine either directly by command, or 4-2. The internal daisy' chain links the six sources indirectly, through some action taken by the of interrupt in a fixed order, chaining the IUS bits processor. The external daisy chain may be con- for each source. While an IUS is set, all lower- trolled by the OLe bit in WR9. This bit, when set, priority interrupt requests are masked off; during forces lEO Low, disabling all lower-priority devices. an Interrupt Acknowledge cycle the IP bits are also gated into the daisy chain. This insures that the Table 4-2 Interrupt Vector Modification highest-priority IP will be selected to have its IUS set. The internal daisy chain may be controlled by V3 V2 V1 Status High/Status Low = 0 the MIE bit in WR9. This bit, when reset, has the V4 V5 V6 Status High/Status Low = 1 0 0 0 Ch B Transmit Buffer Empty same effect as pulling the lEI pin Low, thus 0 0 1 Ch B ExternaVStatus Change disabling all interrupt requests. 0 1 0 Ch B Receive Character Avail. 0 1 1 Ch B Special Receive Condition 1 0 0 Ch A Transmit Buffer Empty External Daisy Chain Operations 1 0 1 Ch A ExternaVStatus Change 1 1 0 Ch A Receive Character Avail. The SCC generates an interrupt request by pu lling 1 1 1 Ch A Special Receive Condition INT Low, but only if such interrupt requests are enabled (IE is 1, MIE is 1), an IP is set without a higher-priority IUS being set, or no higher-priority IUS being set, or no higher-priority interrupt is 4.2.1 Receive Interrupts being serviced (lEI is High), or no Interrupt Acknow- /~ ledge transaction is taking place. It is not pulled The Receive Interrupt mode is controlled by WR1 Low by the sce at this time, but instead continues bits 4 and 3. These select one of the four interrupt to follow lEI until an Interrupt Acknowledge transac- modes. The four modes are, Interrupt disabled, tion occurs. Some time after INT has been pulled Interrupt on first character or special conditions, Low, the processor initiates an Interrupt Acknow- Interrupt on all characters or special conditions, ledge transaction. Between the time the the SCC and Interrupt on special conditions. recognizes that an Interrupt Acknowledge cycle is in progress and the time during the acknowledge that the processor requests an interrupt vector, Receive Interrupts Disabled the IEIII EO daisy chain settles. Any peripheral in the daisy chain having an Interrupt Pending (IP is This mode prevents the receiver from requesting 1) or an Interrupt Under Service (IUS is 1) holds its an interrupt. It is used in a polled environment lEO line Low and all others make lEO follow lEI. where either the status bits in RRO or the modified vector in RR2 (Channel B) is read. Although the When the processor requests an interrupt vector, receiver interrupts are disabled, the interrupt logic only the highest-priority interrupt source with a can still be used to provide status. pending interrupt (IP is 1) has its lEI input High, its IE bit set to "1," and its IUS bit set to 110." Thisis the When these bits indicate that a received character interrupt source being acknowledged, and at this has reached the top of the FIFO, the status in RR1 point it sets its I US bit to "1 ." If its NV bit is "0, the It should be checked and then the data should be sce identifies itself by placing the interrupt vector read. If status is to be checked, it must be done from WR2 on the data bus. If the NV bit is IIi," the before the data is read, because the act of reading sec data bus remains floating, allowing external the data pops both the data and error FIFOs. logic to supply a vector. If the VIS bit in the SCC is "1," the vector also contains status information, encoded as shown in Table 4-2, which further Receive Interrupt on First Character or describes the nature of the SCC interrupt. If the Special Condition ~ I \ VIS bit is "0," the vector held in WR2 is returned without modification. If the sce is programmed to This mode is designed for use with OMA transfers include status information in the vector, this status of the rece ive characters. After this mode is 4-3 .~.. 07513A 4-2 Figure 4-2 Interrupt Flowchart 4-4 selected, the first character received, or the first status in RR1 before reading the data. At character already stored in the FIFO, will set the moderate to high data rates, where the interrupt .~' receiver IP. This IP will be reset when this overhead is significant, time can usually be saved character is removed from the SCC. No further by checking for another received character before receive interrupts will occur until the processor exiting the service routine. This technique issues an Enable Interrupt on Next Receive eliminates the Interrupt Acknowledge and the Character command in WRO or until a special processor-state-saving time, but care must be receive condition occurs. The SCC recognizes exercised because this receive character must be several special receive. conditions. A receive checked for special receive conditions before it is overrun (where a character in the FIFO is written removed from the SCC. over) is a special receive condition, as is a framing error in Asynchronous mode, or the end-of-frame condition in SOLC mode. In addition, if 02 of WR1 Receive Interrupt on Special Conditions is set, any character with a parity error will generate a special receive· condition interrupt. The correct This mode is· designed for use with OMA transfers sequence of events when using this mode is to of the receive characters. In this mode, only first select the mode and wait for the receive receive characters with special conditions will character available interrupt. When the interrupt cause the receiver IP to be set. All other occurs the processor should read the character characters are assumed to be transferred via OMA. and then enable the OMA to transfer the remaining No special initialization sequence is needed in this characters. A special receive condition interrupt mode. Usually the OMA is initialized and enabled, may occur any time after the first character is and then this mode is selected in the SCC. A received, but is guaranteed to occur after the special receive condition interrupt may occur at any .~ character having the special condition has been time after this mode is selected but the logic read. The status is not lost in this case, however, guarantees that the interrupt will not occur until because the FIFO is locked by the special after the character with the special condition has condition. In the service routine the processor been read from the SCC. The special condition should read RR1 to obtain the status, and may locks the FI FO so that the status will be valid when read the data again if necessary. The FIFO is read in the interrupt service routine, and it unlocked by issuing an Error Reset command in guarantees that the OMA will not transfer any .WRO. If the special condition was End-of-Frame, characters until the special condition has been the processor should now issue the Enable serviced. In the service routine the processor Interrupt on Next Receive Character command to should read RR1 to obtain the status and unlock prepare for the next frame. The first character the FIFO by issuing an Error Reset command. interrupt and special condition interrupt are OMA transfer of the· receive characters will then distinguished by the status included in the resume. interrupt vector. In all other respects they are identical, including sharing the IP and IUS bits. 4.2.2 Transmit Interrupts Interrupt on All Receive Characters or . Transmit interrupts are controlled by the Transmit Special Conditions Interrupt Enable bit (01) in WR1. If the interrupt capabilities of'the SCC are not required, polling This mode is designed for an interrupt-driven may be used. This is selected by disabling the system. In this mode the SCC will set the receiver transmit interrupts and polling the Transmit Buffer IP on every received character, whether or not it Empty bit in RRO. When the Transmit Buffer has a special receive condition. This includes Empty bits is set a' character may be written to the characters already in the FIFO when this mode is sec without fear of writing over previous data. selected. In this mode of operation the IP is reset Another way of polling the see is to enable the when the character is removed from the FIFO, so if transmit interrupt and then reset the MIE bit .in the processor requires status for any character, WR9. The processor may then poll the IP bits in this status must be read before the data is RR3A to determine when the transmit buffer is removed from the' FIFO. The special receive empty. Transmit interrupts should also be disabled conditions are identical to those previously in the case of OMA transfer of the transmitted data. mentioned, and as before, the only difference between a "receive character available" interrupt While the transmit interrupts are enabled the SCC and a "special receive condition" interrupt is the will set the transmit IP whenever the transmit buffer status' encoded in the vector. In. this mode a becomes empty. This means that the transmit speciai receive condition does not lock the receive buffer must have been full before the transmit IP data FIFO so that the service routine must read the can be set. Thus when the transmit interrupts are 4-5 first enabled, the transmit IP will not be set until described. Because the latches close on the after the first character is written to the SCC., In current status but give no indication of change, the synchronous modes one other condition can processor must maintain a copy of RRO in memory. cause the transmit IP to be set.· This occurs at the When.. the' SCC generates an External/Status end of a transmission afterCRC is sent. When the interrupt the processor should read RRO and last bit of CRC has cleared the Transmit Shift determine which condition changed state and take register and the flag or sync character. is loaded appropriate action. The copy of RRO in memory into the Transmit Shift register, ·the SCC will set the must· then updated and the Reset External/Status transmit IP. Data for the new frame or block to be Interrupt command issued. Care must be taken in transmitted may be written at this time. In this' writing the interrupt service routine for the particular case the Transmit Buffer Empty bit in External/Status interrupts because it is possible for RRO is not set; only the transmit IP is set. If the more than one status condition to'change state at transmit Buffer Empty· bit is, in fact, set for the the same time. ·AII of the latch bits in RRO should transmit interrupt that occurs immediately after be compared to the copy of RRO in memory. If CRC transmission,. thi$ indicates that data was none have changed and theZC interrupt is enabl- writt.en while CRC, was being s.ent. This is an· ed, the·:Zero Count condition caused the interrupt. indication that .thetransmitter underf.loweq, without the CPU being aware of it. The transmit tP is reset The. operation of the individual enable bits in either by writing data tq the transmit buffer or .by WR15· for each of the six sources .of iS$uing the R~setTran$rnit IP command in WRD. External/Status interrupts is identical, but subtle Q~dinarily the ~esponse to a transmit interrupt is to differences exist in the· operation of each source. of write more data·to th~ SCC; however, at the ~nd of interrupt. The six sources are Break/Abort, a ·frame·or block of data where CRC is ;to be sent Underrun/EOM, crs, OCD, Sync/Hunt- and Zero next, the Reset Transmit IP command should be Count. The Break/Abort, UnderrunlEOM, and issued in lieu of,da~a. Zero. Count conditions are internal to the SCC, while Sync/Hunt may be internal or external, and CTS and DCD are purely external· signals. In the 4.2.3. Extern~I/Status Interrupts. following discussions each source is assumed to be enabled, so that the latches. are present, and Tnere are· several sources 'of . External/Status the' External/Status interrupts are enabled as a interrupts, ea9h of. whicn .may be individually whole.' Recall that the External/Status IP is set enabled. in WR15~ The master enable for the while the latches are closed and that the state of External/Status interrupts is located in WR 1 (DO). the signal is reflected immediately in RRO if the The individual enable bits in WR15 control w,hether latches are not present. or not latches will be present in ·the path from the source of interrupt to the status bit in RRO. If an The Break/Abort status is used in asynchronous individual enable bit in WR15 is set to "0" the and SDLCmodesbut is always "0" in synchronous latches are not present in the signal path and the modes other than SOLC. In asynchronous modes value read in RRO reflects the ·current status. An this bit is set when a break sequence (null interrupt source whose individual enable in WR 15 character plus framing error) is detected in the is "0" is not a source of ExternaVStatus interrupts receive data stream, and remains set as long as even though the External/Status Interrupt! Enable "as" continue to be received. This bit is .reset bit is set. When an individual enable in ·WR15 is set when a "1" is received. A single null character is to "1/' the latch is' pres.ent in the signal path. The left in the receive FIFO each time that· the break latches for the sources . of· ExternaVStatus condition is terminated. This character should be interrupts are· not independent. Rather, they all read and discarded. In SOLe mode this bit is set close at;the same time as a result ofa state change by the detection otan abort sequence, which is by one .of the sources of .interrupt. ". Thus, a read of seven or more contiguous "1 s" in the receive data RRO returns the current status for any bits whose stream. The bit is reset when a "0" is received. A individual enable is "0" and either the'current state received abort forces the/receiver into Hunt, which or the latched state of. the remainderof the bits. To is also an external/status condition. Though these guarantee the current status .the processor should two bits change state at roughly the same time,' issue a Reset External/Status Interrupts command one or two .External/Status interrupts may be in WRO to open the latches. The' External/Status generated as a result. The' Break/Abort bit' is IP is set by the closing of the latches and remains unique in that both transitions are guaranteed to set as long as they are closed. If the master enable cause the .Iatches to. close, even if another for the External/Status interru'pts is not set, the IP External/Status interrupt is pending at the time will never be set, even though the latches may be these transitions occur. This guarantees that a present in the signal paths and working as break or abort'will be caught. 4-6 the receiver will automatically synchronize on Flag The Transmit UnderrunlEOM bit is used in synchro- characters. The receiver is in Hunt mode when it is nous modes to control the transmission of CRC. enabled, so the Enter Hunt command will probably This bit is reset by issuing the Reset Transmit never be needed. UnderrunlEOM command in WRD. However, this transition does not cause the latches to close; this If careful attention is paid to details, the interrupt occurs only when the bit is set. To inform the service routine for External/Status interrupts is processor of this fact, the SCC sets this bit when straightforward. To determine which bit or bits CRC is loaded into the Transmit Shift register. This changed state, the routine should first read ARO bit will also be set if the processor issues the Send and compare-it to a copy from memory. For each Abort command in WAO.The bit is always set in changed bit the appropriate action should be Asynchronous mode. taken and the copy in memory updated. The service routine should close with a Aeset The CTS bit reports the state of the CTS input, and External/Status interrupts command to reopen the the OCD bit reports the status of the OCD input. latches. The copy of AAO in memory should Both bits latch on either input transition. In both always have the Zero Count bit set to "0," since cases, after the Aeset External/Status Interrupt this will be the state of the .bit after the Reset command is issued, if the latches are closed, they External/Status interrupts command at the end of remain closed if there is any odd number of the service routine. When the processor issues transitions on an input; they will be open if there is the Reset Transmit UnderrunlEOM latch command an even number of transistions on the input. in WRO, the Transmit Underrun/EOM bit in the copy of RRO in memory should be reset because The Zero Count bit is set when the counter in the this transition does not cause an interrupt. baud rate generator reaches a count of "0" and is reset when the counter is reloaded. The latches are closed only when this bit is set to "1 ," and the 4.3 BLOCK TRANSFERS status in AAO always reflects the current status. While the Zero Count IE bit in WR15 is reset this bit The SCC offers several alternatives for the block is forced to "0." transfer of data. The various options are selected by WR1 (bits D7 through D5) and WR14 (bit 02). There are a variety of ways in which the Sync/Hunt Each channel in the SCC has two pins which may may be set and reset, depending on the SCC's be used to control the block transfer of data. 80th mode of operation. In the Asynchronous mode pins in each channel may be programmed to act as this bit reports the state of the SYNC pin, latching OMA Request signals, and one pin in each on both input transitions. The same is true of channel may be programmed to act as a Wait signal External Sync mode. However, if the crystal for the CPU. In either mode, it is advisable to oscillator is enabled while in Asynchronous mode select and enable the mode in two separate this bit will be forced to "0" and the latches will not accesses of the appropriate register. The first be closed. Selecting the crystal option in· External access should select the mode and the second Sync mode is illegal, but the result will be the access should enable the function. This same. In Synchronous modes other than SOLC procedure prevents glitches on the output pins. the Sync/Hunt reports the Hunt state of the Reset forces Wa~ mode, with W/REQ open-drain. receiver. Hunt mode is entered when the processor issues the Enter Hunt command in WA3. This forces the receiver to search for a sync 4.3.1 Wait on Transmit character match in the receive data stream. Because both transitions of the Hunt bit close the The Wait function 'on transmit is selected by setting latches, issuing this command will cause an both D6 and D5to "0" and then enabling the External/Status interrupt. The SCC resets this bit function~setting D7 of WR1 to "1." In this mode when character synchronization has been the W/REQ pin carries the WAIT signal, and is achieved, causing the latches to again be closed. open-drain when inactive and Low when active. In these synchronous modes the SCC will not When the processor attempts to write to the reenter the Hunt mode automatically; only the transmit buffer when it is full, the SCC will assert Enter Hunt command will set this bit. In SDLC WAIT until the buffer is empty. This allows the use mode this bit is also set by the Enter Hunt of a block-move instruction to transfer the transmit command, but the receiver will also automatically data. In the case of the AmZ8030, WAIT will go enter the Hunt mode if an Abort sequence is active in response to DS going active, but only if received. The receiver leaves Hunt upon receipt WR8 is being accessed and a write is attempted. In of a flag sequence. Both transitions of the Hunt bit all other cases WAIT will remain open-drain. In the will cause the latches to be closed. In SOLC mode case of the AmZ8530, WAIT will go active in 4-7 response to WR going active, but only if the data not cause a problem in Asynchronous mode but buffer is being accessed, either directly or via the may cause problems in Synchronous mode pointers. The WAIT pin is released in response to because the SCC will send data in preference to the falling edge of PCLK. Oetails of the timing are flags or sync characters. It may also complicate the ~. shown in Figure 4-3. CRC initialization, which cannot be done until after the transmitter is enabled. With only one exception, the REQUEST pin directly follows the 4.3.2 Wait on Receive state of the transmit buffer in this mode. REQUEST goes Low when the transmit buffer The Wait function on receive is selected by setting empties and remains Low until the transmit buffer 06 or WR1 to "0," 05 of WR1 to "1," and then is filled. The SCC generates only one falling edge enabling the function by settling 07 of WR1 to "1." on REQUEST per character requested and the In this mode the W/REQ pin carries the WAIT timing for this is shown in Figure 4-5 The one signal, and is open-drain when inactive and Low exception occurs in synchronous modes at the when active. When the processor attempts to read end of CRC transmission. At the end of CRC data from the receive FI FO when it is empty, the transmission, when the closing flag or sync SCC will assert WAIT until a character has reached character is loaded into the Transmit Shift register, the top of the FI FO. This allows the use of a block- REQUEST is pulsed High for one PCLK cycle. move instruction to transfer the receive data. In The OMA may use this falling edge on REQUEST the case of the AmZ8030, WAIT will go active in to write the first character of the next frame or block response to RO going active, but only if RR8 is to the see. In the case of the AmZ8030, being accessed and a read is attempted. In all REQUEST will go High in response to the falling other cases WAIT will remain open-drain. In the edge of OS, but only if the appropriate transmit case of the AmZ8530, WAIT will go active in buffer in the see is accessed. This is shown in response to RO going active, but only if the Figure 4-6. In the case of the AmZ8530, receive data FIFO is being 'accessed, either directly REQUEST will go High in response to the falling or via the pointers. The WAIT pin is released in edge of WR, but only when the appropriate response to the falling edge of PCLK. Oetails of transmit buffer in the see is accessed. This is the timing are shown in Figure 4-4. shown in Figure 4-7. 4.3.3 DMA.Requests 4.3.5 DMA Request on Transmit (using DIR/REQ) The two OMA request pins W/REQ and OTR/REQ can be ~rammed to be used as OMA requests. A second Request on Transmit function is The W/REO pin can be used as either a transmit or available on the OTR/REQ pin. This mode is a receive request and the OTR/REO pin can only selected by setting 02 of WR14 to "1." When this be used as a receive request. For full-duplex bit is set to "1," REQUEST goes Low if the transmit operation, the W/REO~ therefore, used for buffer is empty at the time, or will go High until the transmit and the OTR/REO is used for receive. transmit buffer becomes empty. While 02 of These modes are described below. WR14 is set to "0," the OTR/REQ pin is OTR and follows the inverted state of 07 in WR5. This pin will be High after a channel or hardware reset and in 4.3.4 DMA Request on Transmit the OTR mode. In the Request mode REQUEST (using W/REQ) will follow the state of the transmit buffer even though the transmitter is disabled. Thus if The Request on Transmit function is selected by REQUEST is enabled before the transmitter is setting D6 of WR to "1," 05 of WR1 to "O,nand enabled, the OMA may· write data to the see then enabling the function~ setting 07 of WR1 to before the transmitter is enabled. This will not "1." In this mode the W/REO pin carries the cause a problem in Asynchronous mode, but may REOUESTsignal, which is active Low. When this cause problems in Synchronous mode because mode is selected, but not yet enabled, the WIREQ the see will send data in preference to flags or is driven High.. When the enable bit is set, sync characters. It may also complicate the CRe REQUEST goes Low if the transmit buffer is empty initialization, which cannot be done until after the at the time, or will remain High until the transmit transmitter is enabled. With only one exception, buffer becomes empty. Note that the REQUEST the REQUEST pin directly follows the state of the pin will follow the state of the transmit buffer even transmit buffer in this mode. REQUEST goes Low though the transmitter is disabled.. Thus, if the when the transmit buffer empties and remains Low REQUEST is enabled, the OMA may write data to until the transmit buffer is filled. The sec the SCC before the transmitter is enabled. This will generates only one falling edge on REQUEST per 4-8 ) J , ., TRxC \ \ \ PCLK WAIT 07513A 4-3 ~ Figure 4-3 Walt on Transmit U? RTxC /_U 1 T- " 5·.··8 10 11 12 13 PCLK WAIT 07513A 4-4 Rgure 4-4 Walt on Receive character requested and the timing for this is the receiver is disabled. Thus, if the receiver is shown in Figure 3-14. The one exception occurs disabled and REQUEST is still enabled, the OMA in synchronous modes at the end of CRC transmis- will transfer the previously received data correctly. sion. At the end of CRC transmission, when the In this mode the REQUEST pin directly follows the .~. closing flag or sync character is loaded into the state of the receive buffer with only one exception. Transmit Shift register, REQUEST is pulsed High REQUEST goes Low when a character enters the for one PCLK cycle. The OMA may use this falling receive buffer and remains Low until this character edge on REQUEST to write tne first character of is removed from the receive buffer. The SCC the next frame or block to the SCC. The Request generates only one falling edge on REQUEST per signal on OTR/REQ differs from the one on character transfer requested and the timing for this W/REQ in that it does not go immediately High in is shown in Figure 4-S. The one exception occurs response to the access which writes to the transmit in the case of a special receive condition in the buffer. This is because the registers in the SCC Receive Interrupt on First Character or Special are not written during the actual access, but are de- Condition mode, or the· Receive Interrupt on layed by some' number of PCLK cycles. The Special Condition Only mode. In the two interrupt Request signal on OTR/REQ follows the state of modes any receive character with a special receive the transmit buffer exactly while the Request signal condition is locked at the top of the FIFO until an on W/REQ goes inactive in anticipation of the Error Reset command is issued. This character in transmit buffer becoming full. The timing of the the receive FIFO would ordinarily cause additional Request signal on both pins is shown for the OMA Requests after the first time it is read. ArnZS030 in Figure 4-6 and for the AmZS530 in However, the logic in the SCC guarantees only Figure 4-7. one falling edge on REQUEST by holding REQUEST High from the time the character with the special receive condition is read, and the FIFO 4.3.6 DMA Request on Receive locked, until after the Error Reset command has been issued. Once the FIFO is unlocked by the The Request on Receive function is selected by Error Reset command, REQUEST again follows setting 06 and 05 of WR1 to "1" and then enabling the state of the receive buffer. In the case of the the functi~ by setting 07 of WR1 to "1." In this ZS030, REQUEST will go High in response to the mode the W/REQ pin carries the REQUEST signal, falling edge of OS, but only if. the appropriate which is active Low. When this mode is selected, receive buffer in the SCC is accessed. This is but not yet enabled, the W/RE"O pin is driven High. shown in Figure 4-9. In the case of the AmZS530, When the enable bit is set REQUEST goes Low if REQUEST will go High in response to the falling the receive buffer contains a character at the time, edge of RO, but only when the appropriate receive or will remain High until a character enters the buffer in the SCC is accessed. This is shown in receive buffer. Note that the REQUEST pin will Figure 4-1 O. follow the state of the receive buffer even though ) ) ) - TRxC \ \U\ PCLK REQ (DTRIREQ) REQ (WIREQ) Figure 4-5 Transmit Request Assertion ASYNC MODES 07513A 4-5 SYNC MODES i: ...&. AS\..-.! ADo-AD? ~ TRANSMIT DATA XXX DS peLK REQ (DTRIREQ) REQ (WIREQ) 07513A 4-6 Figure ~ Z8030 Transmit Request Release WR 00-07 TRANSMIT DATA PCLK REO (DTRIREO) REO (WIREQ) !N 07513A 4-7 Figure 4-7 Z8530 Transmit Request Release RTxC 177 II PCLK REO 07513A 4-8 Figure 4-8 Receive Request Assertion J ) ) ) ) ADo-AD7 ~~_R_E_C_E_IV_E_D_A_TA _ _.. )~:::..;~"'===--:I---""""""'--=-----m==;=--~-----=-------- )"' -_-_...;. .. PCLK 07513A 4-9 Figure 4-9 ZB030 Receive Request Release RECEIVE DATA 07513A 4-10 Figure 4-10 Z8530 Receive Request Release CHAPTERS .~ PROGRAMMING DATA COMMUNICATION MODES 5.0 INTRODUCTION to "1s". An additional bit, carrying parity infor- mation, may be selected by setting bit 00 of WR4 The SCC provides two independent full-duplex to "1". Note that this also enables parity for the channels programmable for use in any common transmitter. The parity sense is selected by bit 01 asynchronous or synchronous data commun- of WR4. If this bit is set to "1", the received ication protocol. These include asynchronous, character is checked for even parity, if set to "0", synchronous byte-oriented protocols, mono- the received character is checked for odd parity. sync, IBM Bisync, and bit-oriented protocols The additional parity. bit per character is transferred such as HDLC and SOLC. This chapter is to the receive data FI FO along with the data if the data plus parity is eight bits or less. The Parity Error divided into 3 sections: Asynchronous, Syn- bit in the receive error FI FO may be programmed to chronous, and SOLC. cause a special receive condition interrupt by setting bit 02 of WR1 to "1". This error bit is latched and so will remain active, once set, until an 5.1 ASYNCHR'ONOUS MODE Error Reset command has been issued. If interrupts are not used to transfer data, the Parity The see supports Asynchronous mode with a Error, Framing Error, and Overrun Error bits in RR1' ~. number of programmable options including the should be checked before the data is removed number of bits per character, the number of stop from the receive data FIFO. bits, the clock factor, modem interface signals and break· detect and generation. Asynchronous The break condition is continuous "0S", as mode is selected by programming the desired opposed to the usual continuous ones during an number of stop bits in 03 and 02 of WR4. idle. The see recognizes the Break condition· Programming these two bits with other than "00" upon seeing a null character (all ClOS") plus a places both the receiver and transmitter in framing error. Upon recognizing this sequence Asynchronous mode. In this mode, the SCC the Break bit in RRO will be set and will remain set ignores the state of bits 04, 03, 02, and 01 of until a "1" is received. At this point the break WR3, bits 05 and 0 4 of WR4, bits O2 and Do of condition is no longer present. At the termination WRS, all of WR6 and WR7 and all of WR10 except of a break the receive data FI FO contains a single 06 and 05. Bits that are ignored may be null character, which should be read and discard- programmed with "1" or "0" or not at all. ed. The Framing Error bit will not be set for this character, but if odd parity has been selected, the Parity Error bit will be set. eaution should be exer- 5.1.1 Asynchronous Receive cised if the receive data line contains a switch that is not debounced to generate breaks. Switch Asynchronous mode is selected by specifying the bounce may cause multiple breaks, recognized by number of stop bits per character in WR4. This the sec to be additional characters assembled in selection applies only to the transmitter, however, the receive data FIFO. It may also cause a receive as the receiver always checks for one stop bit. If overrun condition being latched. after character assembly the receiver finds this stop bit to be a "0", the Framing Error bit in the The sec may be programmed to accept a receive receive error FIFO is set at the same time that the clock that is one, sixteen, thirty-two. or sixty-four character is transferred to. the receive data FIFO. times the data rate. This is selected by bits 07 and This error bit accompanies the data to the top 01 06 in WR4. The 1X mode is used when. bits are the FIFO, where it generates a special receive synchronized external to the receiver. The 1X condition. The Framing Error bit is not latched, and mode is the only mode in which a data encoding so must be read in RR1 before the accompanying method other than NRZ may be used. The clock data is read. factor is common to the receiver and transmitter. ~ . The number of bits per character is controlled by The SCC provides up to three modem control bits 07 and 06 of WR3. Five, six, seven, or eight signals associated with the receiver. The SYNC bits per character may be selected via these two pin is a general-purpose input whose state is bits. Data is right-justifed with the unused bits set reported in the Sync/Hunt bit in RRO. If the crystal 5-1 oscillator is enabled, this pin is not available and to every transmitted character by setting bit DO of the Sync/Hunt bit is forced to "0". Otherwise, the WR4 to "1 ft. This bit is sent in addition to the SYNC pin may be used to c~rry the Ring Indicator number of bits spec.ified in WR4 or by the data ~. signal. The OTR/REO pin carries the inverted state format. The parity sense is selected by bit 01 of of the OTR bit (07) in WR5 unless this pin has WR4. If this bit is set to "1 ", the transmitter sends been programmed to carry a OMA Request signal. even parity, if set to "0", the parity is odd. The OCO pin is ordinarily a simple input to the OCO bit in RRO. However, if the Auto Enables mode is The transmitter may be programmed to send a selected by setting 05 of, WR3 to "1", this pin Break by setting bit 04 of WR5 to "1 The transmit- ft. becomes an enable for the receiver. That is, if ter will send continuous "Os" from the 'first transmit Auto Enables is on and the OC'O pin is HIGH, the clock edge after this command is issued, until the receiver is disabled. While the OCO pin is LOW, first transmit clock edge after this bit is reset. The the receiver is enabled. transmit' clock edges referred to here are those that define transmitted bit cell boundaries. The initialization sequence for the receiver in Asynchronous mode is: WR4 first to select the An additional status bit for use in Asynchronous mode, then WR3 and WR5 to 'select the various mode is available in bit 0o·or RR1. This bit, called options. ,At this point, the other registers should All Sent, is set when the transmitter is completely be initialized as necessary. When all of this is empty and any previous data or stop bits have complete the' receiver may be enabled by setting reached the TxO pin. The All Sent bit can be used bit Do or WR3 to "1". ' by the processor as an indication that the transmitter may be safely disabled. 5.1.2 Asynchronous Transmit The SCC may be programmed to accept a transmit clock ~hat is one, sixteen,' thirty-two, or sixty-four Asynchronous mode is selected by specifying the time the data rate. This is selected by bits 07 and number of stop bits per character in bits 03 and 02 06 of WR4, in common with the clock factor for the of WR4. The three options available are one, one- receiver. Note that the chosen crock factor may and-a-half, or two stop bits per character. These restrict the number of stop bits that may be trans- two bits only select the number of stop Qits for the mitted. In particular, whenthe clock rate and data transmitter, as the receiver always checks for one rate are identical, one-and-a-half stop bits are not stop bit. allowed.. If any length other than one stop bit is desired in the times one mode, only two stop bits The number of bits per transmitted character is maybe used. controlled both by Bits 06 and 05 in WR5 and the way the data is,formatted within the transmit buffer. There are two modem control signals' associated The bits in WR5 allow the option of five, six, seven, with the transmitter provided by the SCC. The or eight bits per character. .When five bits per RTS pin is a simple output that carries the inverted character is selected the data may be formatted state of the RTS bit (01) in WR5, unless the Auto before' being written to the transmit buffer to allow Enables bit (05) is set in WR3. When Auto transmission of from one to five bits per character. Enables is set the RTS pin will immediately go LOW when the RTS bit is set. However, when the RTS bit is reset the RTS pin remains LOW until the This formatting is shown in Table 5-1. transmitter is completely empty and the last stop bit has left the TxO pin. Thus the 'RTS pin may be used to, disable external drivers for the transmit Table 5-1 Data Format-Five Bits Or Less data. The CTS pin is ordinarily a simple input to the CTS bit in RRO. However, if Auto Enables mode is 07 06 05 04 03 02 01 00 selected this pin becomes an enable for the transmitter. That is, if Auto Enables is on and the 1 1 1 1 0 0 0 0 One data bit CTS pin is HIGH, the transmitter is disabled; the 1 l' 1 0 0 0 0 0 Two data bits 1 1 0 0 0 0 0 0 Three data bits transmitter is enabled while the CTS pin is LOW. 1 0 0 0 0 0 0 0 Four data bits o· 0 0 0 0 0 0 0 Five data bits The initialization sequence for the transmitter in Asynchronous mode is: WR4 first to select ,the mode, then WR3 and WR5 to select the various In all cases the data must be right-justified, with the options. At this point the other registers should be unused bits being' ignored except in the case of initialized as necessary. When all of this is five bits per character. An additional bit, carrying cotnplete~ the transmitter may be enabled by parity information, may be automatically appended setting bit 03 of WR5 to "1 ". Note that the 5-2 transmitter and receiver may be initialized at the bit selects a 12-bit sync character. The same time. arrangement of the sync character in WRS and WR7 is shown in Figure 5-1. For those applications requiring any other sync character 5.2 SYNCHRONOUS MODE length, the see makes provision for an external a circuit to provide character synchronization signal In synchronous modes of operation a special bit on the SYNC pin. This mode is selected by setting pattern is used to provide character synchro~ bits 05 and D4 of WR4 to "1". In this mode the nization. The SCC offers" several options to Sync/Hunt bit in RRO reports -the state of the SYNC support Synchronous mode including "various pin but the receiver must still be placed in Hunt sync character lengths, the number of bits per data mode when the external logic is searching for a character, parity generation and checking, CRC sync character match. When the receiver is in Hunt generation and checking, as well as -modem mode and -the' $YNC pin is driven LOW, two controls and a transmitter to receiver synchroniz- receive clock cycles after the last bit of the sync ation function. Synchronous mode is selected by character-is received, character assembly will begin programming bits 03 and 02 of WR4 with "Os". on the rising edge of the receive clock immediately This selects Synchronous mode, as opposed to preceding the activation of SYNC. This is shown in Asynchronous mode, but this selection is further Figure 5-2. The receiver leaves Hunt mode when modified by bits Os and 07 of WR4 as well as btts" SYNC is driven LOW. In all cases except External 01 and 00 of WR10. The sync character or char- Sync mode the SYNC pin is an output that is driven acters are written in WR6 and WR7. In all synchron- LOW by the SCC to signal that a sync character has ous modes, except External Sync the state of bits been received. !he SYNC pin is' activated 07 and 06 of WR4 are forced to "0" to select the regardless of character boundaries so any external -~ times one clock mode. In Extemal Sync mode circuitry using it should only respond the SYNC these two bits must be programmed with "Os". pulse that occurs while the -receiver is in Hunt mode. The timing for the SYNC' signal is shown in Figure5~3. - 5.2.1 Synchronous Receive" The number of bits per character is controlled by The receiver in the 'SCCsearches for character bits 07 and D6 of WR3. Five, six, seven, or eight synchronization only while it is in Hunt mode. In bits per character may be selected via these two this -mode the receiver is idle except that it is bits. The data is right-justified in the receive data searching the incoming data stream for a sync buffer. The" sec merely takes a snapshot of the character match. The receiver is in Hunt mode receive data stream at the appropriate times so the when it is first enabled, and may be placed in Hunt "unused" bits in the receive buffer are only the bits mode by command from the processor. This is . following the character in the data stream. An accomplished by issuing the Enter Hunt Mode additional bit, carrying parity information, may be command in WR3. This bit (04) is a command; selected by setting bit Do of WR4 to "1 It.If this bit writing a "0" to it has no effect. The Hunt status of is set to "1", the received character is checked for the receiver is reported by the Sync/Hunt bit in even parity, if set to "0", the received character is RRO. Sync/Hunt is one of the possible sources "of" checked for odd parity. The additional b.it per external/status interrupts, with both transitions character is visible in the receive data FIFO if the causing an interrupt. This is true even if the data plus parity is eight bits or less. The parity bit is Sync/Hunt bit is set as a result of the processor not visible when there are eight data bits per issuing the Enter Hunt Mode command. character. The Parity Error bit in the receive error FIFO may be programmed to cause a Special An 8-bit sync character is selected by setting bits Receive Condition· interrupt by setting bit 02 of Os and 04 of WR4, as well as bit Do of WR10, to WR1 'to. "1 ". This error bit is latched and so will "0". With this option the receiver searches the remain active, once set, until an Error Reset data stream for a match with the eight bits in WR7. command has been issued. If interrupts are not The 6-bit sync option requires the same used to transfer data the Parity Error, CRC Error, programming except that DO of WR10 is set to "1" and Overrun Error bits in RR1 should be checked and the sync character is held in the high-order six before the data is removed from the receive data bits of WR7. The SCC also allows the option of FIFO. The character length may be changed at any double length sync characters. This is selected by time before the new number of .bits haS -been setting bit Ds of WR4 t6 "0" and bit D4 of WR4 to assembled by the receiver, but, care should be ex- "1 ". The selection between 12 and 16 bits of sync ercised as unexpected results may occur. -A repre- character is controlled by bit DO of WR 10. A "Oil sentative example, switching from five bits 'to eight selects 16 bits of sync character, while a "1" in this bits and back to five bits is shown in Figure 5-4. 5-3 It is sometimes. desirable to prevent sync transmitter. The initial state of the generator and characters in the receive data stream from being checker is controlled by bit 07 of WR10. When this transferred to the· receive data FIFO. This function bit is set to "1 both the generator and checker will If, is available in the SCC by setting the Sync have an initial value of all ones, if this bit is set to Character Load Inhibit bit (01) in WR3 to "1 While If. "0", the initial values will be .all "Os". The SCC this bit is set to "1", character about to be loaded presets the checker whenever the receiver is in into the receive data, FIFO is compared with the Hunt mode so a CRC reset command is not strictly contents of WR6. If all eight bits match the necessary. However" the CRC checker may be character, it is not loaded into the receive data preset by issuing the' Reset CRC Checker FIFO. Because the comparison is across eight command in WRO. This command is encoded in bits, this function works correctly only when the bits 07 and Os of WRO. If CRC is to be used the number of bits per character is the same as the CRC checker must be enabled by setting bit DO of sync character length. Thus it cannot be used with WR3 to "1". If sync characters are being stripped 12- or 16-bit sync characters. Both leaqing sync from the data stream, this may be done at any time characters and sync characters embedded in the before the first non-sync character is rece.ived. If data will be properly removed in the case of an a-bit the sync strip feature is not being used, CRC must sync character, but only the leading sync not be enabled until after the first data character characters may be properly removed in the case of has been transferred to'the .receive data FIFO. As a 6-bit sync character. Care must be exercised in previously mentioned, a-bit sync characters using this feature because sync .characters not stripped form the data stream are automatically transferred to the receive data FIFO will excluded from CRC calculation. automatically be excluded from CRC calculation. This works properly only in the a-bit c~se. Some synchronous protocols require that certain characters be excluded from CRC calculation. This Either o.f two CRC polynomials may be used in is possible in the SCC because CRC calculation synchronous mode~. selected by bit. O2 in WRS. If may be enabled and disabled on the fly. To give this bit is set to "1", the CRC-16 polynomial. is the processor sufficient time to decide whether or used, if this bit is set to "0", the CRC-CCITT not a particular character should be included in the polynomial is u~ed. This bit controls the CRC calculation, the see contains an a-bit time polynomial selection for both the receiver and delay between the receive shift register and the S YNC 7 SYNC6 SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo MONOSYNC, 8 BITS SYNC1 SYNCo SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo MONOSYNC, 6 BITS SYNC7 SYNC6 SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo BISYNC, 16 BITS SYNC3 SYNC2 SYNC1 SYNCo 1 1 1 1 BISYNC, 12 BITS ADR7 A DR 6 ADRs A DR4 ADR3 AOR2 ADR1 ADRo SDLC A DR7 ADR6 ADRs ADR4 x x )( x SOLC (ADDRESS RANGE) , SYNC7 SYNC6 SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo MONOSYNC, 8 BITS SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo x x MONOSYNC, 6 BITS SYNC1S SYNC14 SYNC13 SYNC12 SYNC1'1 SYNC10 SYNCg SYNCs BISYNC, 16 BITS SYNC11 SYNC 10 ,. SYNCg SYNCs SYNC7 SYNC6 SYNCs SYNC4 BISYNC, 12 BITS 1 1 1 1- 0 SDLC 0 1 1 07513A 5-1 Figure 5·1 Sync Character Programming 5-4 , J , ) ATxC AxD SYNC '<....-.--_--- 07513A 5-2 Figure 5-2 SYNC as an Output 01 c.'n RTxC I LI PCLK SYNC 07513A 5·3 Figure 5-3 SYNC as an Input CRC checker. The logic also guarantees that the processor reads C and leaves the CRC enabled. calculation will only start or stop on a character At the end of these eight-bit-times the SCC has boundary by delaying the enable or disable until calculated CRC on B, character C is the 8-bit delay the next character is loaded into the receive data and D is in the Receive Shift register. D is then FIFO. To understand how this works refer to loaded into the receive data buffer and at some Figure 5-5 and the following explanation. point during the next eight-bit-time the processor Consider a case where the SCC receives a reads D and disables CRC. At the end of these sequence of eight bytes, called A, B, C, D, E, F, G eight-bit-times CRC has been calculated on C, and H with A received first. Now suppose that A is character D is in the a-bit delay and E is in the the sync character, that CRC is to be calculated on Receive Shift register. B, C, E, and F, and that Fis the last byte of this message. Before 'A is received the receiver is in , Now E is loaded into the receive data FIFO and, at Hunt mode and the CRC is disabled. When A is in : the same time, the CRC is disabled. During the the receive shift register it is compared with the next eight-bit-times the processor reads E and contents of WR7. Since A is the sync character, enables the CRC. During this time E shifts into the the bit patterns match and receiver leaves Hunt 8-bit delay, F enters the Receive Shift register and mode, but character A is not transferred to the CRC is not being calculated on D. After these receive data FIFO. The CRC remains disabled eight-bit-times have elapsed, E is in the a-bit delay, even though some,where during the next eight-bit- and F is in the Receive Shift register. Now F is time the processor reads B and enables CRC. At transferred to the receive. data FIFO and CRC is the end of an eight-bi.t-time, B is in the 8-bit delay enabled. During the next· eight-bit-times the and C is in the receive ·shift register. At this point, processor reads F and leaves the .CRC enabled. B is loaded into the receive data FIFO. The CRC The processor is usually aware that this is the last remains disabled even though somewhere during character in the message and so prepares to check ~. the next eight bit times the processor reads Band the result of the CRC computation. However, enables CRC. At the end of the eight-bit-time, B is another sixteen bit-times are required before CRC in the a-bit delay and C is in the receive shift has' been calculated on all of character F. At the register. Character C is loaded into the receive end of eight-bit-times F is in the 8-bit delay and G is data FIFO and at the same time the CRC checker is in the Receive Shift register. At this time G is enabled. During the next ·eight-bit-time, the transferred to the receive data FIFO. Character G ~. RECEIVE DATA BUFFER TIME I 1..8 1_1 5 BITS 1..1_3 _12_1_1_10_ _9 6_1 8 BITS CHANGE FROM FIVE TO EIGHT ~ 1 21 20 19 18 17 16 15 141 8 BITS 1 29 28 27 26 25 24 23 .221 5 BITS C~ANG~ FROM EIGHT TO FIVE - - . - . l34 33 32 31 30 29 28 27 I 5 BITS 139 38 37 36 35 34 33 32 1 07513A 5-4 Figure 5·4 Changing Character Length 5-6 must be read and discarded by the processor. WR3 and WRS to select the various options. At Eight bit times later H is transferred to the receive this point the other registers should be initialized data FIFO also. The result of a CRC calculation is latched in the receive error FIFO at the same time as data is written to the receive data FIFO. Thus the ° as necessary. When all of this is complete the receiver is enabled by setting bit of WR3 to "1 n. CRC result through character F accompanies character H in the FIFO and will be valid in RR1 until 5.2.2 Synchronous Transmit character H is read from the receive data FIFO. The CRC checker may be disabled and reset at any Once Synchronous mode has been selected, any time after character H is transferred to the receive of three sync character lengths may be selected. data FIFO. Recall, however, that internally CRC will An 8-bit sync character is selected by setting bits not be disabled until a character is loaded into the Ds and D4 or WR4, as well a's bit 00 of WR1 0 to "0". receive data, FIFO so the reset command should With this option selected the transmitter sends the not be issued until after this occurs. A better contents of WR6 when it has no data to send. The alternative is to place the receiver in Hunt mode, S-bit sync option requires the same programming which automatically disables and resets the CRC except that bit 00 of WR10 is set to "1" and only checker. the least significant six bits of WRS and used as a time fill. For a 1S-bit sync character, set bit 0 4 of Up to two modem control signals associated with WR4 to "1" and bit Os of WR4 and bit DO of WR10 the receiver are available in synchronous modes. to "Q". In this mode ,the transmitter sends the The OTR/REO pin carries the inverted state of the concatenation of WRS and WR7 as a time fill. DTR bit (07) in WRS unless this pin has been Because the rece iver requ ires that sync characters programmed to carry a OMA Request signal. The be left-justified in the registers, while the OCD pin is ordinarily a simple input to the DCD bit in transmitter requires them to be right-justified, only RRO. However, if the Auto Enables mode is the receiver will work with a 12-bit sync character. selected by setting 05 of WR3 to "1", this pin While the receiver is in External Sync mode the becomes an enable for the receiver. That is, if transmitter sync length may be six or eight bits, as Auto Enables is on and the OCO pin is HIGH the selected by bit DO of WR1 O. receiver is disabled; while the OCD pin is LOW the receiver is enabled. The number of bits per transmitted character is controlled by bits Os and Os of WRS and the way The initialization sequence for the receiver in sync- the data is formatted within the transmit buffer. hronous modes is WR4 first, to select the mode, The bits in WRS allow the option of five, six, seven, then WR10 to modify it if necessary, WRS and or eight bits per character. When five bits per WR7 to program the sync characters and then character is selected the data may be formatted RECEIVE DATA------I~ EIGHT BIT TIME DELAY CRC CHECKER 07513A 5-5 Figure 5-5 Receive CRC Data Path before. being written to the transmit buffer to allow this, bit is reset when the underrun occurs, the transmission of from one to five bits per character. transmitter will send the. accumulated CRC This formatting is shown in Table 5-1. In all cases followed by sync characters. When the CRC is the data must be right-justified, with the unused loaded into the transmit Shift register for bits being ignored except in the case of five bits transmission, the SCC will set the Tx Under- per character. An additional bit, carrying parity run/EOM bit to indicate this. This transition may be information, may be automatically appended to programmed to cause an externaVstatus interrupt, every transmitted character by settin.g bit DO of or the Tx UnderrunlEOM is available in RRO. The WR4 to "1". This parity bit is sent in aadition to the Reset Tx UnderrunlEOM Latch command is number of bits specified in WR4 or by the data encoded in bits 07 and Os of WRO. For correct format. If this bit is .set to "1", the. transmitter will transmission of the CRC at the end of a block of send even parity, if set to "0", the transmitted parity data, this command must be issued after the first will be odd. character is written to the SCC but before the transmitter underruns after the last character Either of two CRC polynomials may be used in written to the SCC. The command is usually synchronous modes, selected by bit 02 in WRS. If issued immediately after the first character is writ- this bit.is set to "1", the CRC-16 polynomial is used ten to the SCC so that CRC will be sent if an under- and, if this bit is set to "0", the CRC-CCITT run occurs inadvertently during the block of data. polynomial is ll$ed. This bit controls the selection for both the transmitter and 'receiver. The initial In synchronous modes, if the transmitter is state of the generator and checker is controlled by disabled during transmission of a character, that bit 07 of WR10. When this bit is set to "1", both character will be sent completely. This applies to the .generator and checker will have an initial value both data and sync characters. However, if the of all ones, if this bit is set to "0", the initial values transmitter is disabled during the transmission of wU'1 be all zeros. The SCC does not automatically CRC, the 16-bit transmission will be completed, preset the CRC generator, so this must be done in but the remaining bits will come from the SYNC software. This is accomplished by issuing the registers rather than the remainder of the CRC. Reset Tx CRC Generator command, which is encoded in bits 07 and Os of WRO. For proper There are 'two modem control signals associated results this. command must be issued while the with the transmitter provided by the SCC. The transmitter is 'enabled and sending sync RTS pin is a simple output that carries the inverted characters. If CRC is to be used, the transmit CRC state of the RTS bit (01) in WR5. The CTS pin is generator ,must be enabled by setting bit DO of ordinarily a simple input to the CTS bit in RRO. WRS to "1". This bit may also be used to exclude However, if Auto Enables mode is selected this pin certain characters from the CRC calculation. Sync becomes an enable for the transmitter. That is, if characters are automatically excluded from the Auto Enables is on and the CTS pin is HIGH the CRC calculation and any characters written as data transmitter is disabled. While the crs pin is LOW, may also be excluded from the calculation by using transmitter is enabled bit DO of WRS. Internally, the CRC is enabled or disabled for a particular character at the same time The initialization sequence for the transmitter in as the character is loaded from the transmit buffer synchronous modes is: WR4 first, to select the to the Transmit Shift register. Thus, to exclude a mode, then WR10 to modify it if necessary, WR6 character from CRC calculation b", DO of WRS and WR7 to program the sync characters, then should be set to "0" before the character is written WR3 and WRS to program the sync characters, and to the transmit buffer. This guarantees that the' then WR3 and WRS to select the various options. internal disable will occur when the character At this point, the other registers should be moves from the buffer to the shift register. Once initialized as necessary. When all of this is the buffer becomes empty, the Tx CRC Enable bit complete the transmitter may be enabled by may be written for the next character. . . setting bit 0 3 or WR5 to "1". Now that the transmitter is enabled the CRC generator may be Enabling the CRC generator is not sufficient to initialized by issuing the Reset Tx CRC Generator control the transmission of CRC. In the SCC this command in WRD. function is controlled by the Tx Underrun/EOM bit, which may be reset by the processor and set by the SCC. When the transmitter underruns (both 5.2.3 Transmitter to Receiver the transmit buffer and Transmit Shift register are Synchronization empty) the state of the Tx Underrun/EOM bit determines the action taken by the' SCC. If the tx The sec contains a transmitter-to-receiver UnderrunlEOM bit is set when the underrun synchronization function that may be used to occurs, the transmitter will send sync characters, if guarantee that the character boundaries for the 5-8 received and transmitted data are the same. In this leaves Hunt mode the transmitter is activate on the mode the receiver is in Hunt and the transmitter is following character boundary. idle, sending either all "1s" or all "Os". When the receiver recognizes a sync character, it leaves Hunt mode and one character time later the 5.3 SOLe MODE transmitter is enabled and begins sending sync characters. Beyond this point the receiver and SOLC mode is useful in bit-oriented protocols. transmitter are again completely independent, That is, protocols which use the technique of "0" except that the character boundaries are now insertion to achieve data transparency. In SOLC aligned. This is shown in Figu re 5-6. There are mode, frames of information are opened and several restrictions on the use of this feature in the closed by a unique bit pattern called a flag. The SCC. First, it will only work with 6-bit, a-bit or 16-bit Flag character has a bit pattern of "01111110" and sync characters, and the data character Iength for this sequence is unique because all data between both the receiver and the transmitter must be six the opening and closing flags is prohibited from bits with a 6-bit sync character or eight bits with an having more than five consecutive "1s". The a-bit or 16-bit sync character. Of course, the transmitter guarantees this by watching the receive and transmit clocks must have the same transmit data stream and inserting a "0" after five rate as well as the proper phase relationship. consecutive ones, irrespective of character boundaries. In turn, the receiver searches the A specific sequence of operations must be receive data stream for five consecutive "1 s" and followed· to synchronize the transmitter to the deletes the next bit if it is a "0". CRC may be used receiver. Both the receiver and transmitter must in SOLC mode but only with the CRC- CCITI have been initialized for operation in Synchronous polynomial, because the transmitter in the SCC mode sometime in the past, although this automatically inverts the CRC before transmission, initialization need not be redone each time the and the receiver -to compensate for this-ehecks transmitter is synchronized to the receiver. The the CRC result for the bit pattern transmitter is disabled by setting bit 03 of WRS to "0001110100001111". This is consistent with bit- "0". At this point the transmitter will send oriented protocols such as SOLC, HOLC, and continuous "1 s". If it is desired that continuous AOCCP. There are two unique bit patterns in "Os" be transmitted, the Send Break bit (04) in SOLC mode besides the flag sequence. They are WR5 should be set to "1". The transmitter is now the Abort and EOP (End of Poll) sequence. An idling but must still be placed in the transmitter to Abort is a sequence of from seven to thirteen receiver synchronization mode. This is accom- consecutive "1 s" and is used to signal the plished by setting the Loop Mode bit (01) in WR10 premature termination of a frame. The EOP is the and then enabling the transmitter by setting bit 03 bit pattern "11111110", which is used in loop of WR5 to "1". At this point the processor should applications as a signal to a secondary station that it set the Go Active on Poll bit (04) in WR10. The may begin transmission. final step is to force the receiver to search for sync characters. If the receiver is currently disabled the SOLC mode is selected by setting bit 05 of WR4 to receiver will enter Hunt mode when it is enabled by "1" and bits 04, 03, and 02 of WR4 to "0". In setting bit DO of WR3 to "1 ". If the receiver is addition, the flag sequence must be written to already enabled it may be placed in Hunt mode by WR7. Additional control bits for SOLC mode are setting bit 04 of WR3 to "1". Once the receiver located in WR1 o. DIRECTION OF MESSAGE FLOW-----' RxD SYNC SYNC r_.....&-1 _SYNC.-....lI1 TXD LOW = 1 MANCHESTER LOW -> HIGH = 0 07513A 6-4 Figure 6-4 Data Encoding Methods 6-4 middle of the bit cell. In FMO a "1" is sent as no while the OPLL is disabled, and enables the edge transition in the center of the bit cell and a "O" is detector. If the DPLL is already enabled when this sent as a transition in the center of the bit cell. FMO command is issued, the·DPLL also enters Search encoded data contains sufficient information to Mode. While in Search mode, the counter is held recover a clock from the data. at a specific count and no outputs'are. provided. The DPLL remains in this status until an edge is The data encoding method should be selected in detected in the receive data stream. This first .the initialization procedure before the transmitter edge is assumed to occu r on a bit cell boundary, and receiver are enabled but no other restrictions and the DPLL will begin providing an output to the apply. Note, in Figure 6-4, that in NRZ and NRZI receiver that will properly sample the data. From ·the receiver samples the data only on one edge. this point on the DPLL will adjust-its output to However, in FM 1 and· FMO the receiver samples remain in phase with the receive data. If the first the data on both edges. Also, as shown in Figure edge that the OPLL sees does not occur on a bit 6-4, the transmitter defines bit cell boundaries by cell boundary, the DPLL will eventually lock on to one edge in all cases and uses the other edge in the receive data but it: will take longerto do so. FM1 and FMO to create the mid-bit transition. The OPLL may be programmed to"operate in either of two modes, as selected by command inWR14. 6.4 DIGITAL PHASE-LOCKED LOOP In the NRZI mode the OPLL clock must be 32 times the date rate. In this mode the transmit and receive Figure 6-5 shows a block diagram of the digital clock outputs of the DPLL are identical,and the phase-locked loop. It consists of a 5-bit counter, clocks are phased so that the receiver samples the an edge detector, and a pair of output. decoders. data in .the middle of the bit cell. InNRZI mode the The clock for the OPLL comes from the output of a OPLL does not require a transition in every bit cell, two-input multiplexer, and the two outputs go to so this mode is useful for recovering the clocking the transmitter and receive clock multiplexers. The information from NRZ and NRZI data streams. In OPLL·is controlled by the seven commands' that the FM mode the DPLL clock must be 16 times the are encoded in bits 07, 06, and 05 of WR14. data rate. In this mode the transmit clock output of the DPLL lags the receive clock outputs by 900, to The clock for the OPLL is selected by two of the make the transmit and receive bit cell boundaries commands in WR14. One command selects the the same, because the 'receiver must sample FM output' of the baud rate generator as the clock data at one-quarter and three-quarters bit time. In source, and the other command selects the RTxC FM mode the OPLL requires a transition in every pin as the clock source, independent of whether bit cell, and if this transition is not present in two the RTxC pin is a simple input or part of the crystal consecutively sampled bit cells, the DPLL will oscillator'circuit To avoid metastable problems in automatically enter the search mode. As in the the counter; the clock source selection should be case of the clock source selection, the mode of made only while OPLL is disabled, since arbitrarily operation should only be changed while the DPLL narrow pu Ises can be generated at the output of is disabled to prevent unpredictable results. the multiplexer when it changes status. The DPLL is enabled by issuing the Enter Search .6.5 NR,ZI MODE OPERATION Mode command in WR14. This command is also used to reset the DPLL to a known state if it is To operate in NRZI mode the DPLL must be suspected that synchronization has been lost. supplied with a clock that is 32 times the data rate. When used to enable the DPLL, the Enter Search The QPLL uses this clock, along with the receive Mode command unlocks the counter, which is held data, : to construct receive and transmit clock EDGE DETECTOR . ~~_ _-... ~ ......-..-............._ _..... RECEIVE CLOCK TRANSMIT CLOCK 07513A 6-5 Figure 6-5 Dig ital Phase-Locked Loop 6-5 outputs that are phased to properly receive and DPLL shortens its count by one during the next 0 transmit .data~ To do this, the DPLL divides each to 31 counting cycle, which effectively moves the bit cell into four' regions, and makes an adjustment edge of the clock that samples the receive data to the count cycle of the 5-bit counter dependent closer to the center of the bit cell. In NRZI mode, if upon in which region a· transition on the receive the DPLL does not see any transition during a data input occurred. This is shown in Figure 6-6. counting cycle, no adjustment is made in the Ordinarily, a bit cell boundary will occur between following counting cycle. If an adjustment to the count 15 and count 16, and the DPLL output will counting cycle is necessary the DPLL modifies cause the data to be sampled in the middle of the count five, either deleting it or doubling it. Thus bit, cell. The DPLL actually allows the transition only the LOW time of the DPLL output will be marking a bit cell boundary to occur anywhere lengthened or shortened. While the DPLL is in during the second half otcount 15 or the first half search mode, the counter remains at count 16, of count 16 without making a corre'ction to its count where the DPLL outputs are both HIGH. The cycle. However, if the transition ·marking a bit cell missing clock latches in the DPLL which may be boundary occurs between the middle of count 16 accessed in RR10, are not used in NRZI mode. An and count 31 the DPLL is sampling the data too example of the DPLL in operation is shown in early in the bit cell. In response to this the DPLL Figure 6-7. extends its count by one during· the next 0 to 31 counting cycle, which effectively moves the edge of the .clock that samples the receive data closer to 6.6 FM MODE OPERATION the center of the bit cell. In a similar manner, if the transition occurs between count 0 and the middle To operate in FM mode the DPLL must be of· count 15, the output of the DPLL is sampling supplied with a clock that is 16 times the data rate. the data too late in the bit cell. To correct this, the The DPLL uses this clock, along with the receive BIT CELL 1 __ CORRECTION ~~ ADD ONE COUNT SUBTRACT ONE COUNT NO CHANGE DPLL'OUTI 07513A 6-6 Figure 6-6 DPLL In NRZI Mode RECEIVE DATA I I I DPLL OUTPUT CORRECTION WINDOWS COUNT LENGTH 32 I 32 32 31 31 31 33 33 33 07513A 6-7 Figure 6-7 DPLL Operating Example 6-6 data, to construct receive and transmit clock adjustment to the counting cycle is necessary, the outputs that are phased to receive and transmit DPLL modifies count 5, either deleting it or data properly. In FM mode that the counter in the doubling it. If no adjustment is necessary, the DPLL still counts from 0 to 31 but now each cycle count sequence proceeds normally. While the corresponds to 2-bit cells. To make adjustments to DPLL is in search mode, the counter remains at remain in phase with the receive data, the DPLL count 16, where the receive output is LOW and divides a pair of bit cells into five regions, making the transmit output is LOW. This fact can be used the adjustment to the counter dependent upon' to provide a transmit clock under software control which region the transition on the receive data since the DPLL is in search mode while it it input occurred. This is shown in Figure 6-8. disabled. While the DPLL is disabled the transmit Ordinarily a bit cell boundary will occur between clock output of the DPLL may be toggled by count 15 or count 16, and the DPLL receive alternately selecting FM and NRZI move in the output will cause the data to be sampled 'at one- DPLL. The same is true of the receive clock. fourth and three-fourths of the way through the bit cell. The DPLL actually allows the transition In addition to FM encoded data, the DPLL may also marking a bit-cell boundary to occur anywhere be used to recover the clock from Manchester during the second half of count 15 or the first half encoded data, which contains a transition at the of count 16 without making a correction to its count center of every bit cell. Here it is the direction of cycle. However, if the transition marking a bit cell the transition that distinguishes a "1" from a "0". boundary occurs between the middle of count 16 Another way of looking at Manchester encoding is and the middle of count 19 the DPLL is sampling to realize that, during the first half of the bit cell the the data too early in the bit cell. In response to this data is sent, during the second half of the bit cell the DPLL extends its count by 1 during the next 0 the complement of the data is sent. This is shown to 31 counting cycle, which effectively moves the in Figure 6-9, along with the DPLL output if it receive clock edges closer to where they should thinks that the mid-bit transitions are really bit cell be. In FM mode any transitions occurring between boundaries. As is obvious from the figure, if the the middle of count 19 in one cycle and the middle receiver samples the data on the falling edge of of count 12 during the next cycle are ignored by the DPLL receive clock output, the Manchester the DPLL. This is necessary to guarantee that any data will be properly decoded. This occurs if the data transitions in the bit cells will not cause an receiver is programmed to accept NRZ data. adjustment to the counting cycle. From the above discussion together with an In FM mode the transmit clock and receive clock examination of FMO and FM 1 data encoding, it outputs from the DPLL are not in phase. This is should be obvious that only clock transitions necessary to make the transmit and receive bit cell should exist on the receive data pin when the boundaries coincide, since the receive clock must DPLL is programmed to enter search mode. If this sample the data one-fourth and three-fourths of is not the case the DPLL may attempt to lock on to the way through the bit cell. As in NRZI mode, if an the data transitions. With FMO encoding this BIT CELL 1 -.... __ CORRECTION ~ I_GN_O_R_ED ....IL:JJ t NO CHANGE NO CHANGE t RX DPLL OUT TlC DPLL OUT 1 ____ 07513A 6-8 Figure 6-8 DPLL in FM Mode 6-7 requires continuous "1 s" received when leaving and transmitter are enabled. When initializing the search. In FM1 encoding it is continuous "Os;" OPLL the clock source should be selected first, with Manchester encoded data this means followed by the selection of the operating mode. alternating "1 s" and "Os". With all three of these At this point the OPLL, may be enabled by issuing data encoding methods there will always be at least the Enter Search Mode command in WR14. Note one transition in every bit cell, and in FM mode the that a channel or hardware reset disables the OPLL is designed to expect this transition. In DPLL, selects the RTxC pin as the clock source for particular, if no transition occurs between the the OPLL, and places it in the NRZI mode. middle of count 12 and the middle of count 19, the OPLL is probably not locked onto the data properly. When the OPLL misses an edge the as INTERNALLOOPBAC~AUTOECHO One Clock Missing bit is RR10 is set to "1" and latched. It will hold this value until.a Reset Mission The sec contains two other features useful for Clock command is issued in WR14 or until the diagnostic purposes, controlled by bits in WR14. DPLL is disabled or programmed to enter the They are localloopback and auto echo. Search mode. Upon missing this one edge the OPLL takes no other action and does not modify Localloopback is selected when bit 04 of WR14 is its count during the next counting cycle. However, set to "1". In this mode the output of the if the DPLL does not see an edge between the transmitter is internally connected to the input of middle of count 12 and the middle of count 19 in the receiver. At the same time the TxO pin remains two successive 0 to 31 count cycles, a line error connected to the transmitter. In this mode the condition is assumed. If this occurs, the two OCO pin is ignored as a receive enable and the Clocks Mission bit in RR10 is set to "1" and CTS pin is ignored as a transmitter enable even if latched. At the same time the OPLL enters the the Auto Enables mode has been selected. Note Search mode. The DPLL makes the decision to that the OPLL input is connected to the RxO pin, enter Search mode during count 2, where both not to the input of the receiver. This precludes the the receive clock and transmit clock outputs are use of the DPLL in localloopback. LOW. This prevents any glitches on the clock outputs when search mode is entered. While in Auto echo is selected when bit 03 of WR14 is set search mode no clock outputs are provided by the to "1 ". In this mode the TxD pin is connected OPLL. The Two Clocks Missing bit in RR10 is directly to the RxD pin, and the receiver input is latched until a Reset Missing Clock command is connected to the RxD pin. In this mode the CTS issued in WR14, or until the DPLL is disabled or pin is ignored as a transmitter enable and the programmed to enter the Search mode. output of the transmitter does not connect to anything. If both the Local Loopback and Auto Echo bits are set to "1", the auto echo mode will be 6.7 DPLL INITIALIZATION selected, but both the CTS pin and OCD pin will be ignored as auto enables. This, however, should Initialization of the OPLL may be done at any time not be considered a normal operating mode, during the initialization sequence, but should however. Local Loopback is shown schematically probably be done after the clock modes have in Figure 6-1 0 and auto echo is shown been selected in WR11, and before the receiver schematically in Figure 6-11 . DATA MANCHESTER AX DPLL OUT TX DPLLOUT 07513A 6-9 Figure 6-9 Manchester Clock Recovery 6-8 RX ENABLE AxD 0------. N.C. RECEIVER TaD D...-----t----.....- -..... ~--......a LOCAL LOOPBACK 07513A 6-10 Figure 6-10 Local Loopback .~, DCD O ~-~UV~--l ""'" RXENABLE AxD RECEIVER ,~ TxD N.C. ----1 TR_A_N_S~M-ITT-E-R- .... TX ENABLE AUTO ECHO 07513A 6-11 Figure 6-11 Auto Echo 6-9 i ~":"1) I CHAPTER 7 .~ REGISTER DESCRIPTION 7.0 INTRODUCTION rupt control register and the master interrupt con- trol and reset register are shared by both channels. The following sections describe the SCC registers. Each register is detailed in terms of bit config- The only difference in register definition between uration, the active states (See Table 7-1) of each the Z8030 and Z8530 versions of the SCC exists bit, their definitions, their functions, and their· ef- in the command decode structure. The following fects upon the internal hardware and external pins. sections describe in detail each write register and the associated b~ configuration for each. Table 7·1 see Register Description 7.1.1 Write Register 0 (Command Register) Read Register Description WRO is the command register and the CRC reset code register. WRO in the AmZ8030 version varies RRO XmitlReceive Buffer Status and Ext Status slightly from that in the AmZ8530 version. Figure 7- RR1 Receive Condition StatuslResidue Codes RR2 Interrupt Vector (modified hi B Channel) 1 shows the bit configuration for the AmZ8530 RR3 Interrupt Pending (Channel A only) version and includes register select bits in addition RR8 Receive Buffer to command and reset codes. Figure 7-2 shows RR10 Loop/Clock Status the bit configuration for the AmZ8030 version and RR12 Lower Byte of Time Constant includes (in Channel B only) the address decoding RR13 Upper Byte of Time Constant select described in the Programming section. The RR15 External Status Interrupt Enable following bit description for WRO is identical for both versions except where specified. Write Register Description Bits 07 and 06: CRC Reset Codes 0 And 1 WRO Command Register WR1 lx/Rx Interrupt and Data Xfer Mode Definition WR2 Interrupt Vector Null code (00). This command has no effect on the WR3 Receive Parameters and Control SCC and is used when a write to WRO is necessary WR4 TxlRx Miscellaneous Parameters and Modes for some reason other than a CRC Reset WAS Transmit Parameter and Controls command. WR6 Sync Character or SOLC Address Field WR7 Sync Character or SDLC Flag Reset Receive CRC Checker (01). This command WR8 Transmit Buffer is used to initialize the receive CRC circuitry. It is WR9 Master Interrupt Control necessary in synchronous modes (excepISOLC) if WR10 Misc TransmitterlReceiver Control Bits the Enter Hunt Mode command in Write Register 3 WR11 Clock Mode Control is not' issued between received messages. Any WR12 Lower Byte of Baud Rate Generator Time action that disables the receiver initializes the CRC Constant circuitry. Resetting the Receive CRC Checker WR13 Upper Byte of Baud Rate Generator Time command is accomplished automatically in SOLC Constant WR14 Miscellaneous Control Bits mode. WR15 External Status/lnterrupt Control Reset Transmit CRe Generator (10). This com- mand initializes the CRC generator. It is usually issued in the initialization routine and after the CRC has been transmitted. A Channel· Reset will not 7.1 WRITE REGISTERS initialize the generator and this command should not be issued until after the transmitter has been The SCC write register set in each channel enabled in the inttialization routine. includes ten control registers (among them is the transmit buffer), two sync character registers, and Reset Transmit Underrun/EOM Latch (11). This two baud rate time constant registers. The inter- command controls the transmission of CRC at the 7-1 end of transmission (EOM). If this latch has been Bits 05-03: Command Codes reset, and a transmit underrun occurs, the SCC automatically appends CRC to the mes-sage. In Null Code (000). The Null command has no effect SOLC mode with Abort on Underrun se-Iected, the ontheSCC. SCC sends an abort, and Flag on under-run if the TX UnderrunlEOM latch as been reset. Point High (001). This command effectively adds eight to the Register Pointer (82-80) by allowing At·the start of. the CRC transmission, the Tx Under- WR8 through WR15 to be accessed. The Point runlEOM latch is set. The Reset command can be High command and the Register Pointer bits are issu'ed at any time during a message. If the trans- written simultaneously. This command is used mitter, is disabled, this command will not reset the only in the Z8530 version of the SCC., In 'the latch., However, if no External Status interrupt is l8030 version" the registers" are accessed as pending, or if a Reset External Status Int command described in the Programming section. accompanies this command while the transmitter is disabled, an .ExternaVStatus interrupt is gener- Reset External/Status Interrupts (010). After an ated with the Tx Underrun/EOM bit reset in RRO. ExternaVStatus interrupt (a change on a modem line or a break condition, for example),·the status bits in RRO are latched. This command re-enables the bits and allows interrupts to occur again a~ a result of a status change. Latching the status bits captures short pulses until the CPU has tim'e to I I I read the change. The SCC contains simple 0 0 0 REGISTER 0 queueing logic associated with most of the Q 0 1 REGISTER 1 external status bits in RRO. If' another ExternaV 0 1 0 REGISTER 2 Status condition changes while a previous 0 1 1 REGISTER 3 condition is still pending (Reset External/Status 1 0 0 REGISTER 4 Interrupts has not yet been issued) and this " 1 0 1 REGISTER 6 condition persists until after the. command is is- sued, th~ second change causes another 1 1 0 REGISTER 8 1 1 1 'REGISTER 7 0 0 0 REGISTER 8 , 0 0 1 REGISTER,9 0 1 0 REGISTER 10 0 1 1 REG,I~TER 11 ' >• o 0 NULL CODE 1 0 0 REGISTER 12 ~~ 1 0 1 REGISTER 13 ~~ o 1 NULL CODE 1 0 SELECT SHIFT LEFT MODE* 1 1 0 REGISTER 14 ~~ 1 1 1 REGISTER 15 ...... .......- 1 1 SELECT SHIFT RIGHT MODE* ----0 0 0 0, NULL COD~ 0 0 0 NULL CODE 0 ,9- ;1 POINT HIGH 0 0 1 NULL CODE 0 ',1 0-: RESET EXT/STATUS INTERRUPTS 0 1 0 RESET EXT/STATUS INTERRUPTS 0 .1 ',1- . SEND ABORT (SD,LC) 0 1 1 SEND ABORT (SDLC) 1 0 0 ENABLE INT ON NEXT Rx CHARACTER 1 0 0 ENABLE INT ON NEXT Rx CHARACTER 1 0 1 RESET TxlNT PENDING 1 0 1 RESET Tx INT PENDING 1 1 0 ERROR RESET 1 1 0 ERROR RESET 1 1 1 REser HIGHEST IUS 1 1 1 RESET HIGHEST IUS o 0--- NULL CODE ~~ .... .... -- o -I-- 1 RESET RxCRC CHECKER o -~ o ,-. 0 1 NULL CODE RESET Rx CRC CHECKER 1 '0 RESETTx CRC GENERATOR -~ -~ , 1 0 RESET Tx CRC GENERATOR 1 RESET Tx UNDERRUN/EOM LATCH --...... 1 -~ 0.-0--- 1 1 RESET Tx UNDERRUN/EOM LATCH *WITH POINT HIGH COMMAND 07513A 7-1 , 07513A 7-2 Figure 7-1 Write Register 0 (Z8530) Figure 7-2 Write Register 0 (Z8030) 7-2 External/Status interrupt. However, if this second Reset Highest IUS (111). This command resets status change does not persist (there are two the highest priority Interrupt Under Service (IUS) transitions), another interrupt is not generated. bit, allowing lower priority conditions to request Exceptions to this rule are detailed in the RRO interrupts. This command allows the use of the description. internal daisy chain (even in systems without an external daisy chain) and should be the last Send Abort (011). This command is used in SOLC operation in an interrupt service routine. mode to transmit a sequence of eight to thirteen "1 s." This command always empties the transmit buffer and sets Tx Underrun/EOM bit in Read Bits 2 through 0: RegisterO. Resister Selection Code Enable Interrupt on Next Rx Character (100). If the These· three bits select Registers 0 through 7. interrupt on the First Received Character mode is With the Point High command, Registers 8 selected, this command is used to reactivate that through 15 are selected. The Register Selection mode after each message is received. The next Code bits are used only in the AmZ8530 version. character to enter the receive FIFO causes a In the AmZ8030 version, bit 02 is always ceO." Bits Receive interrupt. Alternatively, the first·previously 01 and DO select Shift Left/Right. stored character in the FIFO will cause a Receive interrupt. The following is a summary of the bit descriptions for each write register (WR1-WR15) used in both Reset Tx Interrupt Pending (101). This command the AmZ8530 and AmZ8030 SCC. is used in cases where there are no more characters to be sent; e.g., at the end of a message. This command prevents further transmit 7.1.2 Write Register 1 interrupts until after the next character has been (Transmit/Receive Interrupt and Data loaded into the transmit buffer or until CRC has Transfer Mode Definition). been completely sent. This command is neces- sary to prevent the transmitter from requesting an Write Register 1 is the control register for the interrupt when the transmit buffer becomes empty various SCC interrupt and Wait/Request modes. (with Transmit Interrupt Enabled). Figure 7-3 shows the bit assignments for WR1. Error Reset (110). This command resets the error bits in RR1. If Interrupt on First Rx Character or Bit 7: WAIT/DMA Request Enable Interrupt on Special Condition modes are selected and a special condition exists, the data with the This bit enables the· Wait/Request function in special condition is held in the receive FIFO until conjunction with the Request/Wait Function this command is issued. If either of these modes is Select bit (86). If bit 7 is set to "1," the state of bit 6 selected and this command is issued before the determines the activity of the WAIT/REQUEST pin data has been read from the receive FIFO, the'data (Wait or Request). If bit 7 is set to ceO," the selected is lost. function (bit 6) forces the WAIT/REQUEST pin in IIL EXT INT ENABLE Tx INT ENABLE . PARITY IS SPECIAL CONDITION ...--r--- o ~~ 0 Rx INT DISABLE o ~~ 1 Rx INT ON FIRST CHARACTER OR SPECIAL CONDITION 10 INTON ALL Rx CHARACTERS OR SPECIAL CONDITION ~~ ------ 1 1 Rx INT ON SPECIAL CONDITION ONLY " " ' - - - - - - - - WAIT/DMA REQUEST ON RECEIVE/TRANSMIT ~ - - - - - - WAIT/DMA REQUEST FUNCTION ~ - - - - - - - WAIT/DMA REQUEST ENABLE 07513A 7-3 Figure 7-3 Write Register 1 7-3 to the appropriate inactive state (High for Request, Receive Interrupts Disabled· (00). This mode floating for Wait). prevents the receiver from requesting an interrupt and is normally used in a polled environment ~, where either the status bits in RRO or the modified Bit 6: WAIT/DMA Request Function vector in RR2 (Channel B) can be monitored to initiate a service routine. Although the receiver The request function is selected by setting this bit interrupts are disabled, a special condition can still to 111." In the Request mode, the WAIT/REQUEST provide a unique vector status in RR2. pin switches from High to Low when the SCC is ready to transfer data. When this bit is 110," the wait Receive Interrupt on First Character or Special function is selected. In the Wait mode" the Condition (01). The receiver requests an interrupt WAIT/REQUEST pin switches from floating to Low in this mode on the first available character (or when the CPU attempts to transfer data before the stored FIFO character) or on a special condition. SCC is ready. Sync characters to be stripped from the message stream do not cause interrupts. Bit 5: WAIT/DMA Request On Receive Transmit Special receive conditions are: receiver overrun, framing error, end of frame, or parity error (if This bit determines whether the WAIT/REQUEST selected). If a special receive condition occurs, the pin operates in the Transmit mode or the Receive data containing the error is stored in the receive mode. When set to "1 ," this bit allows the FIFO until an Error Reset command is issued by wait/request function to follow the state of the the CPU. receive buffer; Le., depending on the state of bit 6, the WAIT/REQUEST pin is active or inactive in This mode is usually selected when a Block relation to the empty or full state of the receive Transfer mode· is used. In this interrupt mode, a buffer. Conversely, if this bit is set to 110," the state pending special receive condition remains set until of the WAIT/REQUEST pin is determined by bit 6 either an Error Reset command. a channel or and the state of the transmit buffer. (Note that a hardware reset, or until receive interrupts are transmit request function is available on the disabled. OTR/REQUEST pin. This allows full-duplex opera- tion under OMA control for both channels.) The Receive Interrupt on First Character or Special Condition mode can be re-enabled by the Enable The request function may occur only when the Rx Interrupt on Next Character command in WRO. see is not selected; e.g., if the internal request becomes active while the sec is in the middle of a Interrupt on All Receive Characters or Special read or write cycle, the external request will not Condition (10). This mode allows an interrupt for become active until the cycle is complete. An every character received (or character in the active request output causes a OMA controller to receive FIFO) and provides a unique vector when a initiate a read or write operation. If the request on special condition exists. The Receiver Overrun bit Transmit mode is selected in either SDLC or and,the Parity Error bit in RR1 'are two special con- Synchronous Mode, the Request pin is pulsed ditions that are latched. These two bits must be Low for one PCLK cycle at the end of CRC reset by the Error Reset command. Receiver over- transmission to allow the immediate transmission of run is always a special receive condi-tion, and parity another block of data. can be programmed to be a special condition. If the Wait On Receive mode. the WAIT pin is active Data characters with special receive conditions are if the CPU attempts to read SCC data that has not not held in the receive FIFO in the Interrupt On All yet been received. In the Wait On Transmit mode, Receive Characters or Special Conditions Mode as the WAIT pin is active if the epu attempts to write they are in the other receive interrupt modes. data when the transmit buffer is still full. Both situations can occur frequently when block transfer Receive Interrupt on Special Condition (11). This instructions are used. mode allows the receiver to interrupt only on characters with a special receive condition. When an interrupt occurs, the data containing the error is Bits 4 and 3: Receive Interrupt Modes held in the receive FIFO until an Error Reset command is issued. When using this mode in These two bits specify the various character-avail- conjunction with a DMA, the DMA can be initialized able conditions that may cause interrupt requests. and enabled before any characters have been 7-4 received by the SCC. This eliminates the time- channel or hardware reset. critical section of code required in the' Receive Interrupt on First Character or Special condition mode; Le., all data can be transferred via the DMA 7.1.3 Write Register 2 {interrupt vector) so that the CPU need not handle the first received character as a special case. WR2 is the interrupt vector register. Only one vector register exists in the SCC, but it can be accessed through either channel. The interrupt Bit 2: Parity Is Special Condition vector can be modified by status information. This is controlled by the Vector Includes Status (VIS) If this bit is set to "1," any received characters with and the Status High/Statu~ Low bits in WR9. The parity not matching the sense programmed in WR4 bit positions for WR2 are shown in Figure 7-4. give rise to a Special Receive Condition. If parity is disabled (WR4), this bit is ignored. A special condition modifies the status of the interrupt 7.1.4 Write Register 3 (Receive Parameters' vector stored in WR2. During an interrupt ack- and Control) nowledge cycle, this vector can be placed on the data bus. This registe.r contains the control bits and parameters for the receiver logic as illustrated in Figure 7-5. Bit 1: Transmitter Interrupt Enable If this bit is set to "1," the transmitter requests an Bits 7 and 6: Receiver Bits/Character interrupt whenever the transmit buffer becomes empty. The state of these two bits determines the number of bits to be assembled as a character in the received serial data stream. The number of bits per Bit 0: External/Status Master Interrupt Enable character can be changed while a character is being assembled but only before the nur:nber of This bit is the master enable for External/Status 0" bits currently programmed is reached. Unused bits interrupts including DCD, CTS, SYNC pins, break, in the Received Data Register (RR8) are set to "1" abort, the beginning of CRC transmission when in asynchronous modes. In synchronous modes the TransmiUUnderrunlEOM latch is set, or when and SDLC modes, the SCC merely transfers an 8- the counter in the baud rate generator reaches bit section of the serial data stream to the receive "0." Write Register 15 contains the individual FI FO at the appropriate time. Table 7-2 lists the enable bits for each of these sources of number of bits per character in the assembled External/Status interrupts. This bit is reset by a character format. I ~::' II I L :~=:~:~RACTER LOAD INHIBIT -----V4 ~V3 > INTERRUPT VECTOR ADDRESS SEARCH MODE (SDLC) Rx CRC ENABLE " - - - - - - - - ENTER HUNT MODE L- Vs " - - - - - - - - - AUTO ENABLES --------V6 ..... - ..... - - - - - - - - - V7 -- o o 0 Rx 5 BITS/CHARACTER 1 Rx 7 BITS/CHARACTER "'--- 1 0 Rx 6 BITS/CHARACTER ~- .............. 1 1 Rx 8 BITS/CHARACTER 07513A 7-4 07513A 7-5 Figure 7-4 Write Register 2 Figure 7-5 Write Register 3 7-S Table 7-2 Receive Bits/Character zeros between the opening and closing character flags. This bit is ignored in asynchronous modes. ~. o o 5 8~s/Character Bit 2: Adress Search Mode (SOLe) o 1 7 B~s/Character 1 o 6 8~s/Character Setting this bit in SOLC mode causes messages 1 1 8 8~s/Character with addresses not matching the address programmed in WR6 to be rejected. No receiver interrupts can occur in this mode unless there is an Bit 5: Auto Enables address match. The address that the SCC at- tempts to match can be unique (1 in 256) or mul- This bit programs the function for both the OCO tiple (16 in 256), depending on the state of Sync and CTS pins. CTS becomes the transmitter Character Load Inhibit bit. The Address Search enable and OCD becomes the receiver enable mpde bit is ignored in all modes except SOLe. when this bit is set to "1." However, the Receiver Enable and Transmit Enable bits must be set before the DCD and CTS pins can be used in this Bit 1: SYNC Character Load Inhibit mariner. When the Auto Enables bit is set to "0 " the OCD and CTS pins are merely inputs to th~ If this bit is set to "1" in any synchronous mode corresponding status bits in Read Register o. The except SOLC, the SCC compares the byte in WR6 state of OCO is ignored in the Local Loopback with the byte about to be stored in the FIFO, and it mode. The state 6f CTS is ignored in both Auto inhibits this load if the bytes ate equal. The sec Echo and Local Loopback modes. does not calculate the CRC on bytes stripped from the Data stream in this manner. If the 6-bit sync option is selected while in Monosync mode, the Bit 4: Enter Hunt Mode compare is still across eight bits, so WR6 must be programmed for proper operation. This command forces the comparison of sync char- actersor Ilagsto assembled receive characters ,for If the 6-bit sync option is selected with this bit set the purpose of synchronization. After reset, the to "1 ," all sync characters except the one immed- SCC automatically enters the Hunt mode (except iately preceding the data are stripped from the asynchronous). Whenever a flag'o'r sync character message. If the 6-bit sync option is selected while is matched, the Sync/Hunt bit in Read Register 0 is in the Bisync mode, thiS bit isignored. reset and, if External/Status Interrupt Enable is set, an interrupt sequence is initiated. The SCC auto- The address recognition logic of the receiver is matically enters the Hunt mode when an abort con- modified in SOLC mode if this bit is set to "1;" Le., dition is received or when the receiver is disabled. only the four most significant bits of WR6 must match the receiver address. This procedure allows the SCC to receive frames from up to 16 separate Bit 3: Receiver CRC Enable sources without programming WR6 for each source (if each station address has the four most This bit is used to initiate CRC calculation at the significant bits in common). The address field in beginning of the last· byte transferred from the . the frame is still eight bits long. Receiver Shift register to the receive FIFO. This operation occurs independently of the number of This bit is ignored in SOLC mode if Address bytes in the receive FIFO. When a particular byte is Search mode has not been selected. to be excluded from CRC calculation, this bit should be reset before the next byte is transferred to the receive FIFO. If this feature is used, care Bit 0: Receiver Enable must be taken to ensure that eight bits per character is selected in the receiver because of an When this bit is set to "1,n receiver operation be- inherent delay from the Receive Shift register to gins. This bit should be set only after all other re- the CRC checker. ceiver parameters are established and the receiver is completely initialized. This bit is reset by a This bit is internally set to "1" in SOLC mode and channel or hardware reset command, and it the SCC calculates CRC on all bits except inserted disables the receiver. 7-6 7.1.5 Write Register 4 (Transmit/Receiver eight bits, depending on the state of the 6-bit/8-bit Miscellaneous Parameters and Modes) Sync bit in WR10. If the Sync Character Load Inhibit bit is set, the receiver strips the contents of WR4 contains the control bits for both the receiver WR6 from the .data stream if received within and the transmitter. These bits should be set in character boundaries. the transmit and receiver initialization routine before issuing the contents of WR1, WR3, WR6, Bisync (01). The concatenation of WR7 with WR6 and WR7. Bit positions for WR4 are shown in is used for receiver synchronization and as a time Figure 7-6. fill by the transmitter. The sync character can be 12 or 16 bits in the receiver, depending on the state of the 6-bit/8-bit Sync bit in WR10. The Bits 7 and 6: Clock Rate 1 And 0 transmitted character is always 16 bits. These bits specify the multiplier between the clock SOLC Mode (10). In this mode, SOLC is selected and data rates. In synchronous modes, the 1S and requires a Flag (01111110) to be written to mode is forced internally and these bits are WR7. The receiver address field should be written ignored unless External Sync mode has been to WR6. The SOLC CRC polynomial must also be selected. selected (WR5) in SOLC mode. 1X Mode (00). The clock rate and data rate are the External Sync Mode (11).. In this mode, the SCC same. In External Sync mode, this bit combination expects external logic to signal character specifies that only the SYNC pin can be used to synchronization via the SYNC pin. If the 'crystal achieve character synchronization. oscillator option is selected (in WR11), the internal SYNC signal is forced to "0." In this mode, bits 16X Mode (01). The clock rate is 16 times the data B7-86 of this register select special version of rate. .In External Sync mode, this ·bit combin-ation External Sync mode. In this mode, the transmitter specifies that only the SYNC pin can be used to is in Monosync mode using the contents of WR6 achieve character synchronization. as the time fill with the sync character length specified by the 6-bit/8-bit Sync bit in WR 1o. ~ 32X Mode (10). The clock rate is 32 times the data ! rate. In External Sync mode, this bit combination specifies that either the SYNC pin or a match with the character stored in WR7 will signal character synchronization. The sync character can be either six or eight bits long as specified by the 6-bit/8-bit Sync bit in WR10. I L PARITY ENABLE L PARITY EVEN/ODD 64X Mode (11). The clock rate is 64 times the data rate. With this. bit combination in External Sync o 0 SYNC MODES ENABLE mode, both the receiver and transmitter are placed o 1 1 STOP BIT/CHARACTER in SOLC mode. The only variation from normal 1 0 1% STOP BITS/CHARACTE SOLC operation is that the SYNC pin can be used 1 1 2 STOP BITS/CHARACTER to start or stop the reception of a frame by forcing the receiver to act as though a flag had been received. o 0 8 BIT SYNC CHARACTER o 1 16 BIT SYNC CHARACTER 1 0 SDLC MODE (01111110 FLAG) Bits 5 and 4: SYNC Modes 1 And a 1 1 EXTERNAL SYNC MODE These two bits select. the various options for o 0 X 1 CLOCK MODE character synchronization. They are ignored un- o 1 X16 CLOCK MODE less synchronous modes are selected in the stop 1 0 X32 CLOCK MODE bits field of this register. 1 1 X64 CLOCK MODE Monosync (00). In this mode, the receiver achieves character synchronization by matching the character stored in WR7 with an identical character in the received data stream. The 07513A 7-6 transmitter uses the character stored in WRG as a time fill. The sync character can be either six or Figure 7·6 Write Register 4 7-7 Bits 3 and 2: Stop Bits 1 and 0 Bit 0: Parity Enable These bits determine the number of stop bits When this bit is set, an additional bit position added to each asynchronous character that is beyond those specified in the bits/character transmitted. The receiver always checks for one control is added to the transmitted data and is stop bit in Asynchronous mode. A Special mode expected in the receive data. The Received Parity specifies that a Synchronous mode .is to be bit is transferred to the CPU as part of the data selected. 82 is always set to U1" by a channel or unless eight bits per character is selected in the hardware reset to ensure that the SYNC pin is in a receiver. known state after a reset. Synchronous Modes Enable (OO). This bit 7.1.6 Write RegisterS combination selects one of the synchronous (Transmit Parameter and Controls) modes specified by bits 84,85,86, and 87 of this register and forces the 1X Clock mode internally. WRS contains control bits that affect the operation of the transmitter. 82 affects both the transmitter 1 Stop Bit/Character (01). This bit selects Asyn- and the receiver. 8it positions for WRS are shown chronous mode with one stop bit per character. in Figure 7-7. 1 1/2 Stop Bits/Character (10). These bits select Asynchronous mode with 1-1/2 stop bits per Bit 7: Data Terminal Ready character. This mode can not be used with the 1X clock mode. This is the control bit fO,r the DTR/REO pin while the pin is in the OTR mode (selected in WR14). 2 Stop Bits/Character (11). These bits select When set, OTR is Low; when reset, OTR· is High. Asynchronous mode with two stop bits per This bit is ignored when OTR/REO is programmed transmitted character and check for one received to act as a REOUEST pin. This bit is reset by a stop bit. channel or hardware reset. Bit 1: Parity Even/Odd Bits 6 and 5: TX Bits/Chacter 1 and 0 This bit determines whether parity is checked as These bits control the number of bits in each byte even or odd. A U1" programmed here selects even transferred to the transmit buffer. 8its sent must parity, and a uO" selects odd parity. This bit is be right justified with lease significant bits·first. ignored if the Parity Enable bit is not set. The Five Or Less mode allows transmission of one to five bits per character; however, the CPU should format the data character as shown below in Table 7.3. In the Six or Seven Bits/Character modes, unused data bits are ignored. ~ :~SCRC ~ ENABLE Table 7·3 Tx Bits/Character 1 and 0 L SDLC/CRC.16 Tx ENABLE Tx BITS/ Tx BITS/ CHAR 1 CHAR 0 ~ - - - - SEND BREAK _..... _.... 0 0 5 or less b~s/ character o O. Tx 5 BITS (OR LESS)/CHARACTER 0 1 7 bits/character 1--1-- o ~I-- 1 Tx 7 BITS/CHARACTER 1 0 6 bits/character , 0 Tx 6 BITS/CHARACTER 1 1 8 bits/character 1--1-- , , Tx 8 BITS/CHARACTER """--~ L...-. DTR °7°6°5°4°3 02 01 DO 1 1 1 1 0 0 0 0 Sends one data bit 1 1 1 0 0 0 0 0 Sends two data bits ~ 1 1 0 0 0 0 0 0 Sends three data bits 07513A 7-7 1 0 0 0 0 0 0 0 Sends four data bits 0 0 0 0 0 0 0 0 Sends five data bits Figure 7·7 Write Register 5 7-8 Bit 4: Send Break Preset 1/Preset 0 bn in WR1 O. When set, this bit forces the TxO output to send continuous lias" beginning with the following trans- Bit 1: Request To Send mit clock, regardless of any data being transmitted at the time. This bit functions whether or not the This is the control bit for the RTS pin. When the transmitter is enabled. When reset, TxO continues RTS bit is set, the RTS pin goes Low; when reset, to send the contents of the Transmit Shift register, RTS goes High. In the Asynchronous mode with which might be syncs, data, or all 1&1 s." If this bit is the Auto Enables bit set, RTS goes High only after set while in the X21 mode (Monosync and Loop all bits of the character have been sent and the mode selected) and character synchronization is transmit-buffer is empty. In synchronous modes of achieved in the receiver, this bit is automatically the Asynchronous mode with auto enables off, the reset and the transmitter begins sending syncs or pin directly follows the state of this bit. This bit is data. This bit can· also be reset by a channel or reset by a channel or hardware reset. hardware reset. Bit 0: Transmit CRC Enable Bit 3: Transmit Enable This bit determines whether or not CRC is calculat- ed on a transmit character. If this bit is set at the Data is not transmitted until this bit is set, and the time the character is loaded from the transmit TxO output sends continuous 1&1 s" unless Auto buffer to the Transmit Shift register, CRC is Echo mode or SOLC Loop mode is selected. If calculated on that character. CRC is not automati- this bit is reset after transmission started, the cally sent unless this bit is set when the transmit .,~ transmission of data or sync characters is complet- underrun exists. ed. If the transmitter is disabled during the trans- mission of a CRC character, sync or flag characters are sent instead of CRC. This bit is reset by a 7.1.7 Write Register 6 (Sync Characters or channel or hardware reset. SOLe Address Field) WR6 is programmed to contain the transmit sync Bit 2: SDLC/CRC-16 character in the Monosync mode, the first byte of a 16-bit sync character in the External Sync mode. This bit selects the CRC polynomial used by both WR6 is not used in asynchronous modes. In the the transmitter and receiver. When set, the CRC- SOLC modes, it is programmed to contain the sec- 16 polynomial is, used; when reset, the SOLC ondary address field u:sed to compare against the polynomial is used. The SOLC/CRC polynomial address field of the SOLC Frame. In SOLC mode, must be selected when SOLC mode is selected. the SCC does not automatically transmit the station The CRe generator and checker can be preset to address at the beginning of a response frame. Bit all "as" or all "1 s", depending on the state of the positions forWR6 are shown in Figure 7-8. _ _.----1 I 1 1 -----. SYNC7 S YNC 6 I SYNCs SYNC4 SYNC3 I SYNC 2 SYNC 1 SYNCo MONOSYNC, 8 BITS SYNC1 SYNCo SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo MONOSYNC, 6 BITS SYNC7 SYNC6 SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo BISYNC, 16 BITS SYNC3 SYNC2 SYNC1 SYNCo 1 1 1 1 BISYNC, 12 BITS ADR7 A DR 6 ADRs ADR4 ADR3 AD R2 ADR1 ADRo SDLC ADR7 ADR6 ADRs ADR4 x x X x SDLC (ADDRESS RANGE) 07513A 7-8 Figure 7·8 Write Register 6 7-9 7.1.8 WriteRegister7 contains the Reset command bits. Only one WR9 (SYNC Character or SOLC Flag) exists in the see and can be accessed from either channel. The interrupt control bits can be WR7 is programmed to contain the receive sync programmed at the same time as the Reset character in the Monosync mode, a second byte command because these bits are only reset by a (the last eight bits) of a 16-bit sync character in the hardware reset. Bit positions for WR9 are shown in Bisync mode, or a Flag character (01111110) in Figure 7-1 O. the SOLC modes. WR7 may hold the receive sync character or a flag if one of the special versions of the External Sync mode is selected. WR7 is not Bits 7 and 6: Reset Command Bits used in Asynchronous mode. Bit positions for WR7 are shown in Figure 7-9. Together, these bits select' one of the reset commands for the SCC. Setting either of these bits to U1" disables both the receiver and the 7.1.9 Write Register 8 (Transmit Buffer) transmitter in the corresponding channel, forces TxD for that channel marking, forces the modem WR8 is the transmit buffer register. control signals High in that channel, resets all IPs and IUSs and disables all interrupts in that channel. Four extra PCLK cycles must be allowed beyond 7.1.10 Write Register 9 the usual cycle time after any of the active reset (Master Interrupt Control) commands is issued before any .additional commands or controls are written to the channel WR9 is the Master Interrupt Control register and affected. In the AmZ8530, four extra PCLK cycles SYNC7 SYNC6 SYNCs S YNC 4 SYNC3 SYNC2 SYNC1 SYNCo MONOSYNC, 8 BITS SYNCs SYNC4 SYNC3 SYNC2 SYNC1 SYNCo X X MONOSYNC, 6 BITS SYNC1S SYNC14 SYNC13 SYNC12 SYNC11 SYNC10 SYNCg SYNCs BISYNC, 16 BITS S YNC 11 S YNC 10 SYNCg SYNCs SYNC7 SY NC6 SYNCs SYNC4 BISYNC, 12 BITS o 1 1 1 1 1 1 o SDLC 07513A 7-9 Figure 7-9 Write Register 7 I ~:~c L:=MIE .......- - - - STATUS HIGH/STATUS LOW .......- - - - - 0 o 0 NO RESET o 1 CHANNEL RESET B o CHANNEL RESET A 1 FORCE HARDWARE RESET 07513A 7-10 Figure 7·10 Write Register 9 7-10 must be allowed .beyond the usual cycle time Bit 2: Disable Lower Chain before any additional command or controls are written to the SCC. The Disable Lower Chain bit can be used by the r~' CPU to control the interrupt daisy chain. Setting No Reset (00). This command has no effect. Itis this bit to "1" forces. the IEO pin Low, preventing used when a write to WR9 is necessary for some lower-priority devices on the daisy chain· from reason other th~n an SCC Reset command. requesting interrupts. This bit is reset by a hardware reset. Channel Reset B (01). Issuing this command causes a channel reset to be performed on Bit 1: No Vector Channel B. The No Vector bit controls whether or not the SCC Channel Reset A (10). Issuing this command will respond to an interrupt acknowledge cycle by causes a channel reset to' be performed on placing a vector on the data bus if the SCCis the ChannelA. highest-priority device requesting an interrupt. If this bit is set, no vector is returned; Le., ADO-AD7 Force Hardware Reset (11). The effects of this remain three-stated during an interrupt acknow- command are identical to those of a hardware ledge cycle, even if the SCC is the highest-priority reset, except that the Shift Right/Shift Left bit is device requesting an interrupt. not changed and the MIE, Status High/Status Low and DLC bits take the programmed values that Bit 0: Vector Includes Status accompany this command. The Vector Includes Status Bit controls whether or Bit 5: Not Used not the SCC will include status information in the vector it places on the bus in response to an Must be "0." interrupt acknowledge cycle. If this bit is set, the vector returned is variable, with the variable field Bit 4: Status High/Status Low depending on the highest-priority IP that is set. Table 7-4 shows the encoding of the status This bit controls which vector bits the SCC will information. This bit is ignored if the No Vector modify to indicate status. When set to "1:' the (NV) bit is set. SCC modifies bits V6, V5, and V4 according to Table 7-4. When set to "0," the SCC' modifies bits 7.1.11 Write Register 10 (Miscellaneous V1, V2, and V3 according to Table 7-34 This bit Transmitter/Receiver Control Bits) controls status in both the vector returned during an interrupt acknowledge cycle and the status in WR10 contains miscellaneous control bits for both RR2B. This bit is reset by a hardware reset. the receiver and the transmitter. Bit positions for WR10 are shown in Figure 7-11. Table 7-4 Interrupt Vector Modification V3 V2 V1 Status High/Status Low = 0 V4 V5 V6 Status High/Status Low = 1 0 0 0 Ch B Transmit Buffer Empty 0 0 0 0 1 1 1 0 1 Ch B External/Status Change Ch B Receive Character Avail. Ch B Special Receive Condition II I L ::~:8MB~::YNC ABORT/FLAG ON UNDERRUN 1 0 0 Ch A Transmit buffer Empty MARK/FLAG IDLE 1 0 1 Ch A External/Status Change L- GO ACTIVE ON POLL 1 1 0 Ch A Receive Character Avail. 1 1 1 Ch A Special Receive Condition "'--"'- -oo - 0 1 NRZ NRZI Bit 3: Master Interrupt Enable -1 -0 FM1 (TRANSITION = 1) -- 1 1 FMO (TRANSITION = 0) ~- This bit is set to 1 to globally enable interrupts, and ~-------- CRC PRESET I/O cleared to zero to disable interrupts. Clearing this bit to zero forces the IEO pin to follow the state of the lEI pin unless there is an IUS bit set in the SCC. 07513A 7-11 No IUS bit can be set after the MIE bit is cleared to zero. This bit is reset by a hardware reset. Figure 7·11 Write Register 10 7-11 Bit 7: CRC Presets I/O both the transmitter and the receiver, as illustrated in Table 7-5. All of the clocking options are avail- This bit specifies the initialized condition' of the re- able for all coding methods. The DPLL in the sec ceive CRC checker and the transmit CRG genera- is useful for recovering clocking information in tor. If this bit is set. to "1," the CRC generator and NRZI and FM modes. Any coding method can be checker are preset to "1." If this bit.is set to '~O/' the used in X1 mode. A hardware reset forces NRZ CRe generator and checker are preset to "0." mode. Timing for the various modes in shown in Either option can be selected with either CRC Figure 7-12. polynomial. In SDLC mode, the transmitted CRC is inverted before transmission and the received CRe is checked against the bit pattern Table 7-5 Data Encoding "0001110100001111 :" . This bit is reset by a phannel or hardware reset. This bit is ignored in Data D~ta Encoding Encoding Asynchronous mode. o o NAZ Bits 6 and 5: Data Encoding 1 And 2. o 1 NAZI 1 o FM1 (transition 1;1 1) . These bits control the coding method used for 1 1 FMO (transition 1;1 1) TRANIMITCLOCI!( DATA NRZ---+---~ N R Z I - - -.....- -.... pMI pMO------t RIICEIVE CLOCK DATA N R Z - - -......- - ~ N R Z I - - -.....- - - - f PMI PMO BIT CEll 07513A 7-12 Figure 7·12 NRZ{NRZI)FM1{FMO) Timing 7-12 Bit 4: Go Active On Poll the programmed value takes effect upon exiting the Loop mode. This bit is reset by a channel or When Loop mode is first selected during SDLC hardware reset. operation, the SCC connects RxD to TxD with only gate delays in the path. The SCC does not go on- loop and insert the 1-bit delay between RxD and Bit 2: Abort IFlag On Underrun TxO until this bit has been set and an EOP received. . When the SCC is on-loop, the This bit affects only SOLe operation and is used to transmitter cannot go active unless this bit is set at control how the sec responds to a transmit the time an EOP is received. The SCC examines underrun condition. If this bit is set to "1" and a this bit whenever the transmitter is active in SDLC transmit underrun occurs, the SCC sends an abort Loop mode and is sending a flag. If this bit is set at and a flag instead of CRC. If this bit is reset, the the time the flag is leaving the Transmit Shift SCC sends CRC on a transmit underrun. At the register, another flag or data byte (if the transmit beginning of this 16- bit transmission. the Transmit buffer is fun) is transmitted. If the Go Active on Poll Underrun/EOM bit is set. causing an Extemal/ bit is not set at this time, the transmitter finishes Status interrupt. The CPU 'uses this status, along sending the flag and reverts to the 1-8it Delay with the byte count from memory or the DMA, to mode. Thus, to transmit only one response frame, determine whether the frame must be retrans- this bit should be reset after the first data byte is mitted. A transmit buffer Empty interrupt occurs at sent to the sce but before CRC has been the end of this 16-bit transmission to start the next transmitted. If the bit is not reset before CRC is frame. If both this bit and the Mark/Flag Idle bit are transmitted, extra flags are sent, slowing down set to "1 ," all "1 S" are transmitted after the transmit response time on the loop. If this bit is reset underrun. This bit should be set after the first byte before the first data is written. the SCC completes of data is sent to the SCC and reset immediately the transmission of the present flag and reverts to after the last byte of data so that the frame will be the 1-Bit Delay mode. After gaining control of the terminated properly with CRC and a flag. This bit is loop, the SCC is not able to transmit again until a ignored in Loop mode, but the programmed value flag and another EOP have been received. is active upon exiting Loop mode. This bit is reset Though not strictly necessary, it is good practice to by a channel or hardware reset. set this bit only upon receipt of a poll frame to ensure that the sec does not go on loop without the CPU noticing it. Bit 1: Loop Mode In synchronous modes other than SDLC with the In SOLC mode. the initial set condition of this bit Loop Mode bit set. this bit must be set before the forces the SCC to connect TxD to TxO and to transmitter can go active in response to a received begin searching the incoming data stream so that it sync character. can go on loop. All bits pertinent to SDLC mode operation in other registers must be set before this This bit is always ignored in Asynchronous mode mode is selected. The transmitter and receiver and Synchronous modes unless the Loop Mode should not be enabled until after this mode has bit is set. This bit is reset by a channel or hardware been selected. As soon as the Go Active On Poll reset. bit is set and an EOP is received. the SCC goes on loop. If this bit is reset after the SCC goes on loop. If this bit is reset after the SCC is on loop, the sec Bit 3: Mark/Flag Idle waits for the next EOP to go off loop. This bit affects only SOLC operation and is used to In synchronous modes. the sec uses this bit, control the idle line condition. If this bit is set to along with the Go Active On Poll bit, to "0," the transmitter sends flags as an idle line. If synchronize the transmitter to the receiver. The this bit is set to "1," the transmitter sends receiver should not be enabled until after this continuous "1 s" after the closing flag of a frame. mode is selected. The TxO pin is held marking The idle line condition is selected byte by byte; when this mode is selected unless a break i.e.• either a flag or eight "1 s" are transmitted. The condition is programmed. The receiver waits for a primary station in an SOLC loop should be sync character to be received and then enables programmed for Mark Idle to create the EOP the transmitter on a character boundary. The break sequence. Mark Idle must be deselected at the condition, if programmed, is removed. This mode beginning of a frame before the first data is written works properly with sync characters of 6. 8. or 16 to the SCC, so that an opening flag can be bits. This bit is ignored in Asynchronous mode transmitted. This bit is ignored in Loop mode, but and is reset by a channel or hardware reset. 7-13 Bit 0: 6 Bit/S Bit SYNC connects a high-gain amplifier between the RTxC and SYNC pins in expectation of a quartz crystal This bit is used to select a special case of being placedacross the pins. synchronous modes. If this bit is set to "1" in Monosync mode. the receiver and transmitter sync The output of this oscillator is available for use as a characters are six bits long instead of the usual clocking source. In this mode of operation. the eight. If this bit is set to "1" in Bisync mode. the SYNC pin is unavailable for other use. The SYNC received sync will be 12 bits and the transmitter signal is forced to "0" internally. A hardware reset sync character will remain 16 bits long. This bit is forces NO XlAL. (At least 20 ms should be ignored in SDLC and ·Asynchronous modes but allowed after this bit is set to allow the oscillator to still has effect in the special external sync modes. stabilize.) This bn is reset by a channel.or hardware reset. Bits 6 and 5: Receiver Clock 1 And 0 7.1.12 Write Register 11 (Clock Mode Control) . These bits determine the source of the receive clock as shown in Table 7-6. They do not interfere WR11 is the Clock Mode Control register. The bits with any of the modes of operation in the SCC but in .this register control the sources of both the simply control a multiplexer just before the internal receive and transmit clocks. the type of .signal on receive clock input. A hardware reset forces the the SYNC and RTxC pins. and the direction of the receive clock to come from the TRxC pin. TRxC pin. Bit positions for WR11 are shown in Figure 7-13. Table 7-6 Receive Clock Source Receive Receive Bit 7: RTxC-XTAL/NOXTAL Clock 1 Clock 0 This bit controls the type of input signal the sec o o Receive Clock = RTxC pin expects to see on the RTxC pin. If this bit is set to o 1 Receive Clock = TRxC pin "0," the SCC expects a TTL-compatible signal as 1 o Receive Clock = SR output an input to this pin. If this bit is set to "1," the SCC 1 1 Receive Clock = DPll output o 0 TRxC OUT = XTAL OUTPUT o 1 TRxC OUT = TRANSMIT CLOCK o TRxC OUT = SR GENERATOR OUTPUT 1 TRxC OUT = DPLL OUTPUT ~-- TRxCO/i o 0 TRANSMIT CLOCK = RTxC PIN o 1 TRANSMIT CLOCK = TRxC PIN 1 0 TRANSMIT CLOCK = SR GENERATOR OUTPUT 1 1 TRANSMIT CLOCK = DPLL OUTPUT o 0 RECEIVE CLOCK = RTxC PIN o 1 RECEIVE CLOCK = TRxC PIN 1 0 RECEIVE CLOCK = SR GENERATOR OUTPUT 1 1 RECEIVE CLOCK = DPLL OUTPUT ' - - - - - - - - - - RTxC XTALINO XTAL 07513A 7-13 Figure 7·13 Write Register 11 7-14 Bits 4 and 3: Transmit Clock 1 and 0 Table 7-8 Transmit External Control Selection These bits determine the source of the transmit Output Output clock as shown in Table 7-7. They do not interfere Signal Signal with any of the modes of operation of the SCC but simply control a multiplexer just before the internal a o TRxC = XTAL oscillator output transmit clock input. The DPLL output that may be o 1 TRxC = Transmit Clock 1 o TRxC = SR outbut used to feed the transmitter in FM modes lags by 1 1 TRxC = DPLL output (receive) 90 the output of the DPLL used by the receiver. This makes the received and transmitted bit cells occur simultaneously, neglecting delays. A hard- ware reset selects the TRxC pin as the source of 7.1.13 Write Register 12 the transmit clocks. (Lower Byte of Baud Rate Generator Time Constant) Table 7-7 Transmit Clock Source WR12 contains the lower byte of the time constant Transmit Transmit for the baud rate generator. The time constant can Clock 1 Clock 0 be changed at any time, but the new value does not take effect until the next time the time constant o o Transmit Clock = ATxC pin is loaded into the down counter. No attempt is o 1 Transmit Clock = TAxC pin made to synchronize the loading of the time 1 a Transmit Clock = SA output constant into WR12 and WR13 with the clock 1 1 Transmit Clock = DPLL output driving the down counter. For this reason, it is advisable to disable the baud rate generator while the new time constant is loaded into WR12 and WR13. Ordinarily, this is done anyway to prevent a Bit 2: TRxC 011 load of the down counter between the writing of the upper and lower bytes of the time constant. This bit determines the direction of the TRxC pin. The formula for determining the appropriate time If this bit is set to "1," the TRxC pin is an output and constant for a given baud is shown below with the carries the signal selected by D1 and DO of this desired rate in bits per second and the SR clock register. However, if either the receive or the. period in seconds. This formula is derived transmit clock is programmed to come from the because the counter decrements from N down to TRxC pin, TRxC will be an input, regardless of the "O"-plus-one-cycle for reloading the time constant state of this bit. The TRxC pin is also an input if this and is then fed to a toggle flip-flop to make the bit is set to "0." A hardware reset forces this bit to output a square wave. Bit positions for WR12 are "0." shown in Figure 7-14. Time constant = [1/2 • desired rate • SR clock Bits 1 and 0: TRxC Output Source 1 And 0 period]-2 These bits determine the signal to be echoed out of the SCC via the TRxC pin. No signal is produced if TRxC has been programmed as the source of either the receive or the transmit clock. If ~ ~~~: TRxC 011 (bit 2) is set to "O,"these bits are ignored. If the XTAL oscillator output is programmed to be echoed, and the Xtal oscillator has not been L== TC 2 enabled, the TRxC pin goes High. The DPLL TC3 LOWER BYTE OF signal that is echoed is the DPLL signal used by L-- TC4 TIME CONSTANT the receiver. Hardware reset selects the XTAL ' - - - - - - - - TCs oscillator as the output source. ' - - - - - - - - TCs L..-- TC7 07513A 7-14 Figure 7-14 Write Register 12 7-15 7.1.14 Write Register 13 the Digital Phase-Locked Loop. A channel or (Upper Byte of Baud Rate hardware reset disables the DPLL, resets the Generator Time Constant) mission 'clock latches, sets the source to the RTxC pin and selects NRZI mode. The Enter Search WR13 contains the, upper byte of the time con- Mode command enables the DPLL after a reset. stant for the baud rate generator. Bit positions for WR13 are shown in Figure 7-15. Null Command (000). This command has no effect onthe DPLL. 7.1.15 Write Register 14 Enter Search Mode' (001). Issuing this command (Miscellaneous Control Bits) causes the DPLL to enter the Search mode, where the DPLL searches for a locking edge in the WR14 contains some miscellaneous control bits. incoming data stream. The action taken by the Bit positions for WR14 are shown in Figure 7-16. DPLL upon receipt of this command depends on the operating mode of the DPLL. Bits 7 and 5: Digital Phase-Locked Loop In NRZI mode, the output of the DPLL is High while Command Bits the DPLL is waiting for an edge in the incoming data stream. After the Search mode is entered, These three bits encode the eight co mmands for the first edge the DPLL sees is assumed to be a valid data edge, and the DPLL begins the clock recovery operation from that point. The DPLL 07513A 7-14 clock rate must be 32 times the data rate in NRZI mode. Upon leaving the Search mode, the first ~ ~~~:~ sampling edge of the DPLL occurs 16 of these 32X clocks after the first data edge and the second L TC 10 sampling edge occurs 48 of these 32X clocks after the first data edge. Beyond this point, the DPLL TC11 >UPPER BYTE OF begins normal operation, adjusting the output to - - - - - - TC12 TIME CONSTANT remain in sync with the incoming data. ......... 13 TC ~ TCu In FM mode, the output of the DPLL is Low while the DPLL is waiting for an edge in the incoming ' - - - - - - - - - - - TC15 J data stream. The first edge the 0 PLL detects is assu med to be a valid clock edge. For this to be the case, the line must contain only clock edges; Figure 7·15 Write Register 13 i.e., with FM1 encoding, the line must be continuous liDs." With FMO encoding the line must be continuous "1 s," whereas Manchester ~ 07513A7-16 encoding requires alternating "1 s" and liDs" on the line. The DPLL clock rate must be 16 times the III L BR GENERATOR ENABLE BR GENERATOR SOURCE data rate in FM mode. The DPLL output causes the receiver to sample the data stream in the nominal center of the two halves of the bit cell to DTR/REQUEST FUNCTION decide whether the data was a "1" or a "0." After AUTO ECHO this command is issued, as in NRZI mode, the DPLL starts sampling immediately after the first - - - - - - LOCAL LOOPBACK edge is detected. (In FM mode, the DPLL o 0 0 NULL COMMAND examines the clock edge of every other. bit cell to decide what correction must be made to remain in o 0 1 ENTER SEARCH MODE sync.) If the DPLL does not see an edge during o 1 0 RESET MISSING CLOCK the expected window, the one clock mission bit in o 1 1 DISABLE DPLL RR10 is set. If the DPLL does not see an edge 100 SET SOURCE = BR GENERATOR after two successive attempts, the two clocks 1 0 1 SET SOURCE = RTxC missing bit in RR10 is set and the DPLL 1 0 SET FM MODE automatically enters the Search mode. This 1 1 SET NRZI MODE command resets both clock missing latches. Figure 7·16 Write Register 14 7-16 Reset Clock Missing (010). Issuing this command Bit 2: OTR/Request Function disables the DPLL, resets the clock missing latches in RR10, and forces a continuous Search This bit selects the function of the DTR/REa pin mode state. follows ~ state of the OTR bit in WRS. If this bit is set to '~,' the DTR/REa pin follows the state of Disable DPLL (001). Issuing this command the DTR bit in WRS. If this bit is set to "1," the disables the DPLL, resets the clock missing DTR/REa pin goes Low whenever the transmit buf- latches in RR10, and forces a continuous Search fer becomes empty and in any of the synchronous mode state. mode when CRC has been sent at the end of a message. The request function on the DTR/REQ = Set Source BR Gen (100). Issuing this command pin differs somewhat from the transmit request forces the clock for the DPLL to come from the function available on the W/REQ pin in' that output of the baud rate generator. REQUEST does not go inactive until the internal operation satisfying the request is complete, which = Set Source RTxC (101). Issuing the command occurs four to five PCLK cycles after the rising forces the clock for the DPII to come from the RTxC edge of DS, READ or WRITE. If the DMA used is pin or the crystal oscillator, de-pending on the edge-triggered, this difference is unimportant. state of the XTAUno XTAL bit in WR 11. This This bit is reset by a channel or hardware reset. mode is selected by a channel or hardware reset. Bit 1: Baud Rate Generator Source Set FM Mode (110). This command forces the DPLL to operate in the FM mode and is used to This bit selects the source of the clock for the baud recover the clock from FM or Manchester-encoded rate generator. If this bit is set to "0," the baud rate data. (Manchester is decoded by placing the recei- generator clock comes from either the RTxC pin or ver in NRZ mode while the DPLL is in FM mode.) the XTAL oscillator (depending on the state of the Xl AUno XTAL bit). If this bit is set to "1 ," the clock Set NAZI Mode (111). Issuing this command for the baud rate generator is the SCC's PCLK forces the DPLL to operate in the NRZI mode. input. Hardware reset sets this bit to "0," selecting This mode is also selected by a hardware or the RTxC pin as the clock source for the baud rate channel reset. generator. Bit 0: Baud Rate Genterator Enable Bit 4: local Loopback This bit controls the operation of the baud rate Setting this bit to "1" selects the Local Loopback generator. The counter in the baud rate generator mode of operation. In this mode, the internal is enabled for counting when this bit is set to "1," transmitted data is routed back to the receiver, as and counting is inhibited when this bit is set to rcO." well as to the TxD pin. The CTS and DCD inputs When this bit is set to "1," change in the state of are ignored as enables in Local Loopback mode, this bit is not reflected by the output of the baud even if auto enables .is selected. (If so program- rate generator for two counts of the counter. This med, transitions on these inputs still cause allows the command to be synchronized. interrupts.) This mode works with any Transmit! However, when set to "0," disabling is immediate. Receive mode ex-cept Loop mode. For meaning- This bit is reset by a hardware reset. ful results, the frequency of the transmit and receive clocks must be the same. This bit is reset by a channel or hardware reset. 7.1.16 Write Register 15 (External/Status InterroptControl) Bit 3: Auto Enable WR15 is the External/Status Source Control register. If the External/Status interrupts are Setting this bit to "1" selects the Auto Enable enabled as a group via WR 1, bits in this register mode of operation. In this mode, the TxD pin is control which External/Status conditions can connected to RxD, as in Local Loopback mode, cause an interrupt. Only the External/Status but the receiver still listens to the RxD input. conditions that occur after the controlling bit are Transmitted data is never seen inside or outside sent to "1" will cause an interrupt. This is true even ~. the SCC in this mode, and CTS is ignored as a if an ExternaVStatus condition is pending at the transmit enable. This bit is reset by a channel or time the bit is set. Bit positions for WR15 are hardware reset. shown in Figure 7-17. 7-17 Bit 7: Break/Abort IE '. Bi~ 1: Zero Count IE '0 If this bit is set "1," a change in t~e Break/Abort o status of the receiver causes an External/Status If this bit is set to "1," an External/Status interrupt is generated whenever the counter in the baud rate interrupt. This bit is set by a channel ~rhardware generator reaches "0." This bit is set to "0" by a reset. . channel or hardware reset. Bi~ 6: rx Underr~n!EOM Bit 0: Not Used If this. bit.is set to .,,1," a ·change.;of state by the Tx Must be "0." Underrun/EOM latch in the transmiU~r caqses a.n External/Status interrupt. This bit is set to "1" by: a channel or: ~ar~are reset. 7.2 READ REGISTERS 80th t.he 28030 and the 28530 versions of the Bit~: eTSIE SCCcontain seven read registers in each channel. In addition there are two registers which are shared If this bit is set to "1 ," a change of state on the CTS by both·channels. The status of these registers is pin causes an· Ext.ernaVStatus interrupt. This bit is continually changing and depends on the mode of set by a channel or hardware reset. communication, received and transmitted data, and the manner"in which this'data is transferred 'to and from" the CPU. . The following description Bit 4: SYNC/Hunt IE details the" bit assignments for each register. If this bit is set. to "1.," a change of state on .the SYNC pin causes ·an External/Status interrupt in 7.2.1 Read Register 0 (Transmit/receive Asynchronous mode, and a change of state in the buffer Status and External Status) Hunt bit in the receiver causes and External/Status interrupt in synchronous modes. This bit is set by Read Register 0 contains the status of the receive "~ a channel or hardware reset. and transmit buffers. RRO also contains the status bits for the six sources of External/Status interrupts. The bit configuration is illustrated in Bit 3: DODJE Figure 7-18. If this bit is set to "1," a change 'of state on the DCD pin causes an ExternaVStatus interrupt. This" bit is Bit 7: Break/Abort .. · set by, a channel or hardware reset. In the Asynchronous mode, this bit is set when a Break sequence (null character"plusframing error) Bit 2 ::Not Used" is detected in the receive data stream. This" bit is reset when the· sequence is terminated, leaving a MustbeuO." single null character in the receive FIFO. This 07513A 7-17 07513A 7-18 II. I L Il~;ERO COUNT IE Rx CHARACTER AVAILABLE ZERO ,COUNT L...- ~DCDIE SYNC/HUNT IE . 1...- Tx BUFFER EMPTY OCD . SYNC/HUNT L--_---.;.. CTS IE ~-~---CTS L-- Tx"UNDERRUN/EOM IE 1.------- Tx UNOERRUN/EOM L...- BREAK/ABORT IE ~------- BREAK/ABORT Figure 7·17 Write Register 15 Figure 7·18 Read Register 0 7-18 character should be read and discarded. In SOLC The XTAL oscillator should not be selected in mode, this bit is set by the detection of an Abort External Sync mode. ~. sequence (seven or more "1 S"), then reset automatically at the termination of the Abort se- In Asynchronous mode, the operation of this bit is quence. In either case, if the Break/Abort IE bit is identical to that of the CTS status bit, except that set, an External/Status interrupt is initiated. Unlike this bit reports the state of the SYNC pin. the remainder of the External/Status bits, both transitions are guaranteed to cause an External/ In External sync mode the SYNC pin is used by Status interrupt, even if another External/Status external logic to signal character synchronization. interrupt is pending at the time these transitions When the Enter Hunt Mode command is issued in occur. This procedure .is necessary because Abort External Sync mode, the SYNC pin must be held or Break conditions may not persist. High by the external sync logic until character synchronization is achieved. A High on the SYNC pin holds the Sync/Hunt bit in the reset condition. Bit 6: TX Underrun/EOM When external synchronization is achieved, SYNC This bit is set by a channel or hardware reset and must be driven Low on the second rising edge of when the transmitter is disabled or a Send Abort the Receive Clock after the last rising edge of the .command is issued. This bit can only be reset by Receive Clock on which the last bit of the receive the reset Tx Underrun/EOM Latch command in character was received. Once SYNC is forced WRO. When the Transmit Underrun occurs, this bit Low, it is good practice to keep it Low until the is set and causes an External/Status interrupt (if CPU informs the external sync logic that synchron- the Tx Underrun/EOM IE bit is set). ization has been lost or that a new message is about to start. Both transitions on the SYNC pin Only the 0-to-1 transition of this bit causes an cause External/Status interrupts if the Sync/Hunt interrupt. This bit is always "1" in Asynchronous IE bit is set to "1." mode, unless a reset Tx Underrun/EOM Latch command has been erroneously issued. In this The Enter Hunt Mode command should be issued case, the Send Abort command can be used to set whenever character synchronization is lost. At the the bit to one and at the same time cause an same time, the CPU should inform the external log- External/Status interrupt. ic that character synchronization has been lost and that the sce is waiting for SYNC to become active. Bit 5: Clear to Send In the Monosync and Bisync Receive modes, the Sync/Hunt status bit is initially set to "1" by the If the CTS IE bit in WR15 is set, this bit indicates Enter Hunt Mode command. The Sync/Hunt bit is the state of the CTS pin the last time any of the reset when the see established character syn- enabled External!Status bits changed. Any chronization. Both transitions cause External! transition, on the CTS pin while no interrupt is Status interrupts if the Sync/Hunt IE bit is set. pending latches the state of the CTS pin and When the ePU detects the end of message or the generates an External/Status interrupt. Any odd loss of character synchronization, the Enter Hunt number of transitions on the CTS pin while another Mode command should be issued to set the External/Status interrupt is pending also causes an Sync/Hunt bit and cause an External/Status inter- External/Status interrupts·.condition. If the CTS IE rupt. In this mode, the SYNC pin is an output, bit is reset, it merely reports the current unlatched which goes Low every time a sync pattern is state of the CTS pin. detected in the data stream. In the SOLe modes, the Sync/Hunt bit is initially Bit 4: SYNC/Hunt set by the Enter Hunt Mode command or when the receiver is disabled. It is reset when the opening The operation of this bit is similar to that of the CTS flag of the first frame is detected by the sec. An bit, except that the condition monitored by the bit External/Status interrupt is also generated if the varies depending on the mode in which the SCC is Sync/Hunt IE bit is set. Unlike the Monosync and operating. Bisync modes, once the Sync/Hunt bit is reset in SOLC mode, it does not need to be set when the When the XTAL oscillator option is selected in end of the frame is detected. The SCC automati- asynchronous modes, this bit is forced-to "0" (no cally maintains synchronization. The only way the External/Status interrupt is generated). Selecting Sync/Hunt bit can be set again is by the Enter Hunt the XTAL oscillator in synchronous or SOLC Mode command or by disabling the receiver. modes had no effect on the operation of this bit. 7-19 Bit 3: Data Carrier Detect SDLC mode. Figure 7-19 shows the bit positions for RR1. If the OCO IE bit in WR15 is set, this bit indicates the state of the DC 0 pin the last time the Enabled External/Status bits changed. Any transition on Bit 7: End of Frame (SOLC) the OCO pin while no interrupt is pending latches the state of the DCD pin and generates an This bit is used only in SOLC mode and indicates External/Status interrupt Any odd number of that a valid closing flag has been received and that transitions on the OCD pin while another External/ the CRC Error bit and residue codes are valid. This Status interrupt is pending also causes an Exter- bit can be reset by issuing the Error Reset nal/Status interrupt· condition. If the DCD IE is command. It is also updated by the first character reset, ·this bit merely reports the current, unlatched of the following frame. This bit is reset in any mode state of the OCD pin. other than SDLC. Bit 2: TX Buffer Empty Bit 6: CRe/Framing Error This bit is set to "1" when the transmit buffer is If a framing error occurs (in Asynchronous mode), empty. It is reset while CRC is sent in a syn- this bit is set (and not latched) for the receive chronous or SDLC mode and while the transmit character in which the framing error occurred. buffer is full. The bit is reset when a character is Detection of a framing error adds an additional one- loaded into the transmit buffer. This bit is always in half bit to the character time so that the framing the set condition after a hardware or channel reset. error is not interpreted as a new Start bit. In Synchronous and SDLC modes, this bit indicates the result of comparing the CRC checker to the Bit 1: Zero Count appropriate check value. This bit is reset by issuing an Error Reset command, but the bit is If the Zero Count Interrupt Enable bit is set in never latched. Therefore, it is always updated WR15, this bit is set to one while the counter in the when the next character is received. When used baud rate generator is at the count of zero. If there for CRC error status in Synchronous or SDLC is no other ExtemaVStatus interrupt condition modes, this bit is usually set since most bit pending at the time this bit is set, an External/ combination, except for a correctly completed Status interrupt is generated. However, if there is message, resutt in a non-zero CRC. another ExternaVStatus interrupt pending at this time, no interrupt is initiated until interrupt service is complete. If'the Zero Count condition does not Bit 5: Receiver Overrun Error persist beyond the end of the interrupt service routine, no interrupt will be generated. This bit is This bit indicates that the receive FIFO has not latched High, even thought the other overflowed. Only the character that has been External/Status latches close as a result of the Low- written over is flagged with this error, and when the to-High transition on ZC. The interrupt service character is read, the Error condition is latched until routine should' check the other External/Status reset by the Error Reset command. The overrun conditions for changes. If none changed, ZC was character and all subsequent characters received the source. In polled applications, check the IP bit until the Error Reset command is issued causes a in RR3A for a status change and then proceed as Special Receive Condition vector to be returned. in the interrupt service routine. 07513A 7-19 Bit 0: RX Character Avaliable ~ I LALLSENT This bit is set to "1" when at least one character is L RESIDUE CODE 2 available in the receive FI FO and is reset when the RESIDUE CODE 1 receive FIFO is completely empty. A channel or RESIDUE CODE 0 hardware reset empties the receive FIFO. ~---- PARITY ERROR ~----- Rx OVERRUN ERROR L-- CRC/FRAMING ERROR 7.2.2 Read Register 1 L..- END OF FRAME (SDLC) RR1 contains the Special Receive Condition status bits and the residue codes for the I-field in Figure 7·19 Read Register 1 Bit 4: Parity Error Bit 0: All Sent When parity is enabled, this bit is set for the In Asynchronous mode, this bit is set when all characters whose parity does not match the characters have completely cleared the transmitter programmed sense (even/odd). This bit is latched pins. Most modems contain additional delays in so that once an error occurs, it remains set until the the data path, which requires the modem control Error Reset command is issued. If the parity in signals to remain active until after the data has Special Condition bit is set, a parity error causes a cleared both the transmitter and the modem. This Special Receive Condition vector to be' returned bit is always set in synchronous and SOLC modes. on the character containing the error and on all subsequent characters until the Error Reset command is issued. 7~2.3 Read Register 2 RR2 contains the interrupt vector written into WR2. Bits 3, 2, and 1: Residue Codes 2, 1, And 0 When the register is accessed in Channel A, the vector returned is the vector actually stored in In those cases in SOLC mode where the received 1- WR2. When this register is accessed in Channel Field is not an integral multiple of the character B, the vector returned includes status information length, these three bits indicate the length of the 1- in bits 1, 2,' and 3 or in bits 6, 5, and 4, depending' Field and are meaningful only for the transfer in on the state of the Status High/Status Low bit in which the end of frame bit is set. This field is set t6 WR9 and independent of the state of the VIS bit in "011" by a channel or hardware reset and is forced WR9. The vector is modified according to Table 7- to this state in Asynchronous mode. These three 4 shown in the explanation of the VIS bit in WR9. If bits can leave this state only if SOLC is selected no interrupts are pending, the status is V3, V2, V1 and a character is received. The codes signify the = 011, or V6, V5, V4 = 110. Figure 7-20 shows following {Reference Table 7-9 when a receive the bit positions for RR2. character length is eight bits per character. I-Field bits are right-justified in all cases. If a receive 7.2.4 Read Register 3 character length other than eight bits is used for the I-Field, a table similar to Table 7-9 can be RR3 is the Interrupt Pending register. The status constructed for each different character length. of each of the Interrupt Pending bits in the SCC is Table 7-10 shows the residue codes for no reported in this register. This register exists only in residue (The I-Field boundary lies on a character Channel A. If this register is accessed in Channel boundary). B, all "Os" are returned. The two unused bits are always returned as "0." Figure 7-21 shows the bit positions for RR3. Table 7-9 I-Field Bit Selection (8 Bits Only) Res- Res- Res- I-Field I-Field 7.2.5 Read RegisterS idue idue idue Bits in Bits in Pre- -:L. , @ Last Byte vious Byte RR8 is the Receive Data register. 1 0 0 0 3 0 1 0 0 4 1 1 0 0 5 7.2.6 Read Register 10 0 0 1 0 6 1 0 1 0 7 RR10 contains some miscellaneous status bits. 0 1 1 0 8 Unused bits are always "0." Bit positions for RR1 0 1 1 1 1 8 are shown in Figure 7-22. 0 0 0 2 8 Table 7-10 Residue Bits/Character Bit 7: One Clock Missing Bits/Char Residue Residue Residue While operating in the FM mode, the OPLL sets 8 0 1 1 this bit to "1" when it does not see a clock edge on 7 0 0 0 the incoming lines in the window where it expects 601 0 one. This bit is latched until reset by a Reset 5 0 0 1 Missing Clock or Enter Search Mode command in 7-21 WR14. In the NRZI mode of operation and while loop in SOLC Loop mode. This bit is set to "1" in the DPLL is disabled, this bit is always "0." the X.21 mode (Loop mode selected while in monosync) when the transmitter goes active. This bit is CIO" at all other times. This bit can also be Bit 6: Two Clocks Missing pulled in SOLe mode to determine when the do~ngflaghasbeense~. While operating in the FM mode, the OPLL .sets this bit to "1" when it does not see a clock edge in two successive tries. At the same'timethe DPLL 7.2.7 Read Register 12 enters the Search mode. This bit is latched until reset by a Reset Missing Clock or Enter Search RR12 returns the value stored in WR12. the lower Mode command in WR10. In the. NAZI, mode of byte of the time constant for the baud rate operation and while the DPLL is disabled. this bit is generator. Figure 7-23 shows the bit positions for always "0." AA12. Bit 4: Loop Sending 7.2.8 Read Register 13 This bit is set to "1 in SDLC Loop mode while the· II RA13 returns the value stored inWR13, the upper transmitter is in control of the Loop, that is. while byte of the time constant for the baud rate the SCC is actively. transmitting on the loop. This g~nerator. Figure 7-24 shows the bit positions for bit is.reset at all other times., RR13. This bit can be polled in SOLC ·mode to dete'rmin' when the closing flag has been sent. 7.2.9 Read Register 15 RR15 reflects the value stored in WR15, the Bit 1: On Loop External/Status IE bits. The two unused bits are always returned as "Os." Figure 7~25 shows the This bit is set to "1" while the SCC is actually on- bits positions for RR15. 7-22 07513A 7-20 07513A 7-23 ~:~: ------V4 INTERRUPT VECTOR • ug ~TC2 TC3 - - - - - - - TC4 LOWER BYTE OF TIME CONSTANT - - - - - - - Vs - - - - - - - TCs - - - - - - - - - V6 - - - - - - - - - TC6 - - - - - - - - - - V7 - - - - - - - - - - TC7 *MODIFIED IN B CHANNEL Figure 7·20 Read Register 2 Figure 7·23 Read Register 12 07513A 7-21 07513A 7-24 ug ~:~: III L CHANNEL B EXT/STAT Ip· ~TC10 CHANNEL B Tx Ip· CHANNEL B Rx IP* CHANNEL A EXT/STAT Ip· TCll UPPER BYTE OF .~ - - - - - - CHANNEL A Tx IP* - - - - - - TC12 TIME CONSTANT - - - - - - - CHANNEL A Rx Ip· - - - - - - - TC13 ---------- 0 - - - - - - - - - -rC14 ---------- 0 - - - - - - - - - - TC1S ·ALWAYS 0 IN B CHANNEL Figure 7·21 Read Register 3 Figure 7·24 Read Register 13 07513A 7-22 07513A 7-25 ug~NLOOP I~ ;ERO COUNT IE COCOIE - - - - - - LOOP SENDING - - - - - - SYNC/HUNT IE ~------O - - - - - - - CTS IE ......- - - - - - - - TWO CLOCKS MISSING - - - - - - - - - Tx UNDrRRUN/EOM IE - - - - - - - - - - ONE CLOCK MISSING - - - - - - - - - - BREAK/ABORT IE Figure 7·22 Read Register 10 Figure 7·25 Read Register 15 7-23 ~ -. '.' . 'i .. i "'-'~."j ,,':.,,.ii,.'·,·, r,: .~ ~ ~ .:. ' ... .0'-'~ CHAPTER 8 ~, sec APPLICATION NOTES 8.1 Z8S30 and Z8030 see Initialization: The Command bits, D7 and D6, select one of the A Worksheet reset commands for the SCC. Setting either of these bits to 1 disables both the receiver and the 8.1.1 Introduction transmitter in the corresponding channel, forces TxD for the channel marking, forces the modem This application note describes the software control signals High in that channel, resets all IPs initialization procedure for the Serial Communica- and IUSs, and disables all interrupts in that tions Controller (SCC), and is applicable to both channel. Functions controlled by the Command the Z8030 and the Z8530. Although the Z8030 bits can only be enabled or disabled, they cannot and Z8530 have different bus interfaces, their be toggled. registers are programmed in the same order. Bits D4-DO are Mode bits that can be enabled or Figure 8-1 provides a worksheet that can be used disabled either by being set to "1" or reset to "0. as an aid when initializing the SCC. Since all SCC Each Mode bit affects only one function. For operation modes are initialized in a similar manner, example, Bit D1 is the No Vector mode bit, it the worksheet can be used to tailor the SCC controls whether or not the sce will respond to an device to the user's individual need. Specific interrupt acknow'ledge cycle by placing a vector on examples are given in the following chapters. the data bus. If this bit is set, no vector is returned. In Command bits entry, each new command requires a separate rewrite of the entire register. 8.1.2 Register Overview Care must be taken when issuing a command, so that the Mode bits are not changed accidentally. Each of the SCC's two channels has its own separate Write registers that are programmed to initialize different operating modes. There are two 8.1.3 Initialization Procedure types of bits in the Write registers: Command bits and Mode bits. An example of a register that The sce initialization procedure is divided into contains both types of bits is Write Register 9 three parts. The first part consists of programming (WR9) , and is shown in Figure 8-2. the operation modes (e.g., bits-per-character, parity) and loading the constants (e.g., interrupt vector, time constants). The second part enables the hardware functions (e.g., transmitter, receiver, baud-rate generator). It is important that the oper- ating modes are programmed before the hardware functions are enabled. The third part, if required, consists of enabling the different interrupts. Table 8-1 shows the order (from top to bottom) in Lo--_____ STATUS HIGH I STATUS LOW which the sec registers are to be programmed. L.-------O Those registers that need not be programmed are listed as optional in the comments column. The 0 0 NO RESET bits in the registers that are marked with an "X" are 0 1 CHANNEL RESET B to be programmed by the user. The bits marked 1 0 CHANNEL RESET A with an liS" are to be set to their previous program- 1 1 FORCE HARDWARE RESET med value. For example, in part 2, Write Register 0513A 8-2 3, bits D1-D7 are shown with an "S" because they Figure 8-2 Write Register 2 have been programmed in part 1 and must remain set to the same value. WR9 is the Master Interrupt Control register and contains the Reset command bits. Command bits are denoted by having boxes drawn around them 8.1.4 Initialization Table Generation in register diagrams. Bit D 5 in this register is not used in this register and must be 0 at all times. Figure 8-1 is a worksheet for the initialization of the 8-1 REGISTER HARDWARE RESET CHANNEL RESET 78 S 43210 7 & 5 43210 WRO = WRl WR2 WR3 WR4 WRS . WR& WR7 WR9 .,' WR10 WRll WR12 ,~ WR13 WR14 - - WR15 l~' ( RRO RRl , RR3 0513A 8-3 RR10 Figure 8-3 Z8030 Register Reset Values Part 1. Modes and Constants Part 2. Enables WR9 1100000 Hardware Reset WR14 000SSSS1 Baud Rate Enable WRO OOOOOOXX Select Shift MOde (8030 only) WR3 SSSSSSS1 Rx Enable WR4 XXXXXXXX TxlRx con, Async or Sync Mode WRS SSSS1SSS Tx Enable WR1 OXXOOXOO Select W/REQ (opt) WRO 10000000 Reset Tx CRG (opt) WR2 XXXXXXXX Program Interrupt Vector (opt) WR1 XSSOOSOO DMA Enable (opt) WR3 XXXXXXXO Select Rx Control WRS XXXXOXXX Selects Tx Control Part 3. Interrupt Status WRS XXXXXXXX Program sync character (opt) WR7 XXXXXXXX Program sync character (opt) WR1S XXXXXXXX Enable External/Status WR9 OOOXOXXX Select Interrupt Control WRO 00010000 Reset External Status WR10 XXXXXXXX Miscellaneous Control (opt) WRO 00010000 Reset External Status twice WR11 XXXXXXXX Clock Control WR1 SSSXXSXX Enable Ax, Tx and Ext/Status WR12 XXXXXXXX Time constant lower byte (opt) WR9 OOOSXSSS Enable Master Interrupt Enable WR13 XXXXXXXX Time constant upper byte (opt) ~ WR14 XXXXXXXO Miscellaneous Control 1 = Set to one X= User defined I WR14 XXXSSSSS Commands (opt) 0= Reset to zero S = Same as previously prog. Table 8-1 see Initialization Order . 8-3 scc. All the bits that must be programmed as make use of this feature to test-program the part either a "0" or a "1" are already filled in; the remain- without additional hardware to simiulate an actual ing bits are left blank and are to be programmed by transmit and receive environment. the user according to the' desired mode of opera- tion. The binary value ·can then be converted to a hexadecimal number and placed in the table, 8.2.2 see Interface following the Write register notation in the column labeled "HEX". A Program Initialization Table is Figure 8~4 shows .the SCC to CPU interface produced when this worksheet is completed. required for this application. The 8-bit data bus and control lines all come from the user's cpu. The 8030 control lines are OS, AS, R/W, CSO and 8.1.5 Reset Conditions C81. The 8530 control lines are RD, WR, AlB, DIG and CEo PCLK comes from the system clock, or an Prior the initialization, the ·sec should be reset by external crystal, up to the maximum rate of the SCC either hardware or software. A hardware reset can (ex. 6 MHz for the Z8530A). The lEI and the be accomplished ;by simultaneously grounding RD INTACK pins should be pulled up. The baud-rate and WR on the; Z8530, or AS and DS on the generator clock is connected to the RTxC pin. Z8030. A software reset can be executed by writing a OH to Write Register 9. The state of the SCC registers, after reset,is shown in Figure 8-3. 8.2.3 see Initialization Initialization of the SCC for polled asynchronous 8.2 Polled Asynchronous Mode communication is divided into two parts; part one programs the operating modes of the SCC and 8.2.1 Introduction part two enables them. Care must be taken when writing the software to meet the SCC's Cycle and This chapter describes the use of the SCC in Reset Recovery times. The Cycle Recovery time, polled Asynchronous Mode. The device can be 6 PCLK cycles, applies to the period between any set with 5 to 8 bits per character, 1, 1.5, or 2 stop Read or Write cycles affecting the SCC. The Reset bits, and a wide range of· baud rates. In this Recovery time is the period after a hardware reset particular example, 8 bits per character, 2 stop bits caused either by hardware or software; this and 9600 baud rate are used. An external 2.4576 recovery time extends the Cycle Recovery time to MHz, crystal oscillator is used' for baud-rate 11 PCLK cycles. For more details about these generation. The SCC can be programmed for local recovery times, see the SCC Technical Manual loopback for on-board diagnostics. The user can (Chapter 3). DO-D7 Vee Vee see SVSTEM lEI iNTiCK CONTROL PIN 12 FOR CHANNEL A PIN 28 FOR CHANNEL B PCLK RfiC XTAL 2.4576 MHz esc esc 0513A 8-4 Figure 8-4 8-4 Table 8-2 Polled Asynchronous Initialization Clock Frequency Procedure Time Constant = -2 2 x Baud Rate x clock mode -~ Register Value Comments In this example, the clock frequency is 2.4576 WR9 COH Force Hardware Reset MHz, the baud rate is 9600, and the clock mode is WR4 4CH x16 c1ock,2 stop bits,no parity 16, the time constant is, therefore, 6; expressed WR3 COH R x 8 bits, Rx disabled T x 8 bits, DTR,RTS,Tx off as a 16-bit, hexadecimal number, it is 0006H. The WR5 60H WR9 OOH Int. Disabled time constant LOW (WR12) is, therefore, 06H and WR10 OOH NRZ the time constant HIGH (WR13) is DOH. The baud WR11 56H Tx & Rx::: BRG out, TR x C= BRG out rate for this example can be varied, as long as the WR12 06H Time constant = 6 data rate is less than 1/4 of the PCLK rate. Table 8- WR13 OOH Time constant high =0 3 shows the time constants for other common WR14 10H BRG in = RT x C, BRG off, loopback baud rates. Enables Table 8-3 Time constants for common baud rates WR14 11H BRG enable Baud Divider WR3 C1H Rxenable Rate Dec Hex WR5 68H Txenable 38400 0 OOOOH 19200 2 0002H 9600 6 0006H 8.2.3.1 sec Operating Mode Programming 4800 14 OOOEH 2400 30 001EH WR9 resets the SCC to a known state by writing a 1200 62 003EH CO hex. The command, Force Hardware Reset, is 600 126 007EH identical to a hardware reset. 300 254 OOFEH 150 510 01FEH WR4 selects the asynchronous, x 16 mode, with 2 For 2.4576 MHz Clock, X16 Mode ,~ stop bits and no parity. The x 16 mode means that clock rate is16 times the data rate. WR14 selects the baud-rate generator as the WR3 selects 8 bits per character and does not RTxC pin, baud-rate generator disabled, and enable the receiver. The 8 bits per character internal loopback. The baud-rate generator uses allows 8 bits to be assembled from the data stream. the RTxC pin as the clock source and is not The receiver is not enabled at this time because enabled at this tim e because the SCC initialization the SCC has not been initialized. is not complete. WRS selects 8 bits per character and does not enable the transmitter. The 8 bits per character 8.2.3.2 sec Operating Mode Enables allows 8 bits to be sent, as data, with the least significant bit first. The transmitter is not enabled at WR14 enables the baud-rate generator. Bit 0 this time because the SCC has not been initialized. (LSB) is changed to a 1 to enable the baud-rate generator; all other bits must maintain the value WR9 selects that there are no interrupts enabled. selected during initialization. This inhibits the SCC from requesting an interrupt from the CPU. WR3 enables the receiver. Bit 0 (LSB) is changed to a 1 to enable the receiver, all other bits must WR10 selects NRZ encoding. This NRZ coding is maintain the value selected during initialization. used on the transmitter as well as the receiver. WRS enables the transmitter. Bit 3 is changed to a WR11 selects the RTxC pin to TIL clock; the baud- 1 to enable the transmitter, all other bits must rate generator is the transmit and receive clocks maintain the value selected during initialization. source, and the TRxC pin as a baud-rate generator output. 8.2.4 Transmit and Receive Routines WR12 & WR13 and select the baud-rate gen- erator's time constant. The WR13 time constant is After initialization, and after all enables have been determined by the equation: selected, the SCC is ready for communication. 8-5 The transmitter buffer and the receive FIFO are 8.3 INTERRUPT WITHOUT INTACK empty. The example shown below is coded to ASYNCHRONOUS MODE transmit and receive characters. 8.3.1 Introduction ;Transmit a character This chapter describes the use of the SCC for interrupt-driven Asynchronous Mode. As with the TXCHAR: INPUT RRO ;Read RRO example in the previous chapter, the SCC is set TEST BIT 2 ;Test transmit with 8 bits per character, 2 stop bits, at 9600 baud buffer empty rate. An external 2.4576 MHz, crystal oscillator is JZ TXCHAR ;Loop if not empty used for baud-rate generation. Interrupt OUTPUT CHAR ;Output character to acknowledge is not generated because of the data port extra hardware required to produce this signal. In RET ;Return this chapter, the SCC is also programmed for local loopback so that no external loop between the ;Receive a character transmit and the receive data lines is needed for on- board diagnostics. This feature allows the user to RXCHAR: INPUT RRO ;Read RRO test-program the part without additional hardware TEST BIT 0 ;Test Receive to simiulate an actual transmit and receive buffer environment. JZ RXCHAR ;Loop if not full INPUT CHAR ;Input character from data port 8.3.2 SCC INTERFACE RET ;Return Figure 8-6 shows the sec to CPU interface required for this application. The 8-bit data bus Figure 8-5 Transmit and Receive Routine and control lines all come from the user's CPU. For INTERRUPT CONTROLLER DATA DO-D7 Vee Vee see SYSTEM lEI INTACK CONTROL PIN 12 FOR CHANNEL A PIN 28 FOR CHANNEL B PCLK XTAL 2A576 MHz esc OSC 0513A 8-5 Figure 8-6 8-6 the 8030, the control lines are OS, AS, RIW, CSO 8.3.3.1 sec Operating Modes Programming and CS1. For the 8530, the control lines are RD, WR, NS, Die and CEo The INT signal goes to an WR9 resets the SCC to a known state by writing a interrupt controller which must produce the inter- CO hex. This command, Force Hardware Reset, is rupt vector to the CPU. The PCLK comes from the identical to a hardware reset. system clock, or an external crystal oscillator, up to the maximum rate of the SCC (ex. 6 MHz for the WR4 selects asynchronous mode, x16 mode, 2 Z8530A). The lEI and the INTACK, pins should be stop bits and no parity. The x16 mode means that pulled up. The baud-rate generator clock is the clock rate is 16 times the data rate. connected to the RTxC pin. WR2 is the interrupt vector of the SCC. Even though a vector is mot placed on the' bus in this 8.3.3 see INITIALIZATION mode the vector including status is read from RR2. By writing OOH to this register the status read will The initialization of the SCC for interrupt-driven be the only bits set in RR2. asynchronous communication. is divided into three parts., Part one programs the operating modes of WR3 selects 8 bits per character and does not the SCC, part,two and three enable them. Care enable the receiver. The 8 bits per character must, be taken when writing the code to meet the allows 8 bits to be assembled from the data stream. sec's Cycle and Reset Recovery times. The The receiver is not enabled at this' time because Cycle Recovery time applies to the period be- the SCC is not completely initialized. tween any Read or Write cycles to the SCC, and is 6 PCLK cycles. The Reset Recovery time applies WR5 selects 8 bits per character and does not en- to a, h_ardware reset caused either by hardware or able the transmitter. The 8 bits per' character al- software; this recovery time extends the Cycle lows 8 bits to be sent as data with the least signifi- Recovery time to 11PCLK cycles. More·details: cant bit first. The transmitter is not enabled at this about these recovery times can be found in the time because theSCC is not completely initialized. SCC Technical Manual (Chapter 3). WR9 selects that there are no interrupts enabled. This will inhibit the SCC from request,ng an interrupt from the CPU. Table 8-4 WR10 selects NRZ encoding. This selects NRZ Register Value Comments coding is to be· used,' on the transmitter arid the receiver. WR9 COH Force Hardware Reset WR4 4CH x16 clock, 2 stop bits, no parity WR11 selects the RTxC pin to TIL clock, the trans- WR2 OOH" Interrupt Vector OOWR3 mit and receive clocks source as the baUd-rate COH Rx 8 bits, Rx disabled generator and the TRxC pin as a baud-rate gen- WRS 60H Tx 8 bits, OTR, RIS, Tx off erator output. WR9 OOH Int OisabledWR10 OOH NRZ WR12 & WR13 select the baud-rate generators WR11 S6H Tx & Rx= BRG out, TRxC ::: time constant. The time constant is determined by BRGout the equation: WR12 06H Time constant = 6 WR13 OOH Time constant high = 0 Clock Frequency WR14 10H BRG in = RTxC, BRG off, Time Constant = - - - - - - - - - -2 loopback 2 x Baud Rate x clock mode Enables In this example, the clock frequency is 2.4576 MHz, the baud rate is 9600, and the clock mode is WR14 11 H BRG enable C1H Rx enable 16; the time constant is 6. Converting this time WR3 WRS 68H Tx enable constant to a 16-bit hexadecimal number, it becomes 0006H. The time constant LOW (WR12) Enable Interrupts is 06H and the time constant HIGH (WR13) is OOH. The baud rate for this example can be varied for as r' WR1 12H Rx Int on all char and Tx Int enables long as the data rate is less than 1/4 of the PCLK rate. Table 8-5 gives the time constants for other WR9 OSH MIE common baud rates. 8-7 Table 8-5 Time constants for common baud rates interrupt is programmed to generate an interrupt an all received characters or special conditions. Baud Rate Divider This provides an interrupt on every character ~, received by the SCC. The externaVstatus Dec Hex interrupts are not enabled in this application. 38400 0 OOOOH 19200 2 0002H 9600 -6 0006H WR9 sets the master interrupt enable (MIE) bit 3. 4800 14 'OOOEH Setting this bit enables the interrupts pending to 2400 30 001EH generate and interrupt on the INT pin. 1200 62 003EH 600 126 007EH 300 254 OOFEH 8.3.4 Interrupt Routine' 150 510 01FEH When the SCC has been initialized and enabled, it For 2.4576 MHz Clock, X16 Mode is ready for communication. The transmitter buffer and the receive FIFO are both empty. ,An interrupt will not be generated until the softWare writes' the WR14 selects' the baud rate source as the RTxC first character to the transmit buffer. Once the first pin, baud rate generator, disabled, and internal character.is in the SCC shift register, the,·first tran's- ' 100 Pgacl<. .The baud-rate generator will use the mit interrupt will occur. The SCC will'then keep RTx pin as the clock source for the baud-rate setting transmit and receive interrupts to the inter- generator. The baud-rate generator is not enabled rupt controller until the end of the message. At the at this time· because the SCC, initialization is not end of the message, a Reset Transmitter Interrupt ~\ complete. Pending (WRO) is issued to clear the transmit interrupt ,After the last character is read into'lhe 8.3.3.2SCC~perating Mode Enables SCC; the interrupts will cease until another mes- sage is wrhten into the transmitter. ., . WR14 enables the baud-rate generator. Bit 0 (LSB) is c~anged to a.1 to enable the baud-~at~ Once an interrupt is received and the interrupt con- generator; all other bits must maintain the val~e troller vectors to the interrupt routine, RR2 is read selected during initialization. from channel B. The value read from RR2 is the vector, including status. This vector shows th~ sta-: WR3 enables the receiver. Bit O· (LSB) is changed tus of the highest priority interrupt pending (lP)· at toa 1 to enable the receiver; all other bits must the time it is read. Once the highest priority inter- maintain the value selected during initialization. rupt condition is cleared, ~R2 will show the status of the next highest interrupt pending, if one is WRS, enables the transmitter. Bit 3 is changed to a present. This allows multiple interrupts to be ser- 1 to enable the transmitter; all other bits must main- viced without the overhead of the interruPt acknow- tain the vallie selected during inhialization. ledge cycle of the interrupt controller. 8.3.3.3 see Operating Mode Interrupts The following example shows how the interrupt routine should be coded. WR1 enables the Tx and the Rx interrupts~ The Rx 8-a. BEGIN: INPUT RR2 ;Read RR2 from channel B ~, TEST Bit 4 ;Test for Tx Empty JE TXEMPTY ; Jump to Transmit Routine TEST Bit 5 ;Test for Rx full JUMP RXFULL ;Jump to Receive Routine OUT EOI ;Output EOI to Interrupt Controller IRET ;Return to Main TXEMPTY:TEST NOMORE ;Test a last character flag JE LAST ;Jump to LAST if no more characters OUTPUT CHAR ;Output character to data port DEC CHARCOUNT ;Decrement character count JUMP BEGIN ;Jump to BEGIN to test for more IP LAST: OUTPUT RRO,28H ;Reset Tx Interrupt Pending JUMP BEGIN ;Jump to BEGIN to test for more IP RXFULL: INPUT RRl ;Read RRl COMPARE RR1,OO ;Test for special condition bit set JUMP NE ; Jump to SPECIAL ~ INPUT CHAR ;Input character from data port JUMP BEGIN ;Jump to BEGIN to test for more IP SPECIAL: . This means a framing error, receive overrun error or parity error has occurred. Character may be read but data is not correct. A flag should be set to post the error. OUTPUT RRO, 30H ;Reset Error Command JUMP BEGIN ;Jump to BEGIN to test for more IP Figure 8-7 8-9 ;'f'~-' ·-t.:·- -. ," d.j·, \ ~. -;; -..: -=:.,... :-1 • : ~~'. ~& .r. i..~ . :' -"':... " , ~'-~ • ;' - '~~4' • ':1" ::~ ::.,\~ ! -" . '----_ .,if INDEX A F Abort 2-8, 4-6,5-14,7-5,6,13,18 FIFO 4-3,5,5-1,3-7,10,12 Address Search mode bit 7-6 FM mode 1-1, 2-4,6-5-8, 7-12,16,17 Asynchronous mode 1-1,4, 2-5, 4-6,8, 5-1,2, Frame 2-2,6,7, 5-13-15 6-1, 7-5,7,13 End-of-Frame bit 5-10 Auto Enable bit 5-2, 6-8, 7-6 Framing Error bit 4-5, 5-1 Auto Echo 6-8, 7-17 G B Go-Active-On-Poll 5-14,15 Baud rate generator 1-1 ,4, 2-4, 6-1,2 Bisync 2-2, 7-6,10,14,19 H Block transfers 2-9, 4-7 Break 2-8, 4-6, 5-1,9,14, 7-5,9,13,18 Hunt mode 2-5, 4-6,7, 5-3,9-12, 7-6,18 Break/Abort 4-6, 5-14, 7-18, .'~ C I-Field 7-21 Channneis 1-1,2 Interrupts 1-3,4, 2-2,8,9, 3-1,2, 4-1,2,10, 5-3, Clear to Send (CTS) bit 4-6,7, 5-2, 7-18 7-2-5,11,17,21 Clock modes 2-4, 6-1, 7-7,14,15 External/Status 4-6,7,17,18 Clock rate 7-7 Interrupt Acknowledge (INTACK) 3-2,5 Command register 2-1, 7-1 Polling 2-8, 4-3,5 Command codes 7-2 Receive 4-3,5 CRC 4-8, 5-4,6,7,10,12,13,14 Sources 3-1 Crystal Oscillator 6-1, 7-7,14 Timing 3-5 Transmit 4-5,6 D Vector 2-1, 3-2,5, 4-3, 7-5,21,23 Daisy Chain 4-2,3, 7-3,11 L Data encoding 2-5,6-4,5,7-12,16,17 FM 6-4,5,7 Local Loopback 6-8, 7-6,17 Manchester 6-4,7 NRZ 6-4 M Data paths 2-2 Data rate 7-7 Manchester 2-5, 6-7, 7-16 Data register 3-6 Monosync 2-2,5,7-7,14 Data Carrier Detect (DCD) bit 4-6,7, 7-20 Digital Phase-Locked Loop (OPLL) 2-4, 6-5-8, N 7-12,15,16,22 Initialization 6-8 NRZ 2-5,9, 6-4,7, 7-12 OMA 1-4,5 NRZI mode 2-4,5,8, 6-5,6 OTR 5-12 p E Pad characters 2-6 End of Poll (EOP) 2-8, 5-9,14,15 Parity 7-5,8,21 ExternaVStatus interrupt 4-6,7, 7-17,18,19 Asynchronous receive 5-1 External Sync mode 2-6, 7-7 Asynchronous transmit 5-2 SOLC receive 5,10,11 SDLCtransmit 5-13,14 and Asynchronous mode 5-1,2 Synchronous receive 5-3,4 Synchronous mode 1-1, 4-6,8, 5-1-9, Synchronous transmit 5-7,8 7-5,8,9,20 and clock mode 6-1 R T Read cycle timing (Z8030) 3-1 Read cycle timing (Z8530) 3-4 Transmitclock 1-4,5, 2-4, 6-1, 7-9,15 Read register 2-1, 7-18-22 and Asynchronous mode 5-2 Receive clock 2-4, 5-3,4, 6-5-8, 7-14 and DPLL 6-5 Receiver 1-1, 2-2, 4-1-3,7,7-4-6 and FM mode 6-6--8 and Asynchronous mode 5-1,2 and NRZI mode 6-5,6 and OPLL 6-5-8 Transmit Data register 2-2 and FM mode 6-6-8 Transmit interrupts 4-5,6 .. and SOLCrnode 5-9 Transmit Shift register 2-2, 5-8,13,14, 7-9 and SOLC loop mode 5-15 Transmitter 2-2, 7-1 and Synchronous mode 5-3-8 and Asynchronous mode 5-2 initialization 5-2,7,12 and DMA 4-8,10 synchronized to transmitter 5-8,9 andOPLL 6-8 Register pointer 3-5,6 andNRZl6-5 Register set 2-1 andSDLC 5-13,14 Request to Send (RTB) 1-4, 5-14, 7-9 and SDLC Loop mode 5-14,15 Reset3~3,8, 7-1-3,10,11 and Synchronous mode 5-7,8 CRC 2-1, 5-4-14 initialization 5-2,8,14 DPLL 6-5 synchronized to receiver 5-8,9 . Error Reset command 4-10 Interrupts 4-2,6,7' u MiSsing Clock 6-8 Z8030 3-3 Underrun 4-6,7, 5-8,13,14, 7-13,18 Z85303-8 w S Wait 2-9, 4-7,8, 7-3,4 SOLC 1-1, 2-2-7, 4-6, 5-9-14 Write cycle timing (Z8030) 3-2 initialization 5-15 Write registers 2-1,2, 7-1-18 SOLC Loop mode 2-7,8, 5-14,15, 7-13 Shift Right/Shift Left bit 3-2,3, 7-2,11 z Start bits 2-5 Status High/Status Low bit 4-3 Zero count bit 4-6, 7-20 Stop bits 2-5, 7-8 Zilog Reader Response Your feedback about this document helps us ascertain your needs and fulfill them in the future. Please take the time to fill out this questionnaire and return it to us. This information will be helpful to us, and to future users of Zilog products. D First-time user reading document for general information o Experienced user needing specific information Is there any additional information you would like presented about this product? 0 Yes 0 No If Yes, what type of information? _ ..~ Do you have a unique application that could benefit other users of Zilog products? DYes 0 No If Yes, briefly describe _ Other comments and suggestions _ Your Name _ Company Name _ ~, Address- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - City 8tat9 _ Zip _ Phone ( D Check here to receive a copy of our current literature list. 00-2057-03 "~~, ,- I,' ,~:~~";"." _... ~.~ ...;. ... - •• ....:_ .. - ..... :.1:- ..... ~ ..,• • ZILOG DOMESTIC SALES OFFICES INTERNATIONAL SALES OFFICES AND TECHNICAL CENTERS CANADA CALIFORNIA Toronto 416-673-0634 Agoura 818-707-2160 GERMANY Campbell 408-37G-8000 Costa Mesa. . . 714·261·1281 Munich 49-89-612-6046 COLORADO JAPAN Boulder ... . .....303-440-3971 Tokyo. . 81-3-587-0528 FLORIDA HONG KONG Largo 813-585-2533 Kowloon 852-3-723-8979 GEORGIA UNITED KINGDOM Atlanta. . . . . . . . . . . . . .404-451-8425 Berksh i re. . . . . . . . . . . . . . .44-628-39200 ILLINOIS Schaumburg. . .....312·885·8080 MASSACHUSETTS Burlington 617-273-4222 MINNESOTA Edina. . 612-831-7611 NEW JERSEY Hasbrouck Heights 201-288-3737 Mt. Laurel 609-778-8070 OHIO Seven Hills 216-447-1480 TEXAS Richardson 214-231-9090 ./ Zilog, Inc. 1315 Dell Ave., Campbell. California 95008 Telephone (408)370·8000 TWX 910-338-7621 00-2057-03 Printed in USA '