Carriers, Modulation, Modems, Packets, Frames, Error Detection
- Carrier Signal
- Modulation:
- Amplitude
- Frequency
- Phase
- Modems
- Multiplexing:
- Frequency Division
- Time Division
- Spread Spectrum
- TDM for packets
- Packet Framing
- SLIP and Byte Stuffing
- Error Detection:
Carriers
- each medium has specific frequencies that it carries best
- e.g. fiber carries optical-frequency signals, radio carries
radio-frequency signals
- very few media carry DC signals (very low frequencies) well
- we can use a higher-frequency signal and vary it over time
to carry a lower-frequency signal
- example: turn light on and off to carry bits (amplitude modulation)
Amplitude Modulation
- AM radios
- the frequency of the carrier is constant
- the power of the carrier is modified ( modulated) according to
the power of the signal we want to carry
- a 1-bit might be a full-power signal, a 0-bit a half-power signal,
no bit could be no signal
Frequency Modulation
- FM radios, TV
- the power of the carrier is constant
- the frequency of the carrier is modulated according to
the power of the signal we want to carry
- Frequency-Shift Key (FSK) wireless transmission: frequency
f1 is one bit, frequency f2 is the other bit
Phase Shift Modulation
- the power and the frequency of the carrier are constant
- the phase of the carrier is modulated by the signal
- e.g. if we can send 8 different phases, we select the phase
based on the next 3 bits, and send (one cycle) using that phase
- in this case, the bit rate would be 3 times more than the
baud rate (the rate at which signals change)
- a modulator encodes the signal on the wire, a demodulator
must look at the signal and attempt to decode it
Modems and Serial Lines
- a Modulator/Demodulator pair is called a Modem
- modems often use Phase-Shift modulation, encoding several bits per baud
- a modem pair needs four wires for communication: two for signal/return
from modem A to modem B, and two for signal/return from B to A (the two return
wires could be combined, but at the cost of additional noise)
- such a set of two twisted pairs is a serial line (a term also
applied to RS-232)
- serial lines are point-to-point: they can only connect two modems at
any given time
Other Modems
- wireless modems:
- antennas instead of wires
- very careful to only broadcast in the assigned frequencies (or the
FCC will complain very quickly!)
- dialup modems:
- able to sense dial tone, ringing voltage
- one side must dial the number ("pushbutton" tones, "dial" clicking)
- the other side must answer
- two-way communication requires handoff or different carriers
Multiplexing
- different carriers can be used simultaneously without interference --
like tuning to stations on the radio (all radio stations are transmitting
at the same time)
- broadband transmission allows different bands to be used at the
same time to carry different signals
- for example, can use different frequencies or colors of light on the
same optic fiber, then must split them apart at the receiver, perhaps
using a prism
- this is Frequency Division Multiplexing, FDM
- in Time Division Multiplexing, TDM, we first send a bit (or frame)
from one source, then the next, in round-robin fashion.
Spread Spectrum Technology
- anything that uses more than one channel is "spread spectrum"
- generally, we use more bandwidth to gain better S/N ratio
- Direct Sequence Spread Spectrum: a specific combination of channel
on/offs (" chips") represents a given bit
- Frequency Hopping Spread Spectrum: after sending a bit (frame) in
one channel, we send one on another, and so on
- to avoid mutual interference, both the chips and the frequency
hopping sequence are varied pseudorandomly
TDM for Packets
- assume a slow link is shared among several pairs of computers
- if one computer (pair) is transferring a large file over the link,
the transfer will take a long time
- how could the others use the link at the same time?
- use time-domain multiplexing: break each transfer into packets
with a given maximum size (e.g. 1024 bytes), and transfer packets
from each sender in turn
- the big sender sees less effective bandwidth,
- but the latency for the others is much better
Packet Framing
- assume we have a way of sending and receiving bits and bytes
- how would we send a packet?
- in other words, at the receiver, given a real-time sequence of
bytes, how do we know (in real-time) where a packet starts and ends?
- answer: use a special character (e.g. 255) to mark the start of
the packet, another (e.g. 254) to mark the end
SLIP
- Serial Line IP protocol: carries IP packets on serial lines
- two special characters: END and ESCape
- END marks the end of a packet (and the start of the next)
- data may contain the special characters:
- if the data byte is END, we send ESC END
- if the data byte is ESC, we send ESC ESC
- predefined maximum user data size, 1024 bytes
- RFC 1055, http://www.ietf.org/rfc/rfc1055.txt
Bit Stuffing, Byte Stuffing
- SLIP is an example of byte stuffing:
- reserve one or more characters for marking beginning and end
- if the character occurs in the data, escape it
- some protocols use bit stuffing as well. For example, some
protocols use 5 ones in a row to mark a special case
- If the data contains 4 ones in a row, a zero is always inserted
after those 4 bits
- the receiver always removes a zero following 4 ones
- the receiver can tell the special case when it receives 5 ones in a row
Classes of Errors
- bit errors: errors that have an equal likelihood of being
equally distributed among all the bits in a message
- burst errors: errors that are more likely to corrupt bits
near other errors
- if I have a bit error rate b, and there are P bits
in a packet, my packet error rate (likelihood of at least
one error in a packet) is about 1 - (1 - b)P
- Error pattern: if I send 0101010101 and receive
0101100101, if I XOR the two I get the
error pattern, 0000110000
- compute the packet error rate when the bit error rate is 10-9 and
each packet carries 125 bytes (no calculators)
Parity
- one way to detect all single-bit errors is to compute the XOR of
all the bits in the message, and send that bit: this is the {\em even
parity} bit
- a single bit error will change the message so the parity no longer
matches
- the (boolean) inverse of even parity is odd parity
- RS-232 allows the configuration of even, odd, or no parity bit
- when parity is configured, an additional parity bit is sent with
each character
- but double-bit errors (and any error with an even numbers
of bits) will not be detected
Checksums
- if we add all the bytes in the message
- and send the sum,
- the receiver can repeat the operation and detect most errors
- unless one error adds, and one subtracts the same amount
- Internet checksum:
- add all 16-bit words in the message,
- add any 16-bit carry back in
- invert before sending
- receiver should compute 0xFFFF or 0x0
CRC
- Cyclic Redundancy Check (Peterson, 1962)
- used for networks, storage media
- a class of error control codes
- mathematically designed to detect all single-bit errors,
all double-bit errors, and most multi-bit and burst errors
- defined by a polynomial with binary (0 or 1) coefficients
- example:
x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 (Ethernet, ATM)
- example: x8 + x2 + x + 1 (ATM)
CRC Implementation
- the highest exponent of the polynomial is the number of bits
in the CRC
- the message is (logically) processed one bit at a time
- logically, there is a shift register with a bit for every exponent
of the polynomial
- where the polynomial has a non-zero coefficient, we XOR the MSB of
the shift register with the output of the corresponding bit of the
shift register before shifting into the next position
- the final value in the register is the CRC: it is inverted and sent
- the receiver performs the same calculation and gets zero if there
was no error