In
data transmission
Data transmission and data reception or, more broadly, data communication or digital communications is the transfer and reception of data in the form of a digital bitstream or a digitized analog signal transmitted over a point-to-point o ...
and
telecommunication
Telecommunication is the transmission of information by various types of technologies over wire, radio, optical, or other electromagnetic systems. It has its origin in the desire of humans for communication over a distance greater than that fe ...
, bit stuffing (also known—uncommonly—as positive justification) is the insertion of non-information
bits into
data
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted ...
. Stuffed bits should not be confused with
overhead bit
In data transmission and telecommunication, overhead bits are non-data bits necessary for transmission (usually as part of headers, checksums, and such). For example, on the Internet many data exchanges occur via HTTP. HTTP headers allow addition ...
s.
Bit stuffing is used for various purposes, such as for bringing
bit stream
A bitstream (or bit stream), also known as binary sequence, is a sequence of bits.
A bytestream is a sequence of bytes. Typically, each byte is an 8-bit quantity, and so the term octet stream is sometimes used interchangeably. An octet may ...
s that do not necessarily have the same or rationally related
bit rate
In telecommunications and computing, bit rate (bitrate or as a variable ''R'') is the number of bits that are conveyed or processed per unit of time.
The bit rate is expressed in the unit bit per second (symbol: bit/s), often in conjunction w ...
s up to a common rate, or to fill
buffers or
frames. The location of the stuffing bits is communicated to the receiving end of the
data link
A data link is the means of connecting one location to another for the purpose of transmitting and receiving digital information (data communication). It can also refer to a set of electronics assemblies, consisting of a transmitter and a recei ...
, 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 before
multiplexing
In telecommunications and computer networking, multiplexing (sometimes contracted to muxing) is a method by which multiple analog or digital signals are combined into one signal over a shared medium. The aim is to share a scarce resource - a ...
or to rate-match two single channels to each other.
Another use of bit stuffing is for
run length limited
Run-length limited or RLL coding is a line coding technique that is used to send arbitrary data over a communications channel with bandwidth limits. RLL codes are defined by four main parameters: ''m'', ''n'', ''d'', ''k''. The first two, ''m''/ ...
coding: 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 frame
sync sequence
In computer networks, a syncword, sync character, sync sequence or preamble is used to synchronize a data transmission by indicating the end of header information and the start of data. The syncword is a known sequence of data used to identif ...
s when the data happens to contain them.
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 correction
In information theory and coding theory with applications in computer science and telecommunication, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
techniques are used to check the frame for corruption after its delivery and, if necessary, the frame will be re-sent.
Zero-bit insertion
The
NRZI coding 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's
SDLC (later renamed
HDLC
High-Level Data Link Control (HDLC) is a bit-oriented code-transparent synchronous data link layer protocol developed by the International Organization for Standardization (ISO). The standard for HDLC is ISO/IEC 13239:2002.
HDLC provides both c ...
), and is also used in Low- and full-speed
USB
Universal Serial Bus (USB) is an industry standard that establishes specifications for cables, connectors and protocols for connection, communication and power supply (interfacing) between computers, peripherals and other computers. A broad v ...
.
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 the
Flag 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.
[Kevin R. Fall and W. Richard Stevens, ''TCP/IP Illustrated Volume 1: The Protocols'', Second Edition, Addison-Wesley, 2012, Kindle Edition loc 3505]
The main disadvantage of bit-stuffing is that the
code rate
In telecommunication and information theory, the code rate (or information rateHuffman, W. Cary, and Pless, Vera, ''Fundamentals of Error-Correcting Codes'', Cambridge, 2003.) of a forward error correction code is the proportion of the data-strea ...
is unpredictable; it depends on the data being transmitted.
''Source: from
Federal Standard 1037C
Federal Standard 1037C, titled Telecommunications: Glossary of Telecommunication Terms, is a United States Federal Standard issued by the General Services Administration pursuant to the Federal Property and Administrative Services Act of 1949, a ...
in support of
MIL-STD-188
MIL-STD-188 is a series of U.S. military standards relating to telecommunications.
Purpose
Faced with "past technical deficiencies in telecommunications systems and equipment and software…that were traced to basic inadequacies in the applicat ...
''
See also
*
Consistent Overhead Byte Stuffing Consistent Overhead Byte Stuffing (COBS) is an algorithm for encoding data bytes that results in efficient, reliable, unambiguous packet framing regardless of packet content, thus making it easy for receiving applications to recover from malformed ...
Notes
{{reflist
Line codes
Synchronization