Project

General

Profile

Osmo-tetra » History » Version 21

laforge, 07/27/2023 08:30 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 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 20 laforge
git clone https://gitea.osmocom.org/tetra/osmo-tetra.git
48 15 horiz0n
</code></pre>
49 1 laforge
50 20 laforge
You can also browse the source code at https://gitea.osmocom.org/tetra/osmo-tetra
51 1 laforge
52 20 laforge
You will need [[libosmocore:]] to link against.
53 1 laforge
54 21 laforge
h2. Mailing List / Forum
55 15 horiz0n
56 1 laforge
There is a public mailing list regarding development of this project, you can
57
visit the subscription page at https://lists.osmocom.org/mailman/listinfo/tetra
58
59 2 horiz0n
Please make sure to read the [[cellular-infrastructure:MailingListRules]] before posting.
60 21 laforge
61
There's now also a "TETRA category in our discourse forum":https://discourse.osmocom.org/c/tetra
62 1 laforge
63 15 horiz0n
h2. FAQ
64 1 laforge
65 15 horiz0n
We now have a [[FAQ]] (Frequently asked Questions) page!
66 1 laforge
67 15 horiz0n
h2. Demodulator
68 1 laforge
69 18 laforge
<pre>
70
src/demod/python/cpsk.py
71
</pre>
72 1 laforge
73 18 laforge
* contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI
74
75 1 laforge
<pre>
76 18 laforge
src/demod/python/tetra-demod.py
77
</pre>
78
79
* call demodulator on a 'cfile' containing complex baseband samples
80
81 1 laforge
<pre>
82 18 laforge
src/demod/python/usrp1-tetra_demod.py
83
</pre>
84
85
* use demodulator in realtime with a USRP1 SDR
86
87 1 laforge
<pre>
88 18 laforge
src/demod/python/usrp2-tetra_demod.py
89
</pre>
90
91
* use demodulator in realtime with a USRP2 SDR
92
93 1 laforge
<pre>
94 18 laforge
src/demod/python/fcdp-tetra_demod.py
95
src/demod/python/fcdp-tetra_demod_fft.py
96
</pre>
97 1 laforge
98 18 laforge
* 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.
99
100 15 horiz0n
The output of the demodulator is a file containing one float value for each symbol,
101 1 laforge
containing the phase shift (in units of pi/4) relative to the previous symbol.
102
103 18 laforge
You can use the @float_to_bits@ program to convert the float values to unpacked bits, i.e. 1-bit-per-byte
104 1 laforge
105
106
h2. PHY/MAC layer
107
108
109
h3. library code
110
111
112
Specifically, it implements:
113
114
<pre>
115 18 laforge
lower_mac/crc_simple.[ch]
116
</pre>
117
118
* CRC16-CCITT (currently defunct/broken as we need it for non-octet-aligned bitfields)
119
120 1 laforge
<pre>
121 18 laforge
lower_mac/tetra_conv_enc.[ch]
122
</pre>
123
124
* 16-state Rate-Compatible Punctured Convolutional (RCPC) coder
125
126 1 laforge
<pre>
127 18 laforge
lower_mac/tetra_interleave.[ch]
128
</pre>
129
130
* Block interleaving (over a single block only)
131
132 1 laforge
<pre>
133 18 laforge
lower_mac/tetra_rm3014.[ch]
134
</pre>
135
136
* (30, 14) Reed-Muller code for the ACCH (broadcast block of each downlink burst)
137
138 1 laforge
<pre>
139 18 laforge
lower_mac/tetra_scramb.[ch]
140
</pre>
141 1 laforge
142 18 laforge
* Scrambling
143 1 laforge
144 18 laforge
<pre>
145
lower_mac/viterbi*.[ch]
146
</pre>
147 15 horiz0n
148 18 laforge
* Convolutional decoder for signalling and voice channels
149 1 laforge
150 18 laforge
<pre>
151
phy/tetra_burst.[ch]
152
</pre>
153 15 horiz0n
154 18 laforge
* Routines to encode continuous normal and sync bursts
155
156 1 laforge
<pre>
157 18 laforge
phy/tetra_burst_sync.[ch]
158
</pre>
159 1 laforge
160
161 18 laforge
h3. Receiver Program
162 3 horiz0n
163 18 laforge
The main receiver program @tetra-rx@ expects an input file containing a stream of unpacked bits, i.e. 1-bit-per-byte.
164
165 15 horiz0n
h3. Transmitter Program
166
167 18 laforge
The main program conv_enc_test.c generates a single continuous downlink sync burst (SB), containing:
168
* a SYNC-PDU as block 1
169
* a ACCESS-ASSIGN PDU as broadcast block
170
* a SYSINFO-PDU as block 2
171 5 horiz0n
172 13 horiz0n
Scrambling is set to 0 (no scrambling) for all elements of the burst.
173 11 horiz0n
174 15 horiz0n
It does not actually modulate and/or transmit yet.
175 1 laforge
176 11 horiz0n
177 14 horiz0n
h2. Quick example
178
179 18 laforge
assuming you have generated a file @samples.cfile@ at a sample rate of 195.312kHz (100MHz/512 == USRP2 at decimation 512)
180 10 horiz0n
181 6 horiz0n
<pre>
182 10 horiz0n
./src/demod/python/tetra-demod.py -i /tmp/samples.cfile -o /tmp/out.float -s 195312 -c 0
183 5 horiz0n
./src/float_to_bits /tmp/out.float /tmp/out.bits
184 15 horiz0n
./src/tetra-rx /tmp/out.bits
185 18 laforge
</pre>
186 1 laforge
187
Also, you may use pipes to glue the three programs running in different terminals together to achieve real time operation.
188 15 horiz0n
189
<pre>
190
mkfifo /tmp/out.float
191
mkfifo /tmp/out.bits
192
./src/demod/python/fcdp-tetra_demod.py -D hw:1,0 -o /tmp/out.float
193
...
194 18 laforge
</pre>
195 15 horiz0n
196 17 laforge
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.
197 1 laforge
198
* Adjust the center frequency (-f) and gain (-g) according to your needs.
199
* Use left click in Wideband Spectrum window to roughly select a TETRA carrier.
200 15 horiz0n
* In Wideband Spectrum you may also tune by 1/4 of the bandwidth at once by clicking on the rightmost/leftmost spectrum side.
201 1 laforge
* Use left click in Channel Spectrum window to fine tune the carrier by clicking on the left or right side of the spectrum.
202 15 horiz0n
203 1 laforge
!osmo-tetra-demod.png!
204
205
For live capture call:
206
207
<pre>
208 15 horiz0n
src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin
209 18 laforge
</pre>
210 15 horiz0n
211 1 laforge
You may specify gr-osmosdr device arguments by using the --args commandline option.
212
213
To use a gnuradio .cfile as input:
214
215
<pre>
216
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
217 18 laforge
</pre>
218 1 laforge
219
Note the mandatory rate argument and optional repeat & throttle arguments.
Add picture from clipboard (Maximum size: 48.8 MB)