wiki:DecoderPage
Last modified 4 years ago Last modified on 02/07/11 06:46:14

Decoder

The OP25 decoder program demodulates and decodes P25 signals and produces an audio stream and a queue of error-corrected APCO Project 25 frames. A block diagram of the major decoder functions is shown below:

Latest version of C4FM receiver block diagram.

The steps involved in this process are:

  1. Sample the radio spectrum (the USRP can sample 6MHz or so at once or 480 APCO Project 25 channels!).
  2. Filter the original signal with an appropriate channel filter.
  3. Demodulate the symbol stream.
  4. Decode the P25 frames.
    1. Correlate the bit stream using the Frame Synchronization (FS) field.
    2. Aggregate of bit stream into octets and frames (partitioned by an FS).
    3. Apply error detection and correction.
    4. Decode IMBE audio frames and produce a mono audio output stream.
    5. Encapsulate assembled frames in IP and send them for further processing.

Sampling

The USRP allows us to receive a wideband spectrum consisting of many channels at once. Using the analysis_filterbank block these channels can be divided into equal-width channels and processed in parallel. Whatever the source of the samples it will be necessary to filter the incoming signal and correct for any frequency offset. For example, the example signal has the peak hold spectrum is shown below.

Original (unfiltered) signal.

Notice that in this example there is a peak at approximately +27.5KHz which is the center frequency of a P25 signal. A 12.5KHz low-pass filter is used extract the channel of interest and has extremely good selectivity. Once the original signal has been filtered results in a baseband signal with the following peak-hold spectrum:

Baseband signal.

When displayed as a float signal on an oscilloscope the baseband signal shows a nice clean APCO Project 25 signal:

Demodulated signal.

Demodulator block

The demodulator block is responsible for transforming the baseband signal into a symbol stream. The phase I and phase II signals have been defined such that a single C4FM or π/4 DQPSK receiver can demodulate both signals. π/4 DQPSK means that there is a shift in the constellation by 45 degrees every symbol - what would otherwise be a 0 degree phase shift (00) becomes a +45 degree phase shift. This minimizes the phase transition between successive symbols so the maximum is +135 degrees instead of +180. This minor change in the modulator that lowers the bandwidth of the signal and permits the transmitter power amplifier more leeway in terms of linearity and spectral regrowth.

The Radio Rausch FSK4 demodulator is a GNURadio demodulator block that demodulates P25 signal and recovers one of four frequencies that are trivially mapped back into symbols. Each symbol comprises a pair of bits and the signal maps between the dibit symbol and audio frequency/phase shifts according to the following specification:

DibitsSymbolCQPSK Phase Change (degrees)C4FM Deviation (KHz)
01 +3 +135 +1.8
00 +1 +45 +0.6
10 -1 -45 -0.6
11 -3 -135 -1.8

The output from the demodulator block is fed to the decoder block which combines the tasks of correlation, frame assembly, error correction and decoding.

Decoder block

The bit stream on its own provides no clues as to where the beginning of an octet or frame should be. We need to spot the FS, a fixed 48 bit pattern, to determine where the beginning occurs. Once a frame has begun the decoder is responsible for aggregating symbols into frames, applying the many different error detection and correction schemes. APCO Project 25 uses Golay, Reed-Solomon and Hamming error correcting codes to guarantee that data survives errors in reception. For LDU1 and LDU2 frames the IMBE voice content is decoded into an audio stream and for all frames the error-corrected contents are written to a message queue for processing by Python (in our case writing to file or using scapy to write to the loopback device).

Write packets to socket for further processing

At this point the GNURadio framework has served its purpose and we feed the output to its final destination. The diagram above uses the loopback device to allow for using packet sniffers and tunneling P25 to another site. A modified version of the WireShark program will, for example, allow for packet sniffing of the P25 traffic (for more details see the WireSharkPage) including the use of capture and display filters. Later versions have used TUN/TAP and we are now encapsulating the P25 traffic in UDP and multicasting it to all stations that want to process such traffic (this would include WireShark, traffic logging and so on).

Revised WireShark image (shrink by 50%)

Other programs can be written to further process the voice and data streams using the output of the decoder block.

Further Pointers

Attachments