MK68901 STMICROELECTRONICS | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 33

Technical content

MULTI–FUNCTION PERIPHERAL .8 INPUT/OUTPUT PINS

  • Individually programmable direction
  • Individual interrupt source capability - Programmable edge selection .16 SOURCE INTERRUPT CONTROLLER
  • 8 Internal sources
  • 8 External sources
  • Individual source enable
  • Individual source masking
  • Programmable interrupt service modes - Polling - Vector generation - Optional In-service status
  • Daisy chaining capability .FOUR TIMERS WITH INDIVIDUALLY PRO- GRAMMABLE PRESCALING
  • Two multimode timers - Delay mode - Pulse width measurement mode - Event counter mode
  • Two delay mode timers
  • Independent clock input
  • Time out output option .SINGLE CHANNEL USART
  • Full Duplex
  • Asynchronous to 65 kbps
  • Byte synchronous to 1 Mbps
  • Internal/External baud rate generation
  • DMA handshake signals
  • Modem control
  • Loop back mode .68000 BUS COMPATIBLE .48 PIN DIP OR 52 PIN PLCC Figure 1 :Pin connections.

DESCRIPTION

The MK68901 MFP (Multi-Function Peripheral) is a combination of many of the necessary peripheral functions in a microprocessor system. Included are : Eight parallel I/O lines Interrrupt controller for 16 sources Four timers Single channel full duplex USART The use of the MFP in a system can significantly re- duce chip count, thereby reducing system cost. The MFP is completely 68000 bus compatible, and 24 di- rectly addressable internal registers provide the ne- MFP DPIP48 PLCC52

necessary control and status interface to the pro- grammer. The MFP is a derivative of the MK3801 STI, a Z80 family peripheral. PIN DESCRIPTION GND : Ground VCC : +5 volts (± 5%) CS : Chip Select (input, active, low). CS is u- sed to select the MK68901 MFP for ac- cesses to the internal registers. CS and IACK must not be asserted at the same time. DS : Data Strobe (input, active low). DS is u- sed aspart of thechip select and interrupt acknowledge functions. R/W : Read/Write (input). R/W is the signal from the bus master indicating whether the current bus cycle is a Read (High) or Write (Low) cycle. DTACK : Data Transfer Acknowledge. (output, ac- tive low, tri-stateable) DTACK is used to signal the bus master that data is ready, or that data has been accepted by the MK68901 MFP. A1-A5 : Address Bus (inputs). The adress bus is used to adress one of the internal regis- ters during a read or write cycle. D0-D7 : Data Bus (bi-directional, tri-stateable). The data bus is used to receive data from or transmit data to one of the internal re- gisters during a read or write cycle. It is also used to pass a vector during an in- terrupt acknowledge cycle. CLK : Clock (input). This input is used to pro- vide the internal timing for the MK68901 MFP. RESET : Device reset. (input, active low). Reset disables the USART receiver and trans- mitter, stops all timers and forces the ti- mer outputs low, disables all interrupt channels and clears any pending inter- rupts. The General Purpose Interrupt/I/O lines will be placed in the tri-state input mode. All internal registers (except the ti- mer, USART data registers, and transmit status register) will be cleared. INTR : Interrupt Request (output, active low, o- pen drain). INTR is asserted when the MK68901 MFP is requesting an interrupt. INTR is negated during an interrupt ac- knowledge cycle or by clearing the pen- ding interrupt(s) through software. IACK : Interrupt Acknowledge (input, active low). IACK is used to signal the MK68901 MFP that the CPU is acknowledging an interrupt. CS and IACk must not be as- serted at the same time. IEI : Interrupt Enable In (input, active low). IEI is used to signal the MK68901 MFP that no higher priority device is requesting in- terrupt service. IEO : Interrupt Enable Out (output, active low). IEO is used to signal lower priority peri- pherals that neither the MK68901 MFP nor another higher priority peripheral is requesting interrupt service. 10-17 : General Purpose Interrupt I/O lines. These lines may be used as interrupt in- puts and/or I/O lines. When used as in- terrupt inputs, their active edge is pro- grammable. A data direction register is u- sed to define which lines are to be Hi-Z inputs and which lines are to be push-pull TTL compatible outputs. SO : Serial Output. This is the output of the U- SART transmitter. SI : Serial Input. This is the input to the U- SART receiver. RC : Receiver Clock. This input controls the serial bit rate of the USART receiver. TC : Transmitter Clock. Thisinput controls the serial bit rate of the USART transmitter. RR : Receiver Ready. (output, active low) DMA output for receiver, which reflects the status of Buffer Full in port number 15. TR : Transmitter Ready. (output, active low) DMA output for transmitter, which re- flects the status of Buffer Empty in port number 16. TAO,TBO, TCO,TDO: Timer Outputs. Each of the four timers has an output which can produce a square wave. The output will change states each timer cycle ; thus one full pe- riod of the timer out signal is equal to two timer cycles. TAO or TBO can be reset (logic ”O”) by a write to TACR, or TBCR respectively. XTAL1, XTAL2 : Timer Clock inputs. A crystal can be connected between XTAL1 and XTAL2, or XTAL1 can be driven with a TTL level clock. When driving XTAL1 with a TTL le- MK68901

vel clock, XTAL2 must be allowed to float. Whenusing a crystal, external capacitors are required. See figure 33. All chip ac- cesses are indepen dent of the timer clock. TAI,TBI : Timer A, B inputs. Used whenrunning the timers in the event count or the pulse width measurement mode. The interrupt channels associated with 14 and 13 are used for TAI and TBI, respectively. Thus, when running a timer in the pulse width V000351 MK68901

Figure 4 :Register Map. Address Port N °. Abbreviation Register Name GPIP AER DDR GENERAL PURPOSE I/O ACTIVE EDGE REGISTER DATA DIRECTION REGISTER A B IERA IERB IPRA IPRB ISRA ISRB IMRA IMRB VR INTERRUPT ENABLE REGISTER A INTERRUPT ENABLE REGISTER B INTERRUPT PENDING REGISTER A INTERRUPT PENDING REGISTER B INTERRUPT IN-SERVICE REGISTER A INTERRUPT IN-SERVICE REGISTER B INTERRUPT MASK REGISTER A INTERRUPT MASK REGISTER B VECTOR REGISTER C D E F TACR TBCR TCDCR TADR TBDR TCDR TDDR TIMER A CONTROL REGISTER TIMER B CONTROL REGISTER TIMERS C AND D CONTROL REGISTER TIMER A DATA REGISTER TIMER B DATA REGISTER TIMER C DATA REGISTER TIMER D DATA REGISTER SCR UCR RSR TSR UDR SYNC CHARACTER REGISTER USART CONTROL REGISTER RECEIVER STATUS REGISTER TRANSMITTER STATUS REGISTER USART DATA REGISTER INTERRUPTS The General Purpose I/O-Interrupt Port (GPIP) pro- vides eight I/O lines that may be operated either as inputs or outputs under software control. In addition, each line may generate an interrupt in either a po- sitive going edge or a negative going edge of the in- put signal. The GPIP has three associated registers. One al- lows the programmer to specify the Active Edge for each bit that willtrigger an interrupt. Another register specifies the Data Direction (input or output) asso- ciated with each bit. The third register is the actual data I/O register used to input or output data to the port. These three registers are illstrated in figure 5. The Active Edge Register (AER) allows each of the General Purpose Interrupts to provide an interrupt on either a 1-0 transition or a 0-1 transition. Writing a zero to the appropriate bit of the AER causes the associated input to produce an interrupt on the 1-0 transition. The edge bit is simply one input to an ex- clusive-or gate, with the other input coming from the input buffer ant the output going to a 1-0 transition detector. Thus, depending upon the state of the in- put, writing the AER can cause an interrupt-produ- cing transition, which will cause an interrupt on the associated channel, if that channel is enabled. One would then normally configure the AER before enabling interrupts via IERA and IERB. Note : Changing the edge bit, with the interrupt enabled, may cause an interrupt on that channel. The Data Direction Register (DDR) is used to define 10-17 as inputs or as outputs on a bit by bit basis. Writing a zero into a bit of the DDR causes the cor- responding Interrupt-I/O pin to be a Hi-Z input. Wri- ting a one into a bit of the DDR causes the cor- responding pin to be configured as a push-pull out- put. When data is written into the GPIP, those pins defined as inputs will remain in the Hi-Z state while those pins defined as outputs will assume the state (high or low) of their corresponding bit in the GPIP. When the GPIP is read, the data read will come di- rectly from the corresponding bit of the GPIPregister for all pins defined as output, while the data read on all pins defined as inputs will come from the input buffers. Each individual function in the MK68901 is provided witha unique interrupt vector that is presented to the system during the interrupt acknowledge cycle. The interrupt vector returned during the interrupt ac- knowledge cycle is shown in figure 6, while the vec- tor register is shown in figure 7. MK68901

Figure 9: Interrupt Control Register Definitions Priority Channel Description HIGHEST LOWEST 1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 0101 0100 0011 0010 0001 0000 General Purpose Interrupt 7(I7) General Purpose Interrupt 6(I6) Timer A Receive Buffer Full Receive Error Transmit Buffer Empty Transmit Error Timer B General Purpose Interrupt 5(I5) General Purpose Interrupt 4(I4) Timer C Timer D General Purpose Interrupt 3(I3) General Purpose Interrupt 2(I2) General Purpose Interrupt 1(I1) General Purpose Interrupt 0(I0) Interrupts may be either polled or vectored. Each channel may be individual enabled or disabled by writing a one or a zero in the appropriate bit of Inter- rupt Enable Registers (IERA, IERB - see figure 8 for all registers in this section). When disabled, an in- terrupt channel is completely inactive. Any internal or external action which would normally produce an interrupt on thatchannel is ignored and any pending interrupt on that channel will be cleared by disabling that channel. Disabling an interrupt channel has no effect on the corresponding bit in Interrupt In-Ser- vice Registers (ISRA, ISRB) ; thus, if the In-service Registers are used and an interrupt is in service on that channel when the channel is disabled, it will re- main in service until cleared in the normal manner. IERA and IERB are also readable. When an interrupt is received on an enabled chan- nel, its corresponding bit in the pending register will be set. When that channel is acknowledged it will pass its vector, and the corresponding bit in the In- terrupt Pending Register (IPRA or IRPB) will be cleared. IPRA and IPRB are readable ; thus by pol- ling IPRA and IPRB, it can be determined whether a channel has a pending interrupt. IPRA and IPRB are also writeable and a pending interrupt can be cleared without going through the acknowledge se- quence by writing a zero to the appropriate bit. This allows any one bit to be cleared, without altering any other bits, simply by writing all ones except for the bit position to be cleared to IPRA or IPRB. Thus a fully polled interrupt scheme is possible. Note : wri- ting a one to IPRA, IPRB has no effect on the inter- rupt pending register. The interrupt mask registers (IMRA and IMRB) may be used to block a channel from making an interrupt request. Writing a zero into the corresponding bit of the mask register will still allow the channel to re- ceive an interrupt and latch it into its pending bit (if that channel is enabled), but will prevent that chan- nel from making an interrupt request. If that channel is causing an interrupt request at the time the cor- responding bit in the mask register is cleared, the re- quest will cease. If no other channel is making a re- quest, INTR will go inactive. If the mask bit is re-en- abled, any pending interrupt is now free to resume its request unless blocked by a higher priority re- quest for service. IMRAand IMRB are also readable . A conceptual circuit of an interrupt channel is shown in figure 10. MK68901

In the delay mode, the prescaler is always active. A count pulse will be applied to the main timer unit each time the prescribed number of timer clock cy- cles has elapsed. Thus, if the prescaler is program- med to divide by ten, a count pulse will be applied to the main counter every ten cycles of the timer clock. Each time acount pulse is applied to the main coun- ter, it will decrement its contents. The main counter is initially loaded by writing to the Timer Data Regis- ter. Each count pulse will cause the current count to decrement. When the timer has decremented down to ”01” , the next count pulse will not cause it to de- crement to ”00”. Instead, the next count pulse will cause the timer to be reloaded from the Timer Data Register. Additionally, a ”Time out” pulse will be pro- duced. This Time Out pulse is coupled to the timer interrupt channel, and, if that channel is enabled, an interrupt will be produced. The Time Out pulse is al- so coupled to the timer output pin and will cause the pin to change states. The output will remain in this new state until the next Time Out pulse occurs. Thus the output will complete one full cycle for each two Time Out pulses. If, for example, the prescaler were programmed to divide by ten, and the Timer Data Register were loa- ded with 100 (decimal), the main counter would de- crement once for every ten cycles of the timer clock. A Time Out pulse will occur (hence aninterrupt if that channel is enabled) every 1000 cycles of the timer clock, and the timer output will complete one full cy- cle every 2000 cycles of the timer clock. The main counter is an 8-bit binary down counter. It may be read at any time by reading the Timer Data Register. The information read is the information last clocked into the timer read register when the DS pin had last gone high prior to thecurrent read cycle. When written, data is loaded into the Timer Data Re- gister, and the main counter, if the timer is stopped. If the Timer Data Register is written while the timer is running, the new word is not loaded into the timer until it counts through H”01”. However, if the timer is written while it is counting through H”01”, an inde- terminate value will be writteninto thetimer constant register. This may be circumvented by ensuring that the data register is not written when the count is H”01”. If the main counter is loaded with ”01”, a Time Out Pulse will occur every time the prescaler presents a count pulse to the main counter. If loaded with ”00”, a Time Out pulse will occur every 256 count pulses. Figure 12 :Timer A and B Control Registers. Unused bits : read as zeros. V000359 MK68901

Figure 15 :A Conceptual Circuit of the MFP Timers in the Pulse Width Measurement Mode. Changing the prescale value with the timer running can cause the first Time Out pulse to occur at an in- determinate time, (no less than one nor more than 200 timer clock cycles times the number in the time constant register), but subsequent Time Out pulses will then occur at the correct interval. In addition to the delay mode described above, Ti- mers A and B can also function in the Pulse Width Measurement mode or in the Event Count mode. In either of these two modes, an auxiliary control signal is required. The auxiliary control input for Timer A is TAI, andfor Timer B,TBI is used. The interrupt chan- nels associated with 14 and 13 are used for TAI and TBI, respectively, in Pulse Width mode. See Figure 15. The pulse width measurement mode functions much like the delay mode. However, in this mode, the auxiliary control signal on TAI or TBI acts as an enable to the timer. When the control signal on TAI or TBI is inactive, the timer will be stopped. When it is active,the prescaler andmain counter are allowed to run. Thus the width of the active pulse on TAI or TBI is determined by the number of timer counts which occur while the pulse allows the timer to run. The active state of the signal on TAI or TBI is de- pendent upon the associated Interrupt Channel’s edge bit (GPIP 4 for TAI and GPIP 3 for TBI : see Active Edge Register in figure 5). If the edge bit as- sociated with the TAI or TBI input is a one, it will be active high ; thus the timer will be allowed to run when the input is at a high level. If the edge bit is a zero, the TAI or TBI input will be active low. As pre- viously stated, the interrupt channel (13 or 14) as- sociated with the input still functions when the timer is used in the pulse width measurement mode. How- ever, if the timer is programmed for the pulse width measurement mode, the interrupt caused bytran-si- tions on the associated TAI or TBI input will occur on the opposite transition. For example, if the edge bit associated with the TAI input (AER-GPIP 4) is as one, an interrupt would normally be generated on the 0-1 transition of the 14 input signal. If the timer associated with this input (Timer A) is placed in the pulse width measurement mode, the interrupt will occur on the 1-0 tran-sition of the TAI signal instead. Because the edge bit (AER-GPIP 4) is a one, Timer A will be allowed to count while the input is high. When the TAI input makes the high to low transition, Timer A will stop, and it is at this point that the interrupt will occur (as- suming that the channel is enabled). This allows the interrupt to signal the CPU that the pulse being mea- sured has terminated ; thus Timer A may now be read to determine the pulse width. (Again note that 13 and 14 may still be used for I/O when the timer is in the pulse width measurement mode). If Timer V000332 MK68901

A is reprogrammed for another mode, interrupts will again occur on the transition, as normally defined by the edge bit. Note that, like changing the edge bit, placing the timer into or taking it out of the pulse width mode can produce a transition on the signal to the interrupt channel and may cause an interrupt. If measuring consecutive pulses, it is obvious that one must read the contents of the timer and thenrei- nitialize the main counter by writing to the timer data register. If the timer data register is written while the pulse is going to the active state, the write operation may result in an indeterminate value being written into the main counter. If the timer is written after the pulse goes active, the timer counts from the pre- vious contents, and when it counts through H”01”, the correct value is written into the timer. The pulse width then includes counts from before the timer was reloaded. In the event count mode, the prescaler is disabled. Each time the control input on TAI or TBi makes an active transition as defined by the associated Inter- rupt Channel’s edge bit, a count pulse will be gene- rated, and the main counter will decrement. In all o- ther respects, the timer functions as previously des- cribed. Altering the edge bit while the timer is in the event count mode can produce a count pulse. The interrupt channel associated with the input (I3 for I4 for TAI) is allowed to function normally. To count transitions reliably, the input must remain in each state (1/O) for a length of time equal to four periods of the timer clock ; thus signals of a frequency up to one fourth of the timer clock can be counted. The manner in which the timer output pins toggle states has previously been described. All timer out- puts will be forced low by a device RESET. The out- put associated with Timers A and B will toggle on each Time Out pulse regardless of the mode the ti- mers are programmed to. In addition, the outputs from Timers A and B can be forced low at any time by writing a ”1” to the reset location in TACR and TBCR, respectively. The output will be forced to the low state during the WRITE operation, and at the conclusion of the operation, the output will again be free to toggle each time a Time Out pulse occurs. This feature will allow waveform generation. During reset, the Timer Data Registers and the main counters are not reset. Also, if using the reset option on Timers A or B, one must make sure to keep the other bits in the correct state so as not to affect the operation of Timers A and B. USART Serial Communication is provided by a full-duplex double-buffered USART, which is capable of either asynchronous or synchronous operation. Variable word length and start/stop bit configurations are available under software control for asynchronous operation. For synchronous operation, a Sync Word is provided to establish synchronization during re- ceive operations. The Sync Word will also be repea- tedly transmitted when no other data is available for transmission. Moreover, the MK68901 allows strip- ping of all Sync Words received in synchronous o- peration. The handshake control lines RR (Receiver Ready) and TR (Transmitter Ready) allow DMA o- peration. Separate receive and transmit clocks are available, and separate receive and transmit status and data bytes allow independent operation of the transmit and receive sections. The USART is provided with three Control/Status Registers and a Data Register. The USART Data Register form is illustrated in figure 16. The pro- grammer may specify operational parameters for theUSART via the Control Register, as shown in fig- ure 17. Status of both the Receiver and Transmitter sections is accessed by means of thetwo Status Re- gisters, as shown in figures 18 and 19. Data written to the Data Register is passed to the transmitter, while reading the Data Register will access data re- ceived by the USART. Figure 16 :USART Data Register. V000362 MK68901

÷ 16/÷ 1 : When this bit is zero, data will be clocked into and out of the receiver and transmit- ter at the frequency of their respective clocks. When this bit is loaded with aone, data will be clocked into and out of the re- ceiver and transmitter at one sixteenth the frequency of their respective clocks. Additionally, when placed in the divide by sixteenmode, the receiver data transition resynchronization logic will be enabled. WL0-WL1 :Word Length Control. These two bits set the length of the data word (exclusive of start bits, stop bits, and parity bits as fol- lows: ST0-ST1 : Start/stop bit control (format control). These two bits set the format as follows PARITY : Parity Enabled. When set (”1”), parity will be checked by the receiver, parity will be calculated, and a parity bit will be inserted by the transmitter. When cleared (”0”) no parity check will be made and no parity bit will be inserted for transmission. For a word length of 8 the MFP calculates the parity and appends it when transmit- ting a sync character. For shorter lengths, the parity must be stored in the Sync Character Register (SCR) along with the sync character. E/O : Even-Odd. When set (”1”), even parity will be used if parity is enabled. When cleared (”0”), odd parity will be used if pa- rity is enabled. Note that the synchronous or asynchronous format maybe selected independently of a÷ 1or÷ 16clock. Thus it is possible to clock data synchronously into the device but still use start and stop bits. In this mode, all normal asynchronous format features still apply. Data will be shifted in after a start bit is en- countered, and a stop bit will be checked to deter- mine proper framing. If a transmit underrun condi- tion occurs, the output will be placed in a marking state, etc. It is conversely possible to clock data in asynchronously using a synchronous format. There is data transition detection logic built into the receive clock circuitry which will re-synchronize the internal shift clock on each data transition so that, with suf- ficientyfrequent data transitions, startbits are not re- quired. In this mode, all other common synchronous features function normally. This re-synchronization logic is only active in÷ 16 clock mode. RECEIVER The receiver section of the USART is configured by the UCR as previously described. The status of the receiver can be determined by reading and writing to the Receiver Status Register (RSR). The RSR is configured as follows : Figure 17 :USART Control Register (UCR). WL1 WL0 Word Length

8 Bits

7 Bits

6 Bits

5 Bits

ST1 ST0 Start Bits StopBits Format SYNC ASYNC ASYNC ASYNC V000363 MK68901

Figure 18 :Receiver Status Register (RSR). BF : Buffer Full. This bit is set when the inco- ming word is transferred to the receive buffer. The bit is cleared when the re- ceive buffer is read by reading the UDR. This bit of the RSR is read only. OE : Overrun Error. This flag is set if the inco- ming word is completely received and due to be tranferred to the receive buf-fer, but the last word in the receive buf-ferhas not yet been read. When this condition occurs, the word in the receive buffer is not overwritten by the new word. Note that the status flags always reflect the status of the data word currently in there- ceive buffer. As such, the OE flag is not actually set until the good word currently in the buffer has been read. The interrupt associated with this error will also not be generated unti the old word in the receive buffer has been read. OE flag is cleared by reading thereceiver status register, and new data words can- not be shifted to the receive buffer until this is done. PE : Parity Error. This flag is set if the word re- ceived has a parity error. The flag is set when the received word is tranferred from the shift register to the receive buf- fer if the error condition exists. The flag is cleared when the next word which does not have a parity error is tranferred to the receive buffer. FE : Frame Error. This flag only applies to the asynchronous format. A frame error is defined as a non-zero data word which is not followed by a stop bit. Like the PE flag, the FE flag is set or cleared when a word is transferred to the receive buffer. F/S : Found/Search. This combination control bit and flag bit is only used with the syn- chronous format. It can be set or cleared bywriting to this bit of the RSR. Whenthis bit is cleared, the receiver is placed in the search mode. In this mode, a bit by bit comparison of the incoming data to the character in the Sync Character Register (SCR) is made. The word length counter is disabled. When a match is found, this bit will be set automatically, and the word length counter will start as sync has not been achieved. An interrupt will be gene- rated on the receive error channel when the match occurs. The word just shifted in will, or necessity, be equal to the sync character, and it will not be transferred to the receive buffer. B : Break. This flag is used only when the a- synchronous format is selected. This flag will be set when an all zero data word, fol- lowed by no stop bit, is received. The flag will stay set until both a non-zero bitis re- ceived and the RSR has been read at least once since the flag was set. Break indication will not occur if thereceive buff- er is full. M/CIP : Match/Character in Progress. If the syn- chronous format is selected, this flag is the Match flag. It will be set each time the word transferred to the receive buffer matches the sync character. It will be re- set each time the word transferred to the receive buffer does not match the sync character. If the asynchronous format is selected, this flag represents Character in Progress. It will be set upon a start bit detect and cleared at the end of the word. SS : Sync Strip Enable. If this bit is set to a one, data words that match the sync character will not be loaded into the re- ceive buffer, and no buffer full signal will be generated. RE : Receiver Enable. This control bit is used to enable or disable the receiver. If a zero is written to this bit of the RSR, the recei- ver will turn off immediately. All flags in- cluding the F/S bit will be cleared. If a one is written to this bit, normal receiver ope- ration is enabled. The receive clock has to be running before the receiver is en- abled. V000364 MK68901

There are twointerrupt channels associated withthe receiver. One channel is used for the normal Buffer Full condition, while the other channel is used whe- never an error condition occurs. Only one interrupt is generated per word received, but dedicating two channels allows separate vectors : one for the nor- mal condition, and one for an error condition. If the error channel is disabled, an interrupt will be gen-e- rated via the Butter Full Channel, whether the word received is normal or in error. Those conditions which produce an interrupt via the error channel are : Overrun, Parity Error, Frame Error, Sync Found, and Break. If a received word has an error associated with it, and the error interrupt channel is enabled, an interrupt will occur on the error channel only. Each time a word is transferred into the receive buf- fer, a corresponding set of flags is latched into the RSR. No flags (except CIP) are allowed to change until the data word has been read from the receive buffer. Reading the receive buffer allows a new data word to be transferred to the receive buffer when it is received. Thus one should first read the RSR then read the receive buffer (UDR) to ensure that the flags just read match the data word just read. If done in the reverse order, it is possible that subsequent to reading the data word from the receive buffer, but prior to reading the RSR, a new word may be recei- ved and transferred to the receive buffer and, with it, its associated flags latched into the RSR. Thus, when the RSR is read, those flags may actually cor- respond to a different data word. It is good practice, also to read the RSR prior to a data read as, when an overrun error occurs, the receiver will not assem- ble new characters until the RSR has been read. As previously stated, when overrun occurs, the OE flag will not be set and the associated interrupt will not be generated until the receive buffer has been read. If a break occurs, and the receive buffer has not yet been read, only the B flag will be set (OE will not be set). Again, this flag will not be set until the last valid word has been read from the receive buf- fer. If the break condition ends and another whole data word is received before the receive buffer is read, both the B and OE flags will be set once the receive buffer is read. If a break occurs while the OE flag is set, the B flag will also be set. A break generates an interrupt when the condition occurs and again when the condition ends. If the break condition ends before it is acknowledged by reading the RSR, the receiver error interrupt indica- ting end of break will be generated once the RSR is read. Anytime the asynchronous format is selected, start bit detection is enabled. New data is not shifted into the shift register until a zero bit is detected. If a÷ 16 clock is selected, along with the asynchronous for- mat, false start bit detection is also enabled. Any transition has to be stable for 3 positive going edges of the receive clock to becalled a valid transition. For a start bit to be good, a valid 0-1 transition must not occur for 8 positive clock transitions after the initial valid 1-0 transition. After a good start bit has been detected, valid tran- sitions in the data are checked for continously. When a valid transition is detected, the counter is forced to state zero, andno more transition checking is started until state four. At stateeight, the ”previous state” of the transition checking logic is clocked into the receiver. As a result of this resynchronization logic, it is pos- sible to run with asynchronous clocks without start and stop bits if there are sufficient valid transitions in the data stream. This logic also makes the unit more tolerant of clock skew for normal asynchro- nous communications than a device which employs only start bit synchronization. Figure 19 :Transmitter Status Register (TSR). V000365 MK68901

The transmitter section of the USART is configured as to format, word length, etc. by the UCR, as pre- viously described. The status of the transmitter can be determined by reading or writing the Transmitter Status Register (TSR). The TRSis configured as fol- lows : BE : Buffer Empty. This status bit is set when the word in the transmit buffer is transfer- red to the output shift register and thus the transmit buffer may be reloaded with the next data word. The flag is cleared when the transmit buffer is reloaded. The transmit buffer is loaded by writing to the UDR. UE : This bit is set when the last word has been shifted out of the transmit shift re- gister before a new word has been loa- ded into the transmit buffer. It is not ne- cessary to clear this bit before loading the UDR. This bit may be cleared by either reading the TSR or by disabling the transmitter. After the setting of the UE bit, one full transmitter clock cycle is required before this bit can be cleared by a read. The ti- ming in some systems may allow a read of the TSR before the required clock cy- cle has been completed. This would re- sult in the UE bit not being cleared until the following read. To avoid this problem, a dummy read of the TSR should be per- formed at the end of he UE service rou- tine. Only one underrun error may be genera- ted between loads of the UDR regardless of the number of transmitter clock cycles between UDR loads. AT : Thisbit causes the receiver to beenabled at the end of the transmission of the last word in the transmitter if the transmitter has been disabled. END : Endor Transmission. When thetransmit- ter is turned off with a character still in the output shift register, transmission will continue until that character is shifted out. Once it has cleared the output regis- ter, the END bit will be set. If no character is being transmitted when the transmitter is disabled, the transmitter will stop at the next rising edge of the internal shift clock, and END will immediately be set. The END bit is cleared by re-enabling the transmitter. B : Break. This control bit will cause a break to be transmitted. Whena ”1” is written to the B bit of the TSR, a break will be trans- mitted upon completion of the character (if any) currently being transmitted. A break will continue to be transmitted until the B bit is cleared by writing a ”0” tot his bit of the TSR. At that time, normal trans- mission will resume. The B bit has no function in the synchronous format. Set- ting the ”B” bit to a one keeps the ”BE” bit from being set to a one. So, if there were a word in the buffer at the start of break, it would remain there until the end of break, at which time it would be transmit- ted (if the transmitter is still enabled). If the buffer were not full at the start of break, it could be written at any time du- ring the break. If the buffer is empty at the end of break, the underrun flag will be set (unless the transmitter is disabled). The BREAK bit cannot be set until the transmitter has been enabled and the transmitter has had sufficient time (one clock cycle) to perform the internal reset and initialization functions. H,L : High and Low. These two control bits are used to configure the transmitter output, when the transmitter is disabled, as fol- lows : H L Output State 0 0 Hi-Z 0 1 Low (”0”) 1 0 High 1 1 Loop-Connects transmitter output to receiver input, and TC to Receiver Clock (RC and SI are not used ; they are bypas- sed internally). In loop back mode, trans- mitter output goes high when disabled. Altering these two bits after Transmitter MK68901

Figure 20 :SYNC Character Register. Enable (XE) is set will alter the output state untilEND is false. These bits should be set prior to enabling the transmitter. The state of these bits determine the state of the first transmitted character af- ter the transmitter is enabled. If the high impedance mode was selected prior to the transmitter being enabled, the first bit transmitted is indeterminate. XE : Transmitter Enable. This control bit is u- sed to enable or disable the transmitter. When set, the transmitter is enabled. When cleared, the transmitter will be di- sabled. If disabled, any word currently in the output register will continue to be transmitted when XE is cleared, the transmitter will turn off at the end of the break character boundary, and no end of break stop bit is transmitted. The transmit clock must be running before the trans- mitter is enabled A ”one” bit always pre- cedes the first word out of the transmitter after the transmitter is enabled. There is a delay between the time the transmitter enable bit is written an whenthe transmit- ter reset goes low ; therefore, the H & L bits should be written with the desired state prior to enabling the transmitter. Like the receiver section, there are two separate in- terrupt channels associated with the transmitter. The buffer Empty condition causes an interrupt via one channel, while the Underrun and END condi- tions will cause an interrupt via the second channel. When underrun occurs in the synchronous format, the character in the SCR will be transmitted until a new words is loaded into the transmit buffer. In the asynchronous format, a ”Mark” will be continuously transmitted when underru n occurs. The transmit buffer can be loaded prior to enabling the transmitter. When the transmitter is disabled, anycharacter currently in theprocess of being trans- mitted will continue to conclusion, but any character in the transmit buffer will not be transmitted and will remain in the buffer. Thus no buffer empty interrupt will occur nor will the BE flag be ste. Ifthe bufferwere already empty, the BE flag would be set and would remain set. When the transmitter is disabled with a character in the output register but with no character in the transmit buffer, an Underrun Error will not oc- cur when the character in progress concludes. Often it is necessary to send a break for some par- ticular period. To aid in timing a break transmission, a transmission, a transmit error interrupt will be ge- nerated at every normal character boundar y time during a break transmission. The status register in- formation is unaffected by this error condition inter- rupt. It should be noted that an underrun error, if pre- sent, must be cleared from the TSR, and the inter- rupt pending register must be cleared of pending transmitter errors at the beginning of the break transmission or no interrupts willbe generated at the character boundary time. It the synchronous format is selected, the sync char- acter should be loaded into the Sync Character Re- gister (SCR) as shouwn in figure 20. This character is compared to the received serial data during a Search, and will be continuously transmitted during an underrun condition. All flags in the RSR or TSR will continue to function as described whether their associated interrupt channel is disabled or enabled. All interrupt chan- nels are edge triggered and, in many cases, it is the actual output of a flag bit or flag bits which is coupled to the interrupt channel. thus, if a normal interrupt producing condition occurs while the interrupt chan- nel is disabled, no interrupt would be produced even if the channel was subsequently enabled, because a transition did not occur while the interrupt channel was enabled. that particular flag bit would have to occur a second time before another ”edge” waspro- duced, causing an interrupt to be generated. Error conditions in the USART are determined by monitoring the Receive Status Register and the Transmitter Status Register. These error conditions are only valid for each word boundary and are not latched. When executing block tranfers or data, it is necessary to save any errors so that they can be checked at the end of a block. In order to save error conditions during data transfer, the MK68901 MFP interrupt controller may be used by enabling error in- terrupt for the desired channel (Receive error or Transmit error) and by masking these bits off. Once the tranfer is complete, the Interrupt Pending Regis- ter can be polled, to determine the precence of a pending error interrupt, and therefore an error. V000366 MK68901

Unused bits in the sync character register are ze- roed out ; therefore, word length should be set up prior to writing the sync word in some cases. Sync word length is the word length plus one when parity is enabled. The user has to determine the parity of the syncword when the word length is not 8 bits. The MK68901 MFP does not add a parity bit to the sync word if the word length is less than 8 bits. The extra bit in the sync word is transmitted as the parity bit. With a word length of eight, and parity selected, the parity bit for the sync word is computed an added on by the MK68901 MFP. RR RECEIVER READY RR is asserted when the Buffer Full bit is set in the RSR unless a parity error or frame error is detected by the receiver. TR TRANSMITTER READY TR is asserted when the Buffer Empty bit is set in the TSR unless a break is currently being transmitted. REGISTER ACCESSES All register accesses are dependent on CLK as shown in the timing diagrams. To read a register, CS andDSmust beasserted, and R/W must byhigh. The internal read control signal is essentially the combi- nation of CS, DS, and RD/WR. Thus, the read ope- ration will begin when CS and DS go active and will endwhen either CS or DSgoes inactive. Theaddress bus must be stable prior to the start of the operation andmust remain stable until theend of the operation. Unless a read operation or interrupt acknowledge cy- cle is in progress the data bus (D 0-D7) will remain in the tri-state condition. To write aregister, CSand DSmust beasserted and R/W must be low. The address must be stable prior to the start of the operation and must remain stable until the end of the operation. After the MK68901 as- serts DTACK, the CPU negates DS,. At this time,the MFP latches the data bus and writes the contents in- to the appropriate register. Also when DS is nega- ted, the MFP rescinds DTACK. For an interrupt acknowledge, the operation starts when IACK goes low, and ends when IACK goes high. The data bus is tri-stated when either IACK or DS goes high. When CS or IACK are asserted the MFP starts an internal cycle. DS is needed to enable the address and data buffers. It is recommended taht CS and IACK be gated by DS so that DS is always present whenever an MFP bus cycle starts. MK68901

D.C. CHARACTERISTICS TA =0 °Ct o7 0°C;V CC =+5 V ± 5% Unless Otherwise Specified Symbol Parameter Test Condition Min. Max. Unit V IH Input High Voltage 2.0 V CC +. 3 V V IL Input Low Voltage – 0.3 0.8 V V OH Output High Voltage (except DTACK) I OH = – 120µA 2.4 V V OL Output Low Voltage (except DTACK) I OL = 2.0mA 0.5 V ILL Power Supply Current Outputs Open 180 mA ILI Input Leakage Current V IN = 0 to VCC ± 10 µA ILOH Tri-state Output Leakage Current in Float VOUT = 2.4 to VCC 10 µA ILOL Tri-state Output Leakage Current in Float VOUT = 0.5V – 10 µA IOH DTACK Output Source Current V OUT = 2.4 – 400 µA IOL DTACK Output Sink Current V OUT = 0.5 5.3 mA All voltages are referenced to ground. CAPACITANCE TA =2 5°C, f = 1MHz unmeasured pins returned to ground. Symbol Parameter Test Condition Max. Unit C IN Input Capacitance Unmeasured pins returned to ground 10 pF C OUT Tri-state Output Capacitance 10 pF MK68901 ELECTRICAL SPECIFICATIONS – PRELIMINARY ABSOLUTE MAXIMUM RATINGS Symbol Parameter Value Unit TA Temperature under Bias – 25 to + 100 °C Tst g Storage Temperature – 65 to + 150 °C V I Voltage on Any Pin with Respect to Ground – 0.3 to + 7 V P D Power Dissipation 1.5 W Stresses above those listed under ”Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or any other condition above those indicated in the operational sec- tions of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect re- liability. MK68901

AC ELECTRICAL CHARACTERISTICS (VCC = 5.0Vdc± 5%, GND = 0Vdc, TA =0 °Ct o7 0°C) Value MK68901-4 MK68901-5Number Characteristic Min. Max. Min. Max. Unit Fig. Note

1 CS, DS Width High 50 35 ns 21,22 5

2 R/W, A1-A5 Valid to Falling CS (setup) 0 0 ns 21,22

3 Data Valid Prior to Falling CLK 280 0 ns 22

4 CS, IACK Valid to Falling Clock (setup) 50 45 ns 21-24 3

5 CLK Low to DTACK Low 220 180 ns 21,22

6 CS, DS or IACK High to DTACK High 60 55 ns 21-24

7 CS, DS or IACK High to DTACK Tri-state 100 95 ns 21-24

8 DTACK Low to Data Invalid (hold time) 0 0 ns 22

9 CS, DS or IACK High to Data Tri-state 50 50 ns 21,23,24

10 CS or DS High to R/W, A1-A5 Invalid (hold time) 0 0 ns 21,22

11 Data Valid from CS Low 310 260 ns 21 3,6

12 Read Data Valid to DTACK Low (setup) 50 50 ns 21

13 DTACK Low to DS, CS or IACK High (hold time) 0 0 ns 21-23

14 IEI Low to Falling CLK (setup) 50 50 ns 23,24

15 IEO Valid from Clock Low (delay) 180 180 ns 23 1

16 Data Valid from Clock Low (delay) 300 300 ns 23

17 IEO Invalid from IACK High (delay) 150 150 ns 23, 24

18 DTACK Low from Clock High (delay) 180 165 ns 23, 24

19 IEO Valid from IEI Low (delay) 100 100 ns 24 1

20 Data Valid from IEI Low (delay) 220 220 ns 24

21 Clock Cycle Time 250 1000 200 1000 ns 21

22 Clock Width Low 110 90 ns 21

23 Clock Width High 110 90 ns 21

24 CS, IACK Inactive to Rising Clock (setup) 100 80 ns 21-23 4,5

25 I/O Minimum Active Pulse Width 100 100 ns 25

26 IACK Width High 2 2 T

27 I/O Data Valid from Rising CS or DS 450 450 ns 26

28 Receiver Ready Delay from Rising RC 600 600 ns 27

29 Transmitter Ready Delay from Rising TC 600 600 ns 28

30 Timer Output Low from Rising Edge of CS or DS

(A & B) (reset T OUT ) 450 450 ns 29 7

31 T OUT Valid from Internal Timeout 2 t CLK

+ 300 2t CLK + 300 ns 29 2

32 Timer Clock Low Time 110 90 ns 29

AC ELECTRICAL CHARACTERISTICS (continued) (VCC = 5.0Vdc± 5%, GND = 0Vdc, TA =0 °Ct o 7 0°C) Value MK68901-4 MK68901-5Number Characteristic Min. Max. Min. Max. Unit Fig. Note

33 Timer Clock High Time 110 90 ns 29

34 Timer Clock Cycle Time 250 1000 200 1000 ns 29

35 RESET Low Time 2 1.8 µs3 0

36 Delay to Falling INTR from External Interrupt

Active Transition 380 380 ns 25

37 Transmitter Internal Interrupt Delay from Falling

38 Receiver Buffer Full Interrupt Transition Delay

from Rising Edge of RC 800 800 ns 27

39 Receiver Error Interrupt Transition Delay from

Falling Edge of RC 800 800 ns 27

40 Serial in Set Up Time to Rising Edge of RC

(divide by one only) 80 70 ns 27

41 Data Hold Time from Rising Edge of RC

(divide by one only) 350 325 ns 27

42 Serial Output Data Valid from Falling Edge of TC

(÷1) 440 420 ns 28

43 Transmitter Clock Low Time 500 450 ns 28

44 Transmitter Clock High Time 500 450 ns 28

45 Transmitter Clock Cycle Time 1.05 ∞ 0.95 ∞ µs2 8

46 Receiver Clock Low Time 500 450 ns 27

47 Receiver Clock High Time 500 450 ns 27

48 Receiver Clock Cycle Time 1.05 ∞ 0.95 ∞ µs2 7

49 CS, IACK, DS Width Low 80 80 T

50 Serial Output Data Valid from Falling Edge of TC

(÷16) 490 370 ns 28 Notes : 1. IEO only goes low if no acknow ledgea ble interrupt is pending. If IEO goes low, DTACK and the data bus re- main tri-stated. 2. TCLK refers to the clock applied to the MFP CLK input pin. tCLK refers to the timer clock signal, regardless of whether thatsignal comes from the XTAL 1/XTAL2crys- tal clock inputs or the TAI or TBI timer inputs. 3. If the setup time is not met, CS or IACK will not be reco- gnized until the next falling CLK. 4. If this setup time is met (for consecu tive cycles), the mi- nimum hold-off time of one clock cycle will be obtained. If not met, the hold-off will be two clock cycles. 5. CS is latched internally, therefore if spec’s 1 and 24 are met then CS may be reass erted before the rising clock andstill terminate the current bus cycle.The new buscy- cle will be delay ed by the MK6890 1 until all appro priate internal opera tions have comple ted. 6. Although CS and DTACK are synchro nized with the clock, the data out during a read cycle is asyn chron ous to the clock, relying only on CS for timing. 7. Spec. 30 applies to timer outputs TAO and TBO only. MK68901

TIMER A.C. CHARACTERISTICS Definitions : Error = Indicated Time Value - Actual Time Value tpsc = t CLK x Prescale Value Internal Timer Mode Single Interval Error (free running) (note 2) ± 100ns Cumulative Internal Error 0 Error between Two Timer Reads ± (tpsc + 4tCLK ) Start Timer to Stop Timer Error + (2t CLK + 100ns) to - (tpsc + 6tCLK + 100ns) Start Timer to Read Timer Error + 0 to – (tpsc + 6t CLK + 400ns) Start Timer to Interrupt Request Error (note 3) - 2t CLK to – (4tCLK + 800ns) Notes : 1. Error may be cumulative if repetitively performed. 2. Error with respect to TOUT or INT if note 3 is true. 3. Assuming it is poss ible for the timer to make an interrupt request immediately. PULSE WIDTH MEASUREMENT MODE Measurement Accuracy (note 1) + 2t CLK to – (tpsc + 4tCLK ) Minimum Pulse Width 4tCLK EVENT COUNTER MODE Minimum Active Time of TAI, TBI 4tCLK Minimum Inactive Time of TAI, TBI 4tCLK MK68901

MK68901 48–PIN PLASTIC DUAL–IN–LINE PACKAGE (N) Millimeters Inches Dim Min. Max. Min. Max. A 61.468 62.738 2.420 2.470 B 14.986 16.256 .590 .640 C 13.462 13.97 .530 .550 D 3.556 4064 .140 .160 E 0.381 1.524 .015 .060 F 3048 3.81 .120 .150 G 1.524 2.286 .060 .090 H 1.186 1.794 .090 .110 J 15.24 17.78 .600 .700 K 0.381 0.533 .015 .021 L 0.203 0.305 .008 .012 M 1.143 1.778 .045 .070 MK68901

MK68901 48–PIN CERAMIC DUAL–IN–LINE PACKAGE (P) InchesDim Min. Max. A 2.376 2.424 B 0.576 0.604 C 0.120 0.160 D 0.015 0.021 F 0.030 0.055 G 0.100 BSC J 0.008 0.013 K 0.100 0.165 L 0.590 0.616 M0 ° 10° N 0.040 0.060 MK68901

MK68901 52–PIN PLASTIC LEADED CHIP CARRIER (Q) InchesDim Min. Max. A .165 .180 A 1 .090 .130 D .785 .795 D 1 .750 .756 D 2 .690 .730 E .785 .795 E 1 .750 .756 E 2 .690 .730 H .042 .048 J .042 .048 K .013 .024 L .008 .014 M .026 .032 N/N1 .043 .048 MK68901

PLCC DIP FUNC. PLCC DIP FUNC. PLCC DIP FUNC. NC R/W TC SO SI RC V CC NC NC TAO TBO TCO TDO XTAL1 XTAL2 NC TAI TBI RESET IO NC TR RR INTR IEO IEI CLK GND IACK DTACK DS CS Note : NC – No Connection Information furnished is believed to be accurate and reliable. However, SGS-THOMSON Microelectronics assumes no responsability for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of SGS-THOMSON Microelectronics. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. SGS-THOMSON Microelectronics products are not authorized for use as critical components i n life support devices or systems without the express written approval of SGS-THOMSON Microelectronics.  1994 SGS-THOMSON Microelectronics - All rights reserved. Purchase of I 2C Components by SGS-THOMSON Microelectronics conveys a license under the Philips I2C Patent. Rights to use these components in an I2C system is granted provided that the system conforms to the I2C Standard Specification as defined by Philips. SGS-THOMSON Microelectronics Group of Companies Australia - Brazil - France - Germany - Hong Kong - Italy - Japan - Korea - Malaysia - Malta - Morocco The Netherlands Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A. MK68901