Channel coding
How forward error correction lets a link run close to the Shannon limit. Block and convolutional codes, turbo, LDPC and polar codes, soft decoding, which code 5G NR uses on which channel, and HARQ.
Overview
Channel coding adds structured redundancy so that a receiver can correct the errors noise and fading cause. It is the reason a modern link can work a few dB from the Shannon bound instead of the 10 dB or more an uncoded link needs. Coding gain is the cheapest gain in a radio. It costs processing and some rate, but no transmit power, spectrum or antenna area.
This hub covers the families of codes that matter in practice, how decoders use soft information, and how cellular systems combine coding with retransmission. It is for engineers who need to know why a standard picked a particular code, what the decoder in their chipset or FPGA is doing, or how to simulate a coded link honestly.
Key ideas
Redundancy, rate and soft decisions
A code maps K information bits to N coded bits, giving a code rate R = K/N. The redundancy lets the decoder find the most likely transmitted codeword even when some bits are wrong. Hamming’s 1950 codes correct single errors in short blocks. Cyclic redundancy checks (CRCs) only detect errors, and every cellular transport block carries one so the receiver knows whether decoding succeeded.
The largest practical gain comes from soft decisions. Instead of hard 0s and 1s, the demodulator passes a log-likelihood ratio (LLR) per bit: its sign is the likely value and its magnitude the confidence. Soft-decision decoding performs measurably better than hard decisions, and the advantage grows on fading channels where some bits arrive much weaker than others.
Convolutional and turbo codes
A convolutional code passes the bit stream through a shift register and outputs parity bits that depend on the current and recent inputs. Viterbi’s 1967 algorithm decodes it by finding the most likely path through the code’s trellis, with complexity that grows with the number of states rather than the message length. Convolutional codes are still used for short control messages.
Turbo codes, presented by Berrou, Glavieux and Thitimajshima in 1993, concatenate two convolutional encoders through an interleaver. Their decoders exchange soft information iteratively, and the original paper reported performance near the Shannon limit. LTE adopted them. In 3GPP TS 36.212 (Release 19 version), LTE uses rate 1/3 turbo coding for its shared, paging and multicast data channels, and rate 1/3 tail-biting convolutional coding for the broadcast channel and downlink control information.
LDPC and polar codes in 5G NR
Low-density parity-check (LDPC) codes, proposed by Gallager in 1962 and revived by MacKay and Neal in 1996, are defined by a sparse parity-check matrix. Belief-propagation decoders pass messages along its edges and parallelise well, which suits the high throughputs of NR. Polar codes, introduced by Arıkan in 2009, provably achieve capacity on symmetric binary-input memoryless channels with low-complexity encoding and decoding. At short block lengths they are decoded with successive-cancellation list decoders aided by a CRC.
In 3GPP TS 38.212 (Release 19 version), NR uses LDPC for the uplink and downlink shared channels and the paging channel. Two base graphs cover different block sizes and rates: base graph 1 has a maximum code block size of 8448 bits and base graph 2 of 3840 bits. Polar codes protect the broadcast channel, downlink control information, and uplink control information of 12 bits or more. Uplink control information of up to 11 bits uses small block codes.
HARQ
Hybrid automatic repeat request (HARQ) combines coding with retransmission. The transmitter sends a coded block and keeps it. If the CRC fails, the receiver keeps its soft values and sends a negative acknowledgement. The retransmission is combined with the stored values before decoding again. With chase combining every retransmission is identical. With incremental redundancy each one carries different coded bits, so the effective code rate falls with each attempt.
TS 38.300 describes NR HARQ as asynchronous incremental redundancy. The rate matcher writes the LDPC output into a circular buffer, and the redundancy version, 0 to 3, sets where reading starts. TS 38.214 supports up to 16 HARQ processes per cell in each direction, or 32 where the UE supports it, so the link keeps sending new data while earlier blocks wait for acknowledgement. Because HARQ catches residual errors, link adaptation does not aim for zero errors. With the usual CQI tables in TS 38.214, the UE reports the highest CQI whose transport block error probability would not exceed 0.1.
Where to start
The beginner track covers the modulation and noise behind coding: read /learn/beginner/04-noise-snr-and-capacity/ and /learn/beginner/05-digital-modulation/ first. The project /projects/qpsk-modem-ber/ gives you an uncoded baseline to compare coded links against. Intermediate lessons on convolutional, LDPC and polar decoding are in preparation. Keep /reference/capacity-and-spectral-efficiency/ and the 3GPP spec map to hand.
Tools and platforms
| Tool | What it is for | Licence | Platform |
|---|---|---|---|
| AFF3CT | Fast C++ simulation of LDPC, polar, turbo, convolutional, BCH and Reed-Solomon codes | MIT | /platforms/opensource/ |
| Sionna | 5G NR LDPC and polar encoders and decoders in a link-level simulator | Apache-2.0 | /platforms/opensource/ |
| CommPy | Convolutional encoder, Viterbi and MAP decoders, turbo codes, LDPC belief propagation in Python | BSD-3-Clause | /platforms/opensource/ |
GNU Radio fec module |
Convolutional, LDPC and polar encoders and decoders as streaming blocks | GPL-3.0 | /platforms/gnuradio/ |
For decoder hardware, FPGA Guide covers the arithmetic in its DSP on FPGA hub.
Common mistakes
- Comparing coded and uncoded curves against SNR per symbol instead of Eb/N0, which hides the rate penalty.
- Feeding a soft decoder LLRs with the wrong sign convention or scaling. Check with a noiseless input first.
- Simulating too few blocks to see the error floor of an LDPC or turbo code.
- Quoting block error rate and bit error rate interchangeably.
- Assuming an LDPC decoder from one standard works for another. The parity-check matrices differ.
Going deeper
- R. W. Hamming, Error detecting and error correcting codes, Bell System Technical Journal 29(2), 1950.
- A. J. Viterbi, Error bounds for convolutional codes and an asymptotically optimum decoding algorithm, IEEE Transactions on Information Theory 13(2), 1967.
- C. Berrou, A. Glavieux and P. Thitimajshima, Near Shannon limit error-correcting coding and decoding: turbo-codes, Proceedings of IEEE ICC ’93, 1993.
- R. G. Gallager, Low-density parity-check codes, IEEE Transactions on Information Theory 8(1), 1962, and D. J. C. MacKay and R. M. Neal, Near Shannon limit performance of low density parity check codes, Electronics Letters 32(18), 1996.
- E. Arıkan, Channel polarization: a method for constructing capacity-achieving codes for symmetric binary-input memoryless channels, IEEE Transactions on Information Theory 55(7), 2009.
- T. Richardson and S. Kudekar, Design of low-density parity check codes for 5G New Radio, IEEE Communications Magazine 56(3), 2018, and V. Bioglio, C. Condo and I. Land, Design of polar codes in 5G New Radio, IEEE Communications Surveys and Tutorials 23(1), 2021.
- 3GPP TS 38.212 (NR multiplexing and channel coding) and TS 36.212 (the LTE equivalent).