CMPE 401 - Computer Interfacing

Assignment #3

Due: In the CMPE 401 assignment box at 15:45 on Wednesday, Nov. 3, 2004


  1. The MC68681 DUART has a single active-low interrupt request output called IRQ. In addition, it is possible to configure parallel outputs OP4, OP5, OP6 and OP7 to produce separate active-low interrupt request outputs for interrupt status conditions RxRDYA, RxRDYB, TxRDYA and TxRDYB, respectively. In the Laboratory 2 exercises you designed a single interrupt service routine for handling these same four interrupt conditions. Briefly explain how the system software and hardware would have to be modified to handle the four separate hardware interrupt signals. (Note: You can assume that the DUART has already been initialized and configured properly.) Be sure to explain whether or not each of the user interrupt and autovectored interrupt methods would be appropriate to use.

  2. Consider the DUART interrupt service routine (ISR) shown below, which is required to handle interrupts for serial channel A. The ISR is to simultaneously handle both the transmit and receive directions for channel A. Received characters are to be added to a queue by calling the subroutine ADD_TO_RX_QUEUE. Transmitted characters are to be obtained from a pointer variable TX_BYTE_PTR provided a boolean flag ANY_BYTES_TO_TX is 1; otherwise, transmit interrupts are to be disabled (transmit interrupts are enabled properly in another routine). You can assume that the ISR uses the same symbol definitions as in the DUART driver software that you used in the laboratory exercises. Unfortunately, the ISR contains several simple programming errors. Try to find as many errors as possible, and indicate (by writing directly on the program) how the problems could be most easily fixed.

    DUART_ISR: MOVEM.L  D0-D7/A0-A6,(SP)-
               LEA.L    #DUART_ADDR,A0
               MOVE.B   ISR(A0),D0
               ANDI.B   #RxRDYA,D0
               BNE      CheckTx
    RxIRQ:     MOVE.W   RBA(A1),D1
               MOVE.W   D1,-(A7)
               JSR      ADD_TO_RX_QUEUE
               ADDQ.W   #1,SP
               BRA      EXIT_ISR
    CheckTx:   ANDI.B   #TxRDYB,D0
               BEQ      EXIT_ISR
               TST.B    ANY_BYTES_TO_TX
               BEQ      DISABLE_TX_IRQS
               LEA.L    TX_BYTE_PTR,(A2)
               MOVE.B   (A2)+,TBA(A0)
    DISABLE_TX_IRQS:
               MOVE.B   TxRDYA,IMR(A0)
    EXIT_ISR:  MOVEM.L  (SP)+,D0-D7/A1-A6
               RTS
    

  3. Consider the design of an asynchronous serial interface (not RS232C). The new interface is to be capable of transporting 100-bit-long data packets without the need for resynchonization for the entire duration of the frame after the start bit has been used to synchronize the receiver clock. Assuming that the master clocks in both the transmitter and receiver operate 16 times faster than the nominal bit rate (100 kilobits per second), how accurately must the two clocks agree with each other in frequency (as a percentage) to guarantee that the last received data bit in each frame is sampled within 25% of a bit time of the ideal middle instant of the bit? How would the accuracy requirement change if the overclocking ratio were to be 8, instead of 16, and the data frames were to contain 300 bits, instead of 100?

  4. In a human-to-human telephone call, what is the protocol for recovering from a bad connection (e.g. a connection that has a large degree of interfering random noise)? What sorts of errors could occur during reconnection attempts because the human protocol is usually informal?

  5. What are the primary advantages to introducing layering into a communications interface? What are the possible disadvantages to having a relatively large number of layers over having a smaller number of layers?

  6. Briefly describe the functions of routers, bridges and repeaters in a TCP/IP network. Consider the network illustrated in lecture slide 7-16. Briefly justify the positioning of the routers, bridges and repeaters in this network.

  7. The window-based acknowledgement scheme used in TCP accomplishes two objectives at the same time: (1) it provides flow control between two communicating nodes, and (2) it provides a mechanism for recovering from the loss or reordering of data packets (e.g. TCP segments). In each segment sent by a node A to node B, there is a 32-bit sequence number in the header that corresponds to the first data byte in the segment's data field. The window field in the same segment indicates how many data bytes node A is prepared to send to node B without receiving a TCP segment coming back from node B to node A with an incremented acknowledgement number in its header. The acknowledge number is used by node B to tell node A what the last data byte was that was received in the correct order. (An identical but separate window protocol operates for data travelling in the reverse direction from node B to node A.)

    Briefly explain how the window scheme provides both features (1) and (2) mentioned at the start of this question.