Catto / Topic Map · Telecommunications II Year 7
Telecommunications II · 120 h · Topic 3 of 6

Data communications

For any two devices to exchange information you need much more than a cable: you need rules. Protocols organize those rules in layers, and that organization is what allowed networks of completely different technologies to connect with one another.

Layers Packets CRC TCP/IP

01The layer model

ApplicationTransportNetworkData linkapplication dataTCPapplication dataTCPIPapplication dataTCPIPEthernetapplication dataApplication layerthe data the user wants to sendTransport layeradds source and destination ports, numbering and flow controlNetwork layeradds the source and destination IP addresses, so it can be routedData link layeradds physical addresses and the frame error checkdownupEach layer adds its header on the way down and removes it on the way up, treating what it gets from above asdata it does not need to interpret. That is what lets you change one layer without touching the others.
Figure 1. Encapsulation, animated. Each layer adds its header on the way down and removes it on the way up. None of them needs to know how the one below works: only what it asks of it and what it returns.
OSI layerWhat it deals withExample
7 ApplicationThe service the user sees.HTTP, SMTP, Modbus, MQTT
6 PresentationFormat, encoding and encryption.TLS, JSON, compression
5 SessionEstablishing and maintaining the dialogue.session opening and closing
4 TransportEnd-to-end delivery, ordering and flow control.TCP, UDP
3 NetworkLogical addressing and routing.IP
2 Data linkFrames, physical addresses and error detection.Ethernet, HDLC, CAN
1 PhysicalLevels, connectors, line coding, medium.RS-485, fiber, radio
What the layers are for, concretely

So that you can change one without touching the others. The same web page travels the same way over fiber, WiFi or satellite: only the physical layer changes. And the same Ethernet cable carries HTTP, e-mail or Modbus without knowing what it is carrying inside.

In practice the four-layer TCP/IP model is used, which groups the top three into one. The seven-layer model is useful for reasoning and for locating where a problem is, which is exactly what you need when troubleshooting.

02Circuits or packets

Circuit switching

A complete path is reserved for the whole duration of the communication, as in classic telephony. The delay is fixed and the bandwidth is guaranteed.

In exchange, the resource stays occupied even if nobody is speaking, and setting up the connection takes time. For bursty data it is an enormous waste.

Packet switching

The information is split into packets that travel independently and share the links with everyone else's. It is what the internet does.

It makes far better use of resources and tolerates the loss of a link, because the packets take another path. In exchange, the delay is variable and there is no automatic bandwidth guarantee.

Why voice over IP was difficult

Because voice needs a small, constant delay, and packets arrive with variable delays. The solution is a jitter buffer in the receiver, which accumulates a few milliseconds and delivers at an even pace. That buffer adds delay in exchange for regularity: if it is short, you hear dropouts; if it is long, the conversation becomes awkward.

03Detecting and correcting errors

transmitterreceiverthe channel may alter bitsdataCRCdataCRCremainder matchesframe acceptedThe transmitter calculates the CRCA binary division of the data by a fixed polynomial is performed; the remainder is sent at the end of theframe.dataCRCdataCRCremainder matchesframe acceptedThe frame arrives intactThe receiver repeats the calculation on what it received: the remainder matches and the frame is accepted.dataCRCdataCRCremainder differsframe discardedOne bit flipped in the channelThe calculated remainder no longer matches the one sent: the frame is discarded and requested again.dataCRCdataCRCremainder differsframe discardedA noise burst corrupted several bitsA 16-bit CRC detects practically all bursts shorter than its length.
Figure 2. Frame checking, animated. The transmitter calculates a remainder and sends it; the receiver repeats the calculation on what it received. If it does not match, the frame is discarded.
MethodWhat it detectsCost
ParityAn odd number of erroneous bits. If two flip, it doesn't notice.1 bit
ChecksumSimple errors. Byte permutations slip past it.1 or 2 bytes
CRCPractically all errors, including bursts shorter than its length. It is what Ethernet, CAN and Modbus use.2 or 4 bytes
HammingDetects two errors and corrects one. Used in memories.several bits
Convolutional codes and Reed-SolomonCorrect long bursts without retransmitting. Digital radio, satellite, disks.25 to 50% of the throughput
Two strategies for dealing with errors
  • Detect and retransmit: the receiver discards what is damaged and asks again. It is efficient when errors are rare and the delay is short. It is what TCP does.
  • Correct at the receiver: enough redundancy is sent to repair without asking. It is what is appropriate when retransmitting is extremely expensive —a satellite, with half a second round trip— or simply impossible, as in a broadcast transmission.
Example · How much retransmitting costs

A link with a BER of 10⁻⁵ carries frames of 1500 bytes, that is, 12,000 bits.

  • Probability that a frame arrives intact: (1 − 10⁻⁵)12,000 ≈ 88.7%.
  • So one frame in nine is discarded and has to be requested again.
  • With 500-byte frames, the probability of arrival rises to 96%: fewer retransmissions, although more headers.

That is the reason noisy links use short frames, and clean ones, long frames. It is not an arbitrary choice: it comes from the error rate.

04Addressing and access networks

ElementFunction
Physical addressIdentifies the network card within the local network. It comes from the factory and is not routed.
IP addressIdentifies the device on the logical network. It is what lets you get out of the local network.
Subnet maskSeparates the network part from the host part: it defines who is a “neighbor” and who is outside.
GatewayThe device to which packets destined for other networks are handed.
PortIdentifies the service within the device: 80 for web, 502 for Modbus TCP.
ISDNThe integrated services digital network: two 64 kbit/s channels plus one 16 kbit/s channel for signaling. It was the first digital subscriber access, now superseded by broadband networks.
Example · What a device does before sending

A PLC with address 192.168.1.20 and mask 255.255.255.0 wants to talk to a server.

  • If the destination is 192.168.1.55, the mask indicates it is on the same network: it hands the frame over directly.
  • If the destination is 10.0.0.8, it is outside: it hands the frame to the gateway, which takes care of routing it.
  • If the gateway is misconfigured, local communication works perfectly and remote communication never works. It is the symptom that identifies that configuration error.

05In the lab

Lab 1 · Seeing the layers

With a protocol analyzer, capture real traffic and open a packet: identify the header of each layer and locate the application data inside it all. Measure how many bytes are header and how many are useful information.

Lab 2 · Calculating a CRC by hand

With a short polynomial, calculate the CRC of a message of a few bytes and verify it. Then change one bit and check that the remainder no longer matches. Implement it on the microcontroller and compare with the manufacturer's library.

Lab 3 · Errors and retransmissions

On your own serial link, add controlled noise and measure the rate of discarded frames with different frame sizes. Plot it and compare with the theoretical calculation from the measured BER.

Lab 4 · Network troubleshooting

Deliberately configure a wrong mask, a wrong gateway and a duplicate address, and learn to recognize the symptom of each case with the basic troubleshooting tools. Build your own symptom-cause table.

06Common mistakes

SymptomUsual cause
The local network works but internet access doesn'tGateway misconfigured or missing.
Two devices can't see each other even though they are on the same switchDifferent masks: each one thinks the other is on another network.
Intermittent, erratic communicationDuplicate IP address.
Relying only on parityIt does not detect an even number of erroneous bits, which is typical in noise bursts.
Long frames on a noisy linkAlmost all are discarded and throughput collapses because of retransmissions.
Voice over IP with a very short bufferYou hear dropouts with every variation in delay.
Expecting retransmission on a satellite linkHalf a second round trip: forward correction is the right choice.
Troubleshooting without thinking in layersYou look in the application for a problem that was in the cable, and vice versa.

07Self-assessment

What is the point of organizing protocols in layers?

To be able to change one layer without touching the others: the same application travels over fiber, WiFi or satellite by changing only the physical layer.

What is encapsulation?

Each layer adds its own header on the way down and removes it on the way up, treating what it receives from above as data it does not need to interpret.

At which layer does IP work and at which TCP?

IP at the network layer —addressing and routing— and TCP at the transport layer —end-to-end delivery, ordering and flow control—.

Advantage and disadvantage of packet switching.

It makes far better use of resources and tolerates the loss of a link; in exchange the delay is variable and there is no automatic bandwidth guarantee.

Why does voice over IP need a jitter buffer?

Because packets arrive with variable delays and voice needs a constant pace. The buffer accumulates a few milliseconds and delivers evenly.

What limitation does the parity bit have?

It only detects an odd number of erroneous bits. If two flip, the parity matches again and the error goes unnoticed.

Why is CRC used in Ethernet, CAN and Modbus?

Because it detects practically all errors, including bursts shorter than its length, at a cost of only 2 or 4 bytes per frame.

When is forward error correction appropriate instead of retransmission?

When retransmitting is very expensive —a satellite link with half a second of delay— or impossible, as in a broadcast transmission.

Why do noisy links use short frames?

Because the probability that a frame arrives intact falls with its length: with long frames almost all are discarded and throughput collapses.

The local network works but there is no internet access. What do you check?

The gateway: if it is missing or misconfigured, packets to other networks don't get out, while local communication keeps working.

Development of the topic “Data communications” of Telecommunications II (Year 7), based on the “Curriculum Proposal – Second Cycle of the Technical-Vocational Track, Secondary Education – Electronics,” Ministry of Education of the Province of Córdoba, DGETyFP. Back to the Topic Map · catto.ar