Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

What is Frame Check Sequence?

  • Last Updated : 24 Nov, 2021

Frame Check Sequence (FCS) refers to extra bits added to the frame for error detection. It is used for HDLC error detection. It is 2 byte or 4-byte field that is used to detect errors in the address field, control field, and information field of frames transmitted across the network. It is used to ensure the data frame is not corrupted by the transmission medium while sending it from sender to receiver.

HDLC Frame  Format

HDLC Frame  Format

Features:

  • It is an error detection code present in HDLC frames.
  • Its size varies from 2 bytes to 4 bytes.
  • It is used in the communication protocol.
  • It is only responsible for error detection and not error recovery.
  • The type of FCS technique to be used depends on the protocol followed by the network.

Purpose:

Data frames often get corrupted while transmission through a communication medium. FCS bits are added to the frame prior to its transmission across the network. FCS code is again calculated at the destination site and compared with FCS bits of the frame, if FCS matches then the transmission is considered successful else frames are discarded. Hence, it is used for error detection.

FCS is only used for error detection and does not specify any detail about error recovery. Error recovery technique is entirely based on the transmission protocol. Following are the examples to demonstrate how different protocols respond to errors detected using FCS:

  1. Ethernet, data link layer protocol specifies that data frame should be discarded in case of error detection and does not take any action for error recovery. If the sender sends some message to the destination using ethernet protocol, the message is divided into data frames with FCS bits attached to each frame then these frames are transmitted over the medium. If any of the frames get corrupted while transmission then its FCS bits will be changed. At the destination, FCS is calculated and compared with FCS bits of each frame, and FCS of the corrupted frame will not match the calculated FCS and hence the frame will be discarded. Since ethernet does not specify any action to take like retransmission of corrupted frame in case of error detection hence data will be lost.
     
  2. TCP, transport layer protocol specifies that data frames should be discarded in case of error detection and retransmit corrupted frames and initiate error recovery.  If the sender sends some message to the destination using TCP protocol, the message is divided into data frames with FCS bits attached to each frame then these frames are transmitted over the medium. If any of the frames get corrupted while transmission then its FCS bits will be changed. At destination FCS is calculated and compared with FCS bits of each frame and FCS of the corrupted frame will not match the calculated FCS and hence the frame will be discarded. TCP then initiates error recovery and retransmits the corrupted frames hence data will not be lost in this case.

Implementation:

The receiver computes the running sum of the entire frame with trailing FCS, then the result is compared with FCS bits of the frame, and if the result match then the transmission is considered successful else frame is discarded. Generally, MSB (most significant bit) of FCS is transmitted first but alternatively, FCS can be reversed to send LSB (least significant bit first). 

Different techniques are used to calculate FCS codes for error detection. Following are some of the techniques that are used to detect errors in transmitted frames:

  1. Simple Parity Check: A parity bit is added to the frame for error detection. It is of two types- odd parity checking and even parity checking. In odd parity checking, the parity bit is set to 0 if data contains an odd number of 1s and set to 1 if data contains an even number of 1s. While in even parity checking, the parity bit is set to 1 if data contains an odd number of 1s and set to 0 if data contains an even number of 1s. Here, parity bits form the part of the frame as FCS code.
  2. Two-dimensional Parity Check: Parity bits are calculated for each row and each column and appended to the data frame. Calculation of parity bits for individual rows or columns is similar to a simple parity check. In this technique, the combination of the parity bits of all rows and columns forms the FCS code.
  3. Checksum: Data is divided into multiple segments and all the segments are added using 1s complement arithmetic and obtained sum is complemented to get the checksum. The checksum is sent along with other segments to the destination and at the receiver end sum of all the segments is calculated using 1’s complement and then obtained sum is complemented. If the final result is zero then the transmission is considered successful else the frame is discarded. Sometimes, the checksum is considered as FCS code for the CRC error detection algorithm.
  4. Cyclic Redundancy Check (CRC): A sequence of redundant bits is added to the end of the data unit so that the resulting data is exactly divisible by a predetermined binary number. These bits are called cyclic redundancy check bits. At the receiver end, data is divided by that predetermined number and if the remainder comes out to be 0 then the frame is accepted else it is discarded. In this algorithm, cyclic redundancy bits are considered as FCS bits.

Working:

Data often gets corrupted while transmission hence frame check sequence is appended to the end of the frame while transmission. FCS is calculated by using any error detection techniques such as parity checking, checksum, etc. At the destination, FCS is again calculated by following the same technique that was used to generate FCS at the sender’s site. Then the result is compared with FCS bits present in the data frame and if both of them are the same then the frame is accepted and transmission is considered successful else the frame is discarded assuming some error has occurred while transmission.

For example, suppose there are two devices within a network say A and B, and follows TCP protocol. A wants to send some data to B in such a way that corrupted frames are not accepted by B and communication is error-free. So, A divides the data of each frame in some segments of size m and calculates the checksum by summing up all the segments using 1’s complement and appending it to the end of each frame, and then transmits the frame. Now, B will calculate the running sum of the frame along with FCS bits using 1’s complement and if the sum comes out to be zero then the frame will be accepted by B else it will be discarded. Since the network is following TCP protocol A can retransmit the corrupted frames in case of failure detection. This way communication will be more efficient as no error will lead to inconsistency in communication.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!