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