Project

General

Profile

Osmo-tetra » History » Version 16

laforge, 02/21/2016 08:01 AM

1 15 horiz0n
{{>toc}}
2 1 laforge
3 15 horiz0n
h1. Osmocom TETRA MAC/PHY layer experimentation code
4
5
6 1 laforge
This code aims to implement the sending and receiving part of the
7
TETRA MAC/PHY layer.
8
9
If you read the ETSI EN 300 392-2 (TETRA V+D Air Interface), you will
10
find this code implementing the parts between the MAC-blocks (called
11
type-1 bits) and the bits that go to the DQPSK-modulator (type-5 bits).
12
13
It is most useful to look at Figure 8.5, 8.6, 9.3 and 19.12 of the
14
abovementioned specification in conjunction with this program.
15
16
17 15 horiz0n
h2. Big picture
18
19
20 16 laforge
{{graphviz_link()
21 1 laforge
digraph G {
22
  graph [ rankdir = LR ];
23
24
  bits_file2 -> tetra_rx [ label = "read" ];
25
  tetra_rx -> console [ label = "stdout" ];
26
  tetra_rx -> wireshark [ label = "GSMTAP" ];
27
28
  float_file2 -> float_to_bits [ label = "read" ];
29
  float_to_bits -> bits_file1 [ label = "write" ];
30
31
  USRP -> tetra_demod [ label = "USB" ];
32
  tetra_demod -> float_file1 [ label = "write" ];
33
34
  bits_file1 [ shape=box label="file.bits" ];
35
  bits_file2 [ shape=box label="file.bits" ];
36
  float_file1 [ shape=box label="file.float" ];
37
  float_file2 [ shape=box label="file.float" ];
38
  tetra_rx [ label="tetra-rx" ];
39
  tetra_demod [ label="tetra-demod.py" ];
40 15 horiz0n
}
41 16 laforge
}}
42 15 horiz0n
43
h2. Source Code
44
45 1 laforge
The source code is available via read-only git access at
46 15 horiz0n
<pre>
47 1 laforge
git clone git://git.osmocom.org/osmo-tetra.git
48 15 horiz0n
</code></pre>
49 1 laforge
50
You can also browse the source code at http://cgit.osmocom.org/
51
52 15 horiz0n
You will need "libosmocore":http://bb.osmocom.org/trac/wiki/libosmocore to link.
53 1 laforge
54 15 horiz0n
55
h2. Mailing List
56
57 1 laforge
There is a public mailing list regarding development of this project, you can
58
visit the subscription page at https://lists.osmocom.org/mailman/listinfo/tetra
59
60 15 horiz0n
This list is *for discussion between software developers* who intend to improve the
61 1 laforge
Osmocom TETRA software.  It is not a forum for individuals asking how they can tap
62 2 horiz0n
into police radio (which is encrypted anyway).
63 1 laforge
64
65 15 horiz0n
h2. FAQ
66 1 laforge
67 15 horiz0n
We now have a [[FAQ]] (Frequently asked Questions) page!
68 1 laforge
69 15 horiz0n
70
h2. Demodulator
71
72
73
<pre>
74
******** contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI
75
<pre>
76
******** call demodulator on a 'cfile' containing complex baseband samples
77
<pre>
78
******** use demodulator in realtime with a USRP1 SDR
79
<pre>
80
******** use demodulator in realtime with a USRP2 SDR
81
<pre>
82
<pre>
83
******** use demodulator in realtime with a [[Funcube_Dongle]]. Please use the "qthid":https://github.com/csete/qthid application to tune the dongle and adjust its gain/filter parameters for best reception result. This demodulator may also be used with other Softrock-type receivers by downconverting the intermediate frequency of a radio scanner to the complex baseband.
84
85 1 laforge
The output of the demodulator is a file containing one float value for each symbol,
86
containing the phase shift (in units of pi/4) relative to the previous symbol.
87
88
You can use the "float_to_bits" program to convert the float values to unpacked
89
bits, i.e. 1-bit-per-byte
90
91
92
93 15 horiz0n
h2. PHY/MAC layer
94 1 laforge
95 15 horiz0n
96
97
h3. library code
98
99
100 1 laforge
Specifically, it implements:
101
102 15 horiz0n
<pre>
103
******** CRC16-CCITT (currently defunct/broken as we need it for
104 1 laforge
          non-octet-aligned bitfields)
105 15 horiz0n
<pre>
106
******** 16-state Rate-Compatible Punctured Convolutional (RCPC) coder
107
<pre>
108
******** Block interleaving (over a single block only)
109
<pre>
110
******** (30, 14) Reed-Muller code for the ACCH (broadcast block of
111 1 laforge
          each downlink burst)
112 15 horiz0n
<pre>
113
******** Scrambling
114
<pre>
115
******** Convolutional decoder for signalling and voice channels
116
<pre>
117
******** Routines to encode continuous normal and sync bursts
118
<pre>
119 1 laforge
120
121
122 15 horiz0n
h3. Receiver Program
123
124
125
<pre>
126 1 laforge
stream of unpacked bits, i.e. 1-bit-per-byte.
127
128
129
130 15 horiz0n
h3. Transmitter Program
131
132
133
<pre>
134 1 laforge
burst (SB), contining:
135 15 horiz0n
******** a SYNC-PDU as block 1
136
******** a ACCESS-ASSIGN PDU as broadcast block
137
******** a SYSINFO-PDU as block 2
138 1 laforge
139
Scrambling is set to 0 (no scrambling) for all elements of the burst.
140
141
It does not actually modulate and/or transmit yet.
142 3 horiz0n
143
144
145 15 horiz0n
h2. Quick example
146
147
148 3 horiz0n
assuming you have generated a file samples.cfile at a sample rate of 195.312kHz (100MHz/512 == USRP2 at decimation 512)
149
150 15 horiz0n
<pre>
151 5 horiz0n
./src/demod/python/tetra-demod.py -i /tmp/samples.cfile -o /tmp/out.float -s 195312 -c 0
152 13 horiz0n
./src/float_to_bits /tmp/out.float /tmp/out.bits
153 11 horiz0n
./src/tetra-rx /tmp/out.bits
154 15 horiz0n
</code></pre>
155 11 horiz0n
156 14 horiz0n
Also, you may use pipes to glue the three programs running in different terminals together to achieve real time operation.
157
158 15 horiz0n
<pre>
159 10 horiz0n
mkfifo /tmp/out.float
160 6 horiz0n
mkfifo /tmp/out.bits
161 10 horiz0n
./src/demod/python/fcdp-tetra_demod.py -D hw:1,0 -o /tmp/out.float
162 5 horiz0n
...
163 15 horiz0n
</code></pre>
164 5 horiz0n
165 1 laforge
166
167 15 horiz0n
168
The most user friendly way is the script osmosdr-tetra_demod_fft.py which is based on "gr-osmosdr":http://sdr.osmocom.org/trac/wiki/GrOsmoSDR and supports various radio hardware (OsmoSDR, RTLSDR, FCD, UHD) as well as IQ file input.
169
170
* Adjust the center frequency (-f) and gain (-g) according to your needs.
171
* Use left click in Wideband Spectrum window to roughly select a TETRA carrier.
172
* In Wideband Spectrum you may also tune by 1/4 of the bandwidth at once by clicking on the rightmost/leftmost spectrum side.
173
* Use left click in Channel Spectrum window to fine tune the carrier by clicking on the left or right side of the spectrum.
174
175 10 horiz0n
[[Image(osmo-tetra-demod.png,25%)]]
176 1 laforge
177
For live capture call:
178
179 15 horiz0n
<pre>
180 1 laforge
src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin
181 15 horiz0n
</code></pre>
182 1 laforge
183
You may specify gr-osmosdr device arguments by using the --args commandline option.
184
185
To use a gnuradio .cfile as input:
186
187 15 horiz0n
<pre>
188 1 laforge
src$ ./demod/python/osmosdr-tetra_demod_fft.py -a "file=/path/to/tetra_sps1024e3.cfile,rate=1024e3,repeat=true,throttle=true" -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin
189 15 horiz0n
</code></pre>
190 1 laforge
191
Note the mandatory rate argument and optional repeat & throttle arguments.
Add picture from clipboard (Maximum size: 48.8 MB)