Jump to content

Bit stuffing

From Wikipedia, the free encyclopedia

Indata transmissionandtelecommunications,bit stuffing(also known—uncommonly—aspositive justification) is the insertion of non-informationbitsintodata.Stuffed bits should not be confused withoverhead bits.

Bit stuffing is used for various purposes, such as for bringingbit streamsthat do not necessarily have the same or rationally relatedbit ratesup to a common rate, or to fillbuffersorframes.The location of the stuffing bits is communicated to the receiving end of thedata link,where these extra bits are removed to return the bit streams to their original bit rates or form. Bit stuffing may be used to synchronize several channels beforemultiplexingor to rate-match two single channels to each other.

Another use of bit stuffing is forrun length limitedcoding: to limit the number of consecutive bits of the same value in the data to be transmitted. A bit of the opposite value is inserted after the maximum allowed number of consecutive bits. Since this is a general rule the receiver doesn't need extra information about the location of the stuffing bits in order to do the de-stuffing. This is done to create additional signal transitions to ensure reliable reception or to escape special reserved code words such as framesync sequenceswhen the data happens to contain them.

Bit stuffing in CAN after five equal bits.

Bit stuffing does not ensure that the payload is intact (i.e.not corrupted by transmission errors); it is merely a way of attempting to ensure that the transmission starts and ends at the correct places.Error detection and correctiontechniques are used to check the frame for corruption after its delivery and, if necessary, the frame will be re-sent.

Zero-bit insertion

[edit]

TheNRZIcoding scheme transmits a 0 bit as a signal transition, and a 1 bit as no change. In this case, bit stuffing is most easily described as the insertion of a 0 bit after a long run of 1 bits.

It was popularized by IBM'sSDLC(later renamedHDLC), and is also used in Low- and full-speedUSB.

After a long sequence of 1 bits there would be no transitions in the transmitted data, and it would be possible for the transmitter and receiver clocks to lose synchronisation. By inserting a 0 after five (SDLC) or six (USB) consecutive 1 bits the transmitter guarantees a maximum of six (SDLC) or seven (USB) bit times between transitions. The receiver can synchronise its clock against the transitions to ensure proper data recovery.

In SDLC the transmitted bit sequence "01111110" containing six adjacent 1 bits is theFlag byte.Bit stuffing ensures that this pattern can never occur in normal data, so it can be used as a marker for the beginning and end of the frame without any possibility of being confused with normal data.[1]

The main disadvantage of bit-stuffing is that thecode rateis unpredictable; it depends on the data being transmitted.

Source: fromFederal Standard 1037Cin support ofMIL-STD-188

See also

[edit]

Notes

[edit]
  1. ^Kevin R. Fall and W. Richard Stevens,TCP/IP Illustrated Volume 1: The Protocols,Second Edition, Addison-Wesley, 2012, Kindle Edition loc 3505