Testing Communication Systems When pointtopoint communication between two
Testing Communication Systems · When point-to-point communication between two DTEs is not functioning, which DTE is at fault? Or which DTE is correctly following the protocol? Or is the channel OK? · Many UARTs support built-in hardware facilities that permit programmers to perform software tests. - Loopback testing - Interrupt generation
Loopback Testing · A loopback test causes all data normally supplied to the UART for transmission to be returned to the processor as if it has just been received. UART Control Conditions . . . Input (to CPU) . . . Output (from CPU) Serial output (Idle with MARKs) Serial input (disconnected)
Loopback Testing · In 8250 UART, loopback is set by writing 0 x 10 to Modem Control Register (addr 0 x 3 FC for SP 1 and addr 0 x 2 FC for SP 2). MCR 7 0 loopback #define MCR_DEFN (DTR+RTS+OUT 2+LOOPBK)
Generating Interrupts · Certain errors (e. g. , overrun error or framing error) are caused by random or spurious events that are hard to duplicate, making it difficult to test error-handling software. · In 8250 UART, hardware interrupts can be generated through software to facilitate software testing. · Six H/W interrupts can be software generated from the Line Status Register as well as four from the Modem Status Register. · These interrupts are caused by writing to any of the corresponding status bits in the LSR and the having the UART in loopback mode.
Testing Overrun-error Handling S/W 1. Turn loopback on (port 0 x 2 FC). 2. Write 0 x 02 to the LSR (port 0 x 2 FD). 3. A line status interrupt is generated by UART, causing control to be passed to the interrupt handler. 4. IIR = 0 x 06 , LSR = 0 x 02. 5. Interrupt is serviced and cleared. 7 6 5 4 3 2 1 0 LSR Data Ready Overrun error Parity error Framing error Break detected Transmit holding register empty
UART Interrupts - Interrupt identification register indicates the cause of the interrupt. Interrupt identification register IIR 6 4 2 0 Interrupt 7 6 5 4 Receive line status (overrun, parity error, etc. ) Received data available TX holding Reg. empty Modem status change 3 2 1 0 Interrupt pending Interrupt id (b 0) Interrupt id (b 1)
Channel-Monitoring Tools · Break-Out Box - indicate (by LED) which signals on each of the different pins/lines between two DTEs are active. · Line Analyzer - show the data that is being transmitted on the communication channel.
Commkit Line Analyzer - PC A acts as a line analyzer to monitor traffic between PC 1 and 2. A 2 1 Need 2 serial ports - Basic operations: 1. Read a byte from either serial port. 2. Display the byte. 3. Forward the byte on to the other port. - Bytes from different serial ports are distinguished. - Implemented in three parts (analyzer. c): 1. Interrupt handlers 2. Display/control process 3. Character-forwarding software
Message Flow sp 1_ih() sp 2_ih() clk_ih() kb_ih() sp 1_ih() sp 2_ih() do_analyzer( )
- Slides: 9