Data Communication And: Networking

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

Data Communication and

Networking

M.Eng. Dang Ngoc Hanh


hanhdn@hcmut.edu.vn

Telecomm. Dept. DCN-2013


1
Faculty of EEE HCMUT
Content
Chapter 3: Data Link Layer Protocols
Flow Control
Error Control
Connection Management
Data Link Protocols
Chapter 4: Industrial Networks
CAN Networks
MODBUS Networks
Applications

Telecomm. Dept. DCN-2013


2
Faculty of EEE HCMUT
Framing
The data link layer needs to pack bits into frames, so
that each frame is distinguishable from another.
Fixed-Size Framing
Variable-Size Framing

Telecomm. Dept. DCN-2013


3
Faculty of EEE HCMUT
Flow and Error Control
The most important responsibilities of the data link
layer are flow control and error control. Collectively,
these functions are known as data link control.
Flow control refers to a set of procedures used to restrict
the amount of data that the sender can send before
waiting for acknowledgment.
Error control in the data link layer is based on automatic
repeat request, which is the retransmission of data.
 Now let us see how the data link layer can combine framing,
flow control, and error control to achieve the delivery of data
from one node to another. The protocols are normally
implemented in software by using one of the common
programming languages.
Telecomm. Dept. DCN-2013
4
Faculty of EEE HCMUT
Error Control
Forward Error Control (FEC)
Usually used in real-time application (e.g. voice, video)
Accept errors if can not correct
List some FEC methods?
Error Detection + ARQ (Automatic Retransmission Request)
Require absolutely correct data transmission
Used in non real-time application (e.g. email, file
transmission)
2 basic ARQ protocols:
• Idle RQ: Bisync (IBM), XModem
• Continuous RQ:
– Go-back N: e.g. HDLC, V.42
– Selective-Repeat: TCP, Service Specific Connection Oriented
Protocol
Telecomm. Dept. DCN-2013
5
Faculty of EEE HCMUT
Notations
I -frame
P S
ACK frame or NAK frame

 P: Primary, sending data frames


 S: Secondary, receiving data frames and sending ACK back to
Primary
 I frame: data/Information frame
 I(N): Data frame with sequence N
 ACK (Acknowledge) frame: response/reply sent from S back to
P, confirm receiving a good I-frame
 NAK (Negative Acknowledge) frame: response/reply sent from
S back to P, confirm receiving a corrupted I-frame (error
frame)
Telecomm. Dept. DCN-2013
6
Faculty of EEE HCMUT
Idle RQ
 Principle:
 P can have only 1 I-frame
outstanding (awaiting for
an ACK) at a time
 On receipt of an error-free
ACK frame, P transmits
another I-frame
 If S receives an I-frame or
P receives an ACK
containing transmission
error: the frame is
discarded
 If P does not receive an
ACK within a given timeout
interval: retransmits the
waiting I-frame
 If an ACK is corrupted, the
S receives another copy of
the frame and it is rejected
by S.
Telecomm. Dept. DCN-2013
7
Faculty of EEE HCMUT
Idle RQ
 Implicit retransmission
 P has to wait a timeout
interval before retransmission
 What is the drawback of this
mechanism? How to improve
 Explicit retransmission
 If S receives a corrupted I-
frame: return an NAK to P
 If P receives an ACK, stop the
timer, and transmit the next
frame.
 If P receives a NAK, retransmit
the I-frame
 If P does not receives ACK or
NAK during a timeout interval,
do the retransmission by timer

Telecomm. Dept. DCN-2013


8
Faculty of EEE HCMUT
Idle RQ
Advantages :
Send and Wait (Stop and Wait)
Small buffers: both P and S
keeps only 1 frame
Disadvantages:
Low link utilization
Used in transmission of
printable characters
Half-duplex applications
Notation:
N(S): send sequence number
N(R): receive sequence
number
Telecomm. Dept. DCN-2013
9
Faculty of EEE HCMUT
Idle-RQ
 Link utilization:

 In case BER=0:

Tix Tix 1 1
U=  = =
Tt Tix +2Tp 1+2Tp /Tix 1+2a
 Total average delay per frame?

Telecomm. Dept. DCN-2013


10
Faculty of EEE HCMUT
Idle-RQ
 In case BER>0 (channel with errors): in order to transmit 1 I-
frame successfully, sender needs to retransmit Nr frames:
Tix Tix 1 1
U= = = =
Nr .Tt Nr (Tix +2Tp ) Nr (1+2Tp /Tix ) Nr (1+2a)
 If we call Pf is the FER, and 1 frame has Ni bits:
Pf =1-(1-BER)Ni
 Probability that i transmission are needed to deliver frame
successfully ( i-1 transmission in error and the ith transmission is
error free ):

E[# of transmission in error]= (i-1).Pr [ # of trans. in error = i-1]
i=1
 
Pf
  (i-1).P .(1-Pf ) = (1-Pf ).Pf  (i-1).P =
f
i-1
f
i-2

i=1 i=1 1-Pf


Telecomm. Dept. DCN-2013
11
Faculty of EEE HCMUT
Idle-RQ
 Number of transmissions:
Pf 1
Nr =1+ =
1-Pf 1-Pf
 Utilization:
1-Pf
U=
(1+2a)
 Total average delay per frame?
 Utilization Performance when working with high speed and long
propagation delay?

Tt

Telecomm. Dept. DCN-2013


12
Faculty of EEE HCMUT
Idle-RQ: Example
A series of 1000-bit frames is to be transmitted using
an idle RQ protocol. Determine the link utilization for
the following types of data link assuming a data
transmission rate of (i) 1kpbs and (ii) 1 Mbps. The
velocity of propagation of the link is 2.108 m/s and
the BER is negligible
A twisted pair cable 1 km in length
A leased line 200km in length
A satellite link of 50,000 km
Solution?

Telecomm. Dept. DCN-2013


13
Faculty of EEE HCMUT
Idle-RQ: Communication
Usually, Idle-RQ is used in
unidirectional communication.
If using bidirectional
communication?
Both sender and receiver have to
send and acknowledge data
Piggy back methods:
outstanding ACKs are placed in the
header of information frames
save bandwidth since the overhead
from a data frame and an ACK
frame (addresses, CRC, etc) can be
combined into just one frame
Telecomm. Dept. DCN-2013
14
Faculty of EEE HCMUT
Continuous RQ
 Continuous RQ improves the link utilization at the expense of
increased buffer storage requirements.
 Principle:
 P sends I-frames continuously without waiting for an ACK to be returned
 Since more than 1 I-frames is waiting ACK, P retains a copy of each I-frame
transmitted in a retransmission list (using FIFO)
 S returns an ACK for each correctly received I-frame
 Each I-frame contains a unique identifier which is returned is the
corresponding ACK-frame
 On receipt of an ACK, the corresponding I-frame is removed from the
retransmission list by P
 Frames received free of errors are placed in the link receive list to wait
processing
 On receipt of the next in-sequence I-frame expected, S delivers the
information content within the frame to the upper layer
 In the event of frames being received out of sequence, S retains these in
the link receive list until the next in-sequence frame is received.

Telecomm. Dept. DCN-2013


15
Faculty of EEE HCMUT
Continuous RQ

Telecomm. Dept. DCN-2013


16
Faculty of EEE HCMUT
Continuous RQ
In the absent of errors, the link utilization of
continuous RQ is approximately 100%
When errors occur:
S detects and requests the retransmission of just those
frames in the sequence that are corrupted: Selective
Repeat
S detects the receipt of an out-of-sequence I-frame and
requests P to retransmit all outstanding unacknowledged I-
frames from the last correctly received: Go-back-N

Telecomm. Dept. DCN-2013


17
Faculty of EEE HCMUT
Continuous RQ
Selective Repeat: can be implemented in 2 ways:
S acknowledges correctly received frames and P
determines from the sequence of ACK-frames received
that a frame has been lost: implicit retransmission
Or S returns NAK for a frame that is missing from the
sequence: explicit request

Telecomm. Dept. DCN-2013


18
Faculty of EEE HCMUT
Continuous RQ
 Selective Repeat: implicit retransmission, I-frame is corrupted
 Assume I-frame N+1 is corrupted
 S returns a ACK for each correctly received I-frame as before
 S returns ACK-frame for I-frames N,N+2,N+3,…
 On receipt of ACK for I-frame N+2, P detects that frame N+1 has not
been acknowledged
 To allow for the possibility of more than one I-frame being corrupted,
on detecting an unacknowledged frame P enter the retransmission
state.
 When in this state, the transmission of the new frames is suspended
until all unacknowledged frames have been retransmitted
 P removes I-frame N+2 from the retransmission list and retransmits I-
frame N+1 before transmitting frame N+5
 On receipt of I-frame N+1, the contents of the queued frames in the link
receive list are delivered by S

Telecomm. Dept. DCN-2013


19
Faculty of EEE HCMUT
Continuous RQ
 Selective Repeat:
implicit
retransmission
 Corrupted I-frame

Telecomm. Dept. DCN-2013


20
Faculty of EEE HCMUT
Continuous RQ
Selective Repeat: implicit retransmission, ACK(N) is
corrupted
On receipt of ACK-frame N+1, P detects that I-frame N is
still awaiting acknowledged and hence retransmits it
On receipt of the retransmitted I-frame N, S determines
from its receive sequence variable that this has already
been received correctly and is therefore a duplicate
S discards the frame but returns an ACK for it to ensure P
removes the frame from the retransmission list.

Telecomm. Dept. DCN-2013


21
Faculty of EEE HCMUT
Continuous RQ
 Selective Repeat:
implicit retransmission
 Corrupted ACK-frame

Telecomm. Dept. DCN-2013


22
Faculty of EEE HCMUT
Continuous RQ
Selective Repeat: explicit retransmission
 Use an explicit NAK to request for a specific frame to be retransmitted.
The NAK-frame is also known as selective reject.
Principle:
 An ACK acknowledges all frames in the retransmission list up to and
including the I-frame with the sequence number the ACK contains
 Assume I-frame N+1 is corrupted
 S returns an ACK for I-frame N
 When S receives I-frame N+2 it detects I-frame N+1 is missing and hence
returns a NAK containing the identifier of the missing I-frame N+1
 On receipt of NAK N+1, P interprets this as S is still awaiting I-frame N+1
and hence retransmits it
 When S returns a NAK, it enters the retransmission state
 When in the retransmission state, the return of ACK-frames is suspended.

Telecomm. Dept. DCN-2013


23
Faculty of EEE HCMUT
Continuous RQ
 Principle:
 On receipt of I-frame N+1,
S leaves the retransmission
state and resumes
returning ACK-frames.
 ACK N+4 acknowledges all
frames up to including
frame N+4
 A timer is used with each
NAK to ensure that if it is
corrupted (and hence
frame N+1 is not received),
it is retransmitted
 Selective Repeat: explicit
request:
 Correct Operation

Telecomm. Dept. DCN-2013


24
Faculty of EEE HCMUT
Continuous RQ
 Effect of no
retransmission state:
 Assume I-frame N+1 is again
corrupted
 S returns NAK N+1 but this
time it is corrupted
 On receipt of ACK N+3, this
would acknowledges all
frames including I-frame
N+1 and hence this frame
will not be retransmitted
 I-frame N+1 would be lost
 Although S receives a
correct copy of each frame
sent by P, the order of
reception is not maintained
(S receives frames
N+2,N+3,N+4 and N+1)

Telecomm. Dept. DCN-2013


25
Faculty of EEE HCMUT
Continuous RQ
 Selective Repeat is used primarily when either the frames
being transmitted are self-contained entities (the order is not
important)
 In many application, frames must be delivered in order. Hence,
Selective Repeat requires large buffer for storing ordered
frames

Telecomm. Dept. DCN-2013


26
Faculty of EEE HCMUT
Continuous RQ
 Go-back-N: the secondary detects an out-of-order sequence frame, it informs
the primary to start to retransmit frames from a specified frame number. It
does this be returning a special NAK frame known as a reject.
 Principle:
 Assume I-frame N+1 is corrupted
 S receives I-frame N+2 out of sequence
 On receipt of I-frame N+2, S returns NAK N+1 informing P to go back and
start retransmit from I-frame N+1
 On receipt of NAK N+1, P enters the retransmission state
 When in this state, it suspends sending new frames and starts to retransmit
the frames waiting acknowledgement in the retransmission list
 S discards frames until it receives I-frame N+1
 On receipt of I-frame N+1, S resumes accepting frames and returning
acknowledgements
 A timeout is applied to NAK frames by S and a second NAK is returned if
the correct in-sequence I-frame is not received in the timeout interval

Telecomm. Dept. DCN-2013


27
Faculty of EEE HCMUT
Continuous RQ
 Go-back-N:
 I-frame
corrupted

Telecomm. Dept. DCN-2013


28
Faculty of EEE HCMUT
Continuous RQ
 Go-back-N:
 Corrupted ACK
 Principle:
S receives each transmitted I-
frame correctly
Assume ACK-frames N and N+1
are both corrupted
On receipt of ACK N+2, P detects
that there are 2 outstanding I-
frames in the retransmission list
(N and N+1)
Since it is an ACK rather than
NAK, P assumes that the 2 ACKs
for I-frames N and N+1 have both
been corrupted and hence
accepts ACK-frame N+2 also as
an acknowledgement for the
outstanding frames

Telecomm. Dept. DCN-2013


29
Faculty of EEE HCMUT
Continuous RQ
 Link Utilization:
 In general, the link utilization U for a send window K:
• If K  1+2a :
U=1
• If K  1+2a :
K.Tix K.Tix K
U= = =
Tt (Tix +2Tp ) (1+2a)

 Using Selective Repeat: impact by choosing K


• If K  1+2a :
U = 1-Pf
• If K  1+2a :
K.Tix K.Tix K.(1-Pf )
U= = =
Nr .Tt Nr .(Tix +2Tp ) (1+2a)
Telecomm. Dept. DCN-2013
30
Faculty of EEE HCMUT
Continuous RQ
 Link Utilization:
 Using Go-back-N: impact by choosing K
• If K  1+2a:
(1+2a).(1-Pf ) 1-Pf
U= =
(1+2a).(1+Pf (K-1)) 1+Pf (K-1)
• If K  1+2a:
K.(1-Pf ) K.(1-Pf )
U= =
(1+2a)+(1+2a).Pf .(K-1) (1+2a).(1+Pf (K-1))

Telecomm. Dept. DCN-2013


31
Faculty of EEE HCMUT
Example of sliding window
A series of 1000-bit frames is to be transmitted using
a continuous RQ protocol. Determine the link
efficiency for the following type of data link if the
velocity of propagation is 2.108 m/s and the bit error
rates of the links are all negligibly low:
A 1 km link of 1 Mbps and a send window K = 2
A 10 km link of 200 Mbps and a send window K=7
A 50 000 km satellite link of 2 Mbps and a send window K
=127
 Solution?

Telecomm. Dept. DCN-2013


32
Faculty of EEE HCMUT
Example of link utilization
A series of 1000-bit frames is to be transmitted
across a data link 100 km in length at 20 Mbps. If the
link has a velocity of propagation is 2.108 m/s and a
BER of 4.10-5, determine the link utilization using the
following protocols:
Idle RQ
Selective Repeat and a send window of 10
Go-back-N and a send window of 10
Solution?

Telecomm. Dept. DCN-2013


33
Faculty of EEE HCMUT
Timeout
 Timeout mechanism:
 A separate timer is started each time I-frame is transmitted by P,
and is stopped when an ACK indicating its correct receipt is
received
 If an ACK for an I-frame is not received before it timeout interval
expires, the frame is retransmitted
 The timeout interval must be greater than the worst-case
propagation delay between transmitting a frame and receiving
the associated ACK
 S may receive multiple copies due to corrupted ACK-frames
• With Go-back-N: this is not the problem. The N(S) in the duplicate
frames will not equal to the current V(R) held by S and will be
discarded
• With Selective Repeat: S retains a ordered list of the last N correctly
received I-frames. In this way, S can check if a received frame is a
duplicate of an already correctly received frame or a new frame.

Telecomm. Dept. DCN-2013


34
Faculty of EEE HCMUT
Timeout

Telecomm. Dept. DCN-2013


35
Faculty of EEE HCMUT
Flow control
 Control the data transmission rates of characters or
frames on a link so that the receiver always has
sufficient buffer storage resources to accept them prior
to processing
 Two kinds: X-ON/X-OFF and Sliding Window
 X-ON/X-OFF:
When the receive buffer at S is overflowed, S sends X-OFF
back to P, P stops the data transmission
When S escape the overload state, it will return X-ON to P
to inform its ready state for receiving data. P will continue
to transmit data to S
For example: in RS232, CTS/RST pins are used for flow
control

Telecomm. Dept. DCN-2013


36
Faculty of EEE HCMUT
Flow control
 Sliding window:
 Send window size
(K): define the
maximum number
of frames can be
transmitted
 Has UWE and LWE
to control the
window length
 Receive window: the
maximum number
of frame buffers
required at S

Telecomm. Dept. DCN-2013


37
Faculty of EEE HCMUT
Sequence Number
 All previous example: assuming that the next frame sequence
is simply equal to the last sequence + 1: sequence number go
to infinitive
 Need to define the maximum limit on the number of I-frames
being transferred across a link: limit the size of the link
retransmission and receive list, and limit the range of
sequence numbers to define frames uniquely
 Idle RQ: both send and receive window are 1. Hence 2 identifiers are
required to allow S to determine the last I-frame and the new I-frame.
 Go-back-N: send window is K: the identifier must be K+1.
 Selective Repeat: send and receive windows are K. Hence the
identifiers must not be less than 2K

Telecomm. Dept. DCN-2013


38
Faculty of EEE HCMUT
Sequence Number
 The send window is 3
 P sends full of window: 3
I-frames
 2 ACKs returned by S are
all corrupted
 P times-out each I-frame
and retransmits them
 S discards each duplicate
I-frame and returns a NAK
indicating I(3) is the next
frame
 Since the sequence
number in the NAK is
equal to V(S), P takes this
as an acknowledgement
for the 3 waiting frames,
therefore reopening the
windows

Telecomm. Dept. DCN-2013


39
Faculty of EEE HCMUT
Sequence Number
 In practice, since the
identifier of a frame is in
binary form, a set number of
binary digits must be
reserved for its use.
 For example, with a send
window of 7 and Go-back-N is
used, 2 binary digits are
required for the send and
receive sequence numbers
yielding 8 possible identifiers:
0..7. The send and receive
sequence variables are then
incremented modulo-8 by P
and S, respectively

Telecomm. Dept. DCN-2013


40
Faculty of EEE HCMUT
Sequence Number
lower
Window size = 7 window
edge upper
window
7 0 0 edge
7 7 0
6 1 6 1 6 1
5 2 5 2
tx 1 frame tx 1 frame 5 2
4 3 4 3 4 3

tx 1 frame

7 0 7 0
tx 1 frame 7 0
6 1 6 1 6 1
5 2 5 2
receive ACK0 5 2
4 3 4 3 4 3
max window size
max window size can’t transmit
can’t transmit

Telecomm. Dept. DCN-2013


41
Faculty of EEE HCMUT
Connection Management

Telecomm. Dept. DCN-2013


42
Faculty of EEE HCMUT
Data Link Control Protocols
 The data link control layer is concerned with the transfer of data
over a serial data link.
 The link can be:
 point-to-point physical circuit (twisted-pair wire, coaxial cable or optical
fiber),
 radio-based channel (satellite, or logical channels over physical circuits)
 Transmission mode can be asynchronous or synchronous
 Service offered by data link:
 Connectionless service
 Connection-oriented
 Data link Control Protocols provides:
 Flow control
 Error control

Telecomm. Dept. DCN-2013


43
Faculty of EEE HCMUT
Data Link Protocol Application
DTE DTE DTE: Data Terminal Equipment
DLP: Data Link Protocol
DCE: Data Circuit Terminating Equipment
DLP
: Communication Subsystem

DTE DCE DCE DTE


PSTN
Modem Modem

DLP

Telecomm. Dept. DCN-2013


44
Faculty of EEE HCMUT
Data Link Protocol Application
DTE Master

DLP

DTE DTE DTE DTE

DTE DTE DTE

Share bus
DLP

DTE DTE DTE DTE

Telecomm. Dept. DCN-2013


45
Faculty of EEE HCMUT
Protocol Classification
 Character-oriented Protocols:
 Asynchronous transmission
• XMODEM, YMODEM
• Simplex Protocol: Kermit protocol
 Synchronous transmission:
• Half-duplex protocol: BSC
• Full-duplex protocol: APRANET IMP-to-IMP protocol
 Bit-oriented Protocols
 High-level Data Link Control: single link procedure
 Link access procedure version B (LAPB): extension of LAPA, used in
X.25 networks
 Multilink procedure: extension of LAPB
 Link access procedure for modems (LAPM): used in error correction
modems (e.g. V32)
 Link access procedure for D-channel (LAPD): used in ISDN networks

Telecomm. Dept. DCN-2013


46
Faculty of EEE HCMUT
Binary Synchronous Communication
BSC Protocol:
Character-oriented
Error control: Idle RQ
Synchronous transmission control
Connection-oriented
Half-duplex
Topology: Poin-to-point, Multipoint, Multi-drop network
Data transparency: using DLE character to transmit pure
binary data (DLE/STX, DLE/ETX)
Frame formats
Data frame
Supervisory
Telecomm. Dept. DCN-2013
47
Faculty of EEE HCMUT
BSC Control Characters

Telecomm. Dept. DCN-2013


48
Faculty of EEE HCMUT
Binary Synchronous Communication
Data frame:
Simple frame
SYN SYN STX Data (128bytes) ETX BCC

Simple frame
with header SYN SYN SOH Header Data (128bytes) ETX BCC

Multi-block SYN SYN SOH Header STX Data IBT BCC STX Data ETX ETX
BCC
frame
Data block

Frame First frame


SYN SYN SOH Header STX Data ETB BCC
structure of
Multi-frame
Last frame
SYN SYN SOH Header STX Data ETX BCC

SOH – Start of Header STX – Start of Text ETX – End of Text


BCC – Block (sum) Check Character ETB – End of Tranmission Block

Telecomm. Dept. DCN-2013


49
Faculty of EEE HCMUT
Binary Synchronous Communication
 Supervisory frame: the
ACK and NAK control
characters have 2
functions:
 As an acknowledgement:
one or other is returned to
a previously transmitted
data block and hence
contains an sequence
number.
 AS a response to a select
control message: an ACK
indicates that the selected
station is able to receive a
data block whereas a NAK
indicates that it is not
Telecomm. Dept. DCN-2013
50
Faculty of EEE HCMUT
Binary Synchronous Communication
 Supervisory frame:
The ENQ control character is used in both Poll and Select
control frames. The address of the polled or selected slave
station is followed by either a P (for Poll) or an S( for Select)
character, which is in turn followed by the ENQ character
The EOT control character has 2 functions:
• To signal the end of a complete message exchange
sequence and clear the logical link between the 2
communicating parties
• To provides a means of resetting the link to the idle state

Telecomm. Dept. DCN-2013


51
Faculty of EEE HCMUT
Binary Synchronous Communication
 Protocol operation:
 Poll and Select schematic

 Select operation
 Master sends data to a specific slave
 Put the slave address in the Select control
frame
 If the Slave is unready: reply by NAK.
Otherwise, return ACK

Telecomm. Dept. DCN-2013


52
Faculty of EEE HCMUT
Binary Synchronous Communication
 Polling mechanism:

 Protocol performance:
 Low link utilization (Idle RQ),
used with multi-drop links,
operating at data rates up to
64 kbps
 Average time to poll each
station:
Tmin
Tavr =
1-Mr .Tix
 Tmin: the minimum time to poll
all stations, Mr is the average
rate at which messages are
generated
Telecomm. Dept. DCN-2013
53
Faculty of EEE HCMUT
Example
 A BSC protocol is to be used to control the flow of messages between a
computer (Master station) and 10 block-mode terminals (secondaries) over
a multipoint data link. The link data rate, R, is 10 kbps and the average
length of a message, Ni, is 1000 bits. If a poll message and its associated
ACK is 30 bits and the total time to process these messages is 1ms,
determine the average time each terminal will be polled if the average rate
at which messages are generated is:
 1 message per minute
 6 message per second
The bit error rate and signal propagation delay times of the link can be
assumed to be negligible
 Solution:
 Tix=100ms
 Time to transmit a poll and its ACK: 30/104=3 ms
 Time to poll a single secondary: 3 + 1 = 4 ms
 Minimum time to poll all secondaries: Tmin=10x4 = 40 ms
 Mr = 1 msg/minute = 10-3/60 msg/ms: Tavr=40 ms

Telecomm. Dept. DCN-2013


54
Faculty of EEE HCMUT
HDLC
 High-level Data Link Control (HDLC) is a
bit-oriented protocol for communication
over point-to-point and multipoint links.
 Support full-duplex, transparent mode
operation
 Variations: LAPB, LAPD,LAPM
 Used in Frame Relay, PPP
 Primary station
 Control the operation of the data link
 Send the command frames
 Secondary station
 Controlled by Primary station
 Send the response frames
 Combined station (Both Primary and
Secondary)
 Can send commands or responses

Telecomm. Dept. DCN-2013


55
Faculty of EEE HCMUT
HDLC
 Operational modes:
 Normal Response Mode (NRM)
• Used in unbalanced configuration
• Slave stations (secondaries) can transmit only when specially instructed
by the master (primary) station.
• The link may be point-to-point, multipoint (only 1 primary allowed)
 Asynchronous Response Mode (ARM)
• Used in unbalanced configuration
• Allow a secondary to initiate a transmission without receiving
permission from the primary
• Normally used in point-to-point configuration and duplex links
 Asynchronous Balanced Mode (ABM)
• Mainly used on duplex point-to-point links
• Each station has an equal status and performs both primary and
secondary functions

Telecomm. Dept. DCN-2013


56
Faculty of EEE HCMUT
HDLC
 Frame formats: both data and control messages are carried in a standard format
frame.

 Flag Field (0x7E):


 determine the beginning and the end of a frame
 Receiver must hunt this value for synchronization
 Bit stuffing if there is a 5 continuous bits “1”
 If receiver detects 5 continuous bits “1”:
• If the next bit is bit 0, it will be removed
• If the next bit is bit 1, and 7th bit is bit 0: Flag
• If the next bit is bit 1, and 7th bit is bit 1: continue to count number of bits 1
– If number of bits 1<15: receiver stops
– If number of bits 1>=15: idle channel

Telecomm. Dept. DCN-2013


57
Faculty of EEE HCMUT
HDLC
Address Field:
Depending on operational mode. In NRM mode, multidrop
line: each station has 1 unique address. If the primary
wants to connect with the slave, it will put the slave
address in this address field. Certain addresses known as
group address can be assigned to more than one
secondary. If the address is all bits 1: broadcast address.
Not used in ABM mode (point-to-point). Instead, it is used
to indicate the direction of commands and their associated
responses
8 bit in length, can be expanded with multiple of 7 bits.
Last octet will have the first bit equal to 1

Telecomm. Dept. DCN-2013


58
Faculty of EEE HCMUT
HDLC
Control field: There are 3 frame types in HDLC:
 Unnumbered frames (U—frame): used for such functions as link setup
and disconnection. They do not contain any acknowledgement
information
 Information frame (I-frame): carry the actual information. I-frames can
be used to piggyback acknowledgement information if the operational
mode is ABM or ARM
 Supervisory frame (S-frame): are used for error and flow control and
hence contain send and receive sequence numbers

Telecomm. Dept. DCN-2013


59
Faculty of EEE HCMUT
HDLC
Control field:
1 byte or 2 bytes in length
1 or 2 first bits define the frame type (S,I,U)
N(S): send sequence number
N(R): receive sequence number
P/F: Poll or Select depending on the context:
• Command: bit P, request the response from a secondary
• Response: bit F, indicating this is the response to a command

00
10
01
11

Telecomm. Dept. DCN-2013


60
Faculty of EEE HCMUT
HDLC

Telecomm. Dept. DCN-2013


61
Faculty of EEE HCMUT
HDLC
Extended control bit field definitions

Telecomm. Dept. DCN-2013


62
Faculty of EEE HCMUT
HDLC
Information field:
Contained in I-frame and U-frame
Variable length
Multiple of bytes
FCS field:
Error detection
CRC 16 or CRC32

Telecomm. Dept. DCN-2013


63
Faculty of EEE HCMUT
HDLC
Link Management
Setup connection
Disconnection

Telecomm. Dept. DCN-2013


64
Faculty of EEE HCMUT
HDLC
 Data transfer:
 V(S) indicates the next
send sequence
number N(S), which is
allocated to an I-frame
transmitted by that
station
 V(R) is the send
sequence number of
the next in-sequence
I-frame expected by
that station
 At receiver, if N(S)=
V(R): receive correct
sequenced frame
 Bit P means: this
frame needs an
response from the
receiver (by bit F)
Telecomm. Dept. DCN-2013
65
Faculty of EEE HCMUT
HDLC
 Data transfer:
 Negative
Acknowledgement
 Go-back-N
 Using REJ/RR

Telecomm. Dept. DCN-2013


66
Faculty of EEE HCMUT
HDLC
 Piggyback without errors:
 Example: an exchange using piggybacking. Node A
begins the exchange of information with an
I-frame 0 followed by another I-frame 1.
 Node B piggybacks its acknowledgment of both
frames onto an I-frame of its own. Node B’s first I-
frame is also numbered 0 [N(S) field] and contains a
2 in its N(R) field, acknowledging the receipt of A’s
frames 1 and 0 and indicating that it expects frame 2
to arrive next. Node B transmits its second and third
I-frames (numbered 1 and 2) before accepting
further frames from node A. Its N(R) information,
therefore, has not changed: B frames 1 and 2
indicate that node B is still expecting A’s frame 2 to
arrive next. Node A has sent all its data. Therefore, it
cannot piggyback an acknowledgment onto an I-
frame and sends an S-frame instead. The RR code
indicates that A is still ready to receive. The number
3 in the N(R) field tells B that frames 0, 1, and 2 have
all been accepted and that A is now expecting frame
number 3.

Telecomm. Dept. DCN-2013


67
Faculty of EEE HCMUT
HDLC
 Piggyback with errors:
 Example: an exchange in which a frame is
lost. Node B sends three data frames (0, 1,
and 2), but frame 1 is lost.
 When node A receives frame 2, it discards it
and sends a REJ frame for frame 1. Note that
the protocol being used is Go-Back-N with
the special use of an REJ frame as a NAK
frame. The NAK frame does two things here:
It confirms the receipt of frame 0 and
declares that frame 1 and any following
frames must be resent.
 Node B, after receiving the REJ frame,
resends frames 1 and 2. Node A
acknowledges the receipt by sending an RR
frame (ACK) with acknowledgment number
3.

Telecomm. Dept. DCN-2013


68
Faculty of EEE HCMUT
HDLC
 Some other cases:

Telecomm. Dept. DCN-2013


69
Faculty of EEE HCMUT

You might also like