Software Defined Radio (SDR) is a method that replaces hardware work (which is generally beneficial to health) with the headache of programming. SDR is predicted to have a bright future, and one of its main advantages is the removal of limitations in implementing radio protocols. An example is the OFDM (Orthogonal Frequency-Division Multiplexing) modulation method, which became possible only through SDR. Additionally, SDR provides an entirely engineering capability—the ability to control and visualize the signal at any arbitrary point with minimal effort.
One interesting communication standard is terrestrial digital television DVB-T2.
Why? Of course, you can simply turn on the TV without getting up, but there's absolutely nothing to watch, which is not just my opinion but a medical fact.
Seriously, DVB-T2 was developed with very broad capabilities, including:
- indoor applications
- modulation from QPSK to 256QAM
- bandwidth from 1.7MHz to 8MHz
There is experience in receiving digital television based on SDR principles. The DVB-T standard is available in the well-known GNURadio project. There is a gr-dvbs2rx block for the DVB-T2 standard (all for the same GNURadio), but it requires prior signal synchronization and it is inspiring (a separate thanks to Ron Economos).
What we have.
There is the ETSI EN 302 755 standard, which describes transmission in detail, but not reception.
The signal in the air has a sampling frequency of 9.14285714285714285714 MHz, modulated by COFDM with 32768 carriers in an 8 MHz band.
It is recommended to receive such signals with double the sampling frequency (to lose nothing) and at an intermediate frequency greater than the bandwidth (superheterodyne reception), to eliminate DC offset and the drift of the local oscillator (LO) at the receiver input. Devices that meet these conditions are too expensive for simple curiosity.
SdrPlay with 10Msps 10bit or AirSpy with similar characteristics are an order of magnitude cheaper. Here, there is no talk of double the sampling frequency, and reception can only occur with direct conversion (Zero IF). Therefore, (for financial reasons) we side with the proponents of 'pure' SDR with minimal hardware conversion.
Two tasks needed to be solved:
- Synchronization. To determine the exact deviation of the radio frequency with phase accuracy and the deviation of the sampling frequency.
- Rewrite the DVB-T2 standard backwards.
The second task requires much more code, but it can be solved with persistence and is easily verified with test signals.
Test signals are available on the BBC server ftp://ftp.kw.bbc.co.uk/t2refs/ with detailed instructions.
The solution to the first task largely depends on the characteristics of the SDR device and the control capabilities. Using the recommended frequency control functions, as it turned out, was not successful, but it provided a lot of experience in reading technical documentation, programming, watching series, and tackling philosophical questions... In short, it was not possible to abandon the project.
The belief in "pure SDR" has only strengthened.
We receive the signal as it is, interpolate it practically to an analogue form, and extract a discrete signal that resembles the real one.
Synchronization flowchart:

Everything here is according to the textbook. It gets a bit more complicated from here. It is necessary to calculate the deviations. There is a lot of literature and research articles comparing the advantages and disadvantages of different methods. From the classics – it is "Michael Speth, Stefan Fechtel, Gunnar Fock, Heinrich Meyr, Optimum Receiver Design for OFDM-Based Broadband Transmission – Part I and II." However, I have not encountered a single engineer who knows how to and is willing to calculate, so an engineering approach was applied. The same synchronization method introduced disturbances into the test signal. By comparing various metrics with known deviations (which I also introduced), the best for performance and simplicity of implementation were chosen. The deviation of the reception frequency is computed by comparing the guard interval and its repeating part. The phase of the reception frequency and the sampling frequency is estimated by the pilot signal phase deviations, which is also used in the simple linear equalizer for the OFDM signal.
Equalizer characteristics:

And all of this works well if you know when the DVB-T2 frame starts. For this, a P1 preamble symbol is transmitted in the signal. The method for detecting and decoding the P1 symbol is described in Technical Specification ETSI TS 102 831 (there are many useful reception recommendations as well).
Autocorrelation of signal P1 (the top point is the start of the frame):

The first picture (only six months left until the moving image...):

And this is where we learn about IQ imbalance, DC offset, and LO leakage. Usually, the compensation for these specific distortions of direct conversion is implemented in the SDR device driver. Therefore, it took a long time to understand: knocking stars out of the friendly constellation of QAM64 is the job of the compensation functions. I had to disable everything and write my own solution.
And then the image started moving:

QAM64 modulation with a specific constellation rotation in the DVB-T2 standard:

In short, this is the result of passing the mixture back through the meat grinder. The standard provides for four types of interleaving:
- bit interleaving (bit interleaving with column twisting)
- cell interleaving (interleaving cells in the coding block)
- time interleaving (also known in the group of coding blocks)
- frequency interleaving (interleaving frequencies in the OFDM symbol)
As a result, we have a signal like this at the input:

All this is a fight for the noise immunity of the coded signal.
Summary
Now we can see not only the signal itself and its shape, but also the service information.
There are two multiplexes on air. Each has two physical channels (PLP).
One peculiarity noticed in the first multiplex — the first PLP is labeled 'multiple', which makes sense, as it is not alone in the multiplex, while the second PLP is marked 'single', which raises questions.
Even more interesting is the second peculiarity in the second multiplex — all programs are in the first PLP, while in the second PLP, a signal of unknown nature is present at a low speed. At least, the VLC player, which understands about fifty video formats and as many audio formats, does not recognize it.
.
The project was created to determine the very possibility of decoding DVB-T2 using SdrPlay (and now also AirSpy), so this isn't even an alpha version.
P.S. While writing this article with difficulty, I managed to integrate PlutoSDR into the project.
Someone will immediately say that there are only 6Msps for the IQ signal out of the USB2.0, but at least 9.2Msps is needed; however, that is a separate topic.
Source: habr.com
