Physical Layer: Formatting and Encoding
The motivation of the physical layer is as follows: We have a transmitter and a receiver, could be wired, could be wireless, etc. We have different wireless, fiber optic, cable, etc. We want to send digital data to receiver and we want receiver to recover it. There are many steps involved in physical layer of networking.
Once formatting is done, we have message symbols, then we can apply channel encoding, where we take the message signals and apply something to it, vary bits (error detection, encryption, synchronization, etc.). After manipulating messages, we end up with the changed symbols, the channel symbols. We convert each one of them to some signal in some shape or form. this is the modulation step. The receiver will reverse the process, to get the channel signals via demodulation, decoding the channel signals, reversing the formatting stage, and pass to layer 2 as a frame of bits. Signals are handled in layer 1. After modulation, we will take the channel symbol and convert it into a sink.
Let's talk about formatting. It's about taking the stream of bits and splitting it into symbols. What is the number of symbols that should be used? If I used V = 2 then I deal with 1 bit of a time since I'm dealing with 1 bit. If V = 4 mi is 2 bits eg 01 00 10 11 01 10 01 00 11 10... etc. I can vary the intensity of the voltages to be able to represent it. For example 0 volt is 00, 1 volt is 11 0.33 V is 01, etc.
We group bits to send more information in the allotted frequency band. In order to use V >= 2 , a receiver must be sufficiently sensitive to detect significant power levels. The time to send one bit is 1/b seconds with b bits per second. Period to send 1 8-bit signal is T = 8/b seconds. Frequency of 1st harmonic is f = b/8 hz, 2nd harmonic is 2b/8 Hz, so on and so forth. What is the Bandwidth needed to transmit the signal for the 8 bit signal using 10 harmonics? The bandwidth is # harmonics used * 1st harmonic frequency = 10*f = 10 * (b/8) = 1.25b Hz. The larger B in bits per second, the larger bandwidth I need to capture this harmonic.
I need larger bandwidth to recover n harmonics when V increases. When V is 2, you need more bandwidth in order for reciever to recieve the harmonics. Grouping bits as symbols would reduce the bandwidth used for transmission but require more sophisticated hardware to differentiate between the different signals. Engineer finds out the signal/noise ratio, how much bandwidth is needed, etc.
Bit rate is bits per second and symbol rate (baud rate) is symbols per second. Bit rate is Symbol Rate * bits per symbol which is baud rate * log2(V). V indicates where the harmonics are forming in the electromagnetic spectrum. We have one unit, only bits 0 and 1. For now the block of 0's and 1's is called a frame, and the block has a layer 2 header. Layer 2 inserts these bits/check them out later on. We need to split the block into symbols. Having more bits in signals, we will increase the maximum bit rate. If I have 8 symbols the "Format" in the first pic will split the bits in the frame into 3 bits.
Now what does channel encoding do? It takes the message signals which are the output of the formatting stage and manipulates them. The output is still going to be symbols, but maybe symbols of different sizes or values. In channel encoding, we take input buts, and we produce output bits. Baud rate is symbols per second, bit rate is symbols per second. When a channel incurs no noise, Nyquist's equation says Max Data Rate = 2Blog2V bits/second. When a channel incurs noise, Shannon's equation says Max Data Rate = B log2(1 + S/N) bits per second. The signal to noise ratio is going to relate to V in some shape or form. If I have a very high Signal to Noise Ratio I might come up with 1 + S/N value higher than V (Nyquist's value) which doesn't make sense since Nyquist's maximum data rate should be higher. Typically, Nyquist's bound is higher than Shannon's bound.
In the encoding stage, the message signals are transformed into channel symbols by changing the message bits/adding extra bits. It might be because error correction, since the channel isn't perfect. It can also for error detection. It can also be encryption, manipulating the bits making them look random stream of bits, so anyone snooping won't be able to recover the original bits. HTTPS URL means the HTTP protocol is running on top of TLS (Security protocol) running on top of TCP (Layer 4). With Encryption, we agree on a shared secret, change the form of the text and reverse the process and recover the original text. The 3rd reason is synchronization, with is essential.
Synchronization is when the clock ticks, and the sender sends signal during modulation phase, and by the time I get to the next clock tick, I send another signal. The receiver on the other end is also sampling the channel. The clock ticks of the sender might not be synchronized with the clock ticks of the receiver. All I want to say is that there are clock ticks that help the sender and receiver to recover the shape of the signal transmitted at the sender. Why do we send at same clock time as receiver? This is so that the receiver will get as many bits as the sender, so we want to encode to synchronize better.
There are a few encoding schemes to help with synchronization. NRZ (non-return to zero) does nothing. In this NRZ case, the positive voltage represent binary 1, and a negative voltage will represent binary 0. The channel signals are going to be exactly like the message signals. The NRZ signal propagates through the channel where it is distorted and attenuated, and the other end receiver converts it to bits by sampling the signal at regular intervals and we will map to closest symbol. If I get 15 0's we will get 15, no more or no less. The problem usually shows up more if I have longer sequences like 1, 1, 1, 1, 1, 1 if clocks are not synchronized we might mistake for extra or missing "1" value.
How do we sort that if NRZ is not sorted? You can decide to go for a hardware solution, somehow synchronize the drops between the sender and the receiver. These are typically expensive solutions and require expensive hardware. How accurate was the time that operation captures? We can synchronize the clocks at sender and receiver. This is expensive though (solve overhead problem). We can send a separate clock signal to the receiver or use complex encoding technique that do not need very accurate clocks. Line codes are complex encoding techniques that do not need very accurate clocks.
NRZ inverted tries to include binary 1's as 01 or 10. The binary 1 is mapped to 2 bits. Here 1s are coded as a transition and 0s as no transition. The 0s are going to be translated as no transition. It encodes binary 1's as either 01 or 10. Here's a diagram.
You can see the NRZ is the second signal, where 0 has no transition and the binary 1 shows the transition. This is used by the USB standard. The stream of 0's should be fine, but the stream of 1's might have a problem with transitioning. It should be fine, as long as the sampling is done as the Nyquist suggests. The pros is long runs of 1's shouldn't cause too much of a problem, but long runs of 0's will.
Let's talk about Manchester encoding now, where each bit is mapped to 2 bits. The 1 is transition from 1 to 0 and 0s are going to be transition for 0 to 1. The Manchester encoding is the third digital bar from the top. The overhead is that Manchester encoding requires extra bits, or double the bandwidth.
Let's now go to 4B/5B encoding, which takes every 4 bits and match them into 5 bits. We just add an extra bit. For example, if I have 4 0's back to back, it will be encoded as 4 1's followed by 0. Here's a diagram.
The pros is that this seems to have the problem (but with 25% more overhead). There is also a variant of this 4B/5B encoding, and it's called the 8B/10B encoding, which map 8 bits into 10 bits of output. The 8 bits are split into a group of 5 buts, mapped to 6 bits, and a group of 3 bits, which is mapped to 4 bits, which adds up to 10 bits. However, balancing the signal leads to much better synchronization.
Now let's go over scramblers. We make the data look random by XOR'ing the data with a pseudo random sequence before it is transmitted. In this case it if very likely there will be frequent transitions. In this case there will be frequent transitions, which causes much better synchronization. We get the same number of bits out of the encoding stage as the overhead. The long sequence that you generated is matching the length of the bits of the original frame. Then doing the XOR. Synchronization with the receiver of high probability is the pro. The con is that this scrambling will not guarantee there will be long runs. If the data is the same for the pseudorandom sequence, then we have a problem.
Bipolar encoding encodes binary 1 to +1 and -1, so we use 2 voltage levels to represent a logical 1 with 0 volt represents logical 0. The transmitter alternates between 1V and -1V on a logical 1 so they average out in order to achieve balance.






Comments
Post a Comment