osmocom-analog/docs/c-netz.html

266 lines
10 KiB
HTML

<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<title>osmocom-analog</title>
</head>
<body>
<center><table><tr><td>
<h2><center>C-Netz</center></h2>
<center><img src="c-netz.jpg"/></center>
<ul>
<li><a href="#history">History</a>
<li><a href="#howitworks">How it works</a>
<li><a href="#basestation">Setup of a base station</a>
</ul>
<p class="toppic">
<a name="history"></a>
History
</p>
<p>
C-Netz was the third mobile telephone network in Germany.
It existed between 1984 (officially Mai 1985) and December 2000.
It was the first cellular system, so frequencies could be used more efficiently.
It offered handover capability, so moving phones can change cells during a call.
New was the SIM card, which was similar to GSM.
This card allowed to use phones by different subscribers with different subscriber numbers.
Authentication was used to prevent fraud, but is was used only with SIM card phones.
Extra services (e.g. conditional call forwarding, answering machine) were installed in the mobile network.
A scrambler inside the phone and base station prevented eavedropping with radio scanners.
Phones became smaller and portable, even handheld phones were available.
It used full duplex radio link.
All phones were available under a dedicated prefix, so the caller must to know the location of the phone anymore.
</p>
<center><img src="c-netz-c130.jpg"/></center>
<p>
<ul>
<li>Frequency range: 461.300 - 465.740 MHz (downlink); 451.300 - 465.740 MHz (uplink)
<li>222 voice channels
<li>237 voice channels since Mai 1988
<li>287 voice channels since September 1989
<li>1 organisation channel (call setup and paging)
<li>Duplex distance: 10 MHz
<li>Channel spacing: 10 KHz and optionally 12.5 KHz
<li>Voice modulation: FM
<li>Signalling modulation: carrier FSK
<li>Frequency deviation: 2.4 KHz (FSK)
<li>Mobile station transmit power: 50 mW up to 15 Watts
<li>Base station transmit power: 25 Watts
</ul>
</p>
<p class="toppic">
<a name="howitworks"></a>
</p>
<p>
*TBD*
</p>
<p class="toppic">
<a name="basestation"></a>
Setup of a base station
</p>
<p>
When I first started with testing early C-Netz implementation, I had great trouble getting a response from a mobile phone.
The main problem was clock speed of the transmitted signal.
The base stations were all synchronized with a high precision clock.
All base stations transmit on the same control channel 131 ('Orgakanal'), but at different time slots.
The phone expects that the time slots repeat precisely every 2.4 seconds.
The specs say that the phone requires clock speed deviation of +- 1 PPM (Parts Per Million) or less.
To comply with the specs, the base stations needs to have a clock deviation far below 1 PPM.
(I guess that there is a tollerance, so maybe a few PPM deviation would make no big problem.)
We need to calibrate the speed of our transmit signal (and receive signal as well).
</p>
<p>
<font color="red">Importaint: We need calibrate the signal processing clock!</font>
</p>
<p>
First of all we need a reference clock.
Since most systems have standard crystals, we cannot use our system clock as reference without any help.
I decided to use the NTP daemon.
After running the system for several days, the clock speed should be accurate enough for our needs.
Be sure to choose a place with constant temperature.
</p>
<p>
In /etc/ntp.conf define one or more servers to geht the time from. I suggest to use the German atom clock of the PTB:
</p>
<pre>
server ntp1.ptb.de
server ntp2.ptb.de
server ntp3.ptb.de
</pre>
<p>
This clock provides time base for European radio clocks and most German clocks.
It accurate enough for this project, so please use this clock.
</p>
<pre>
netbook ~ # ntptime
ntp_gettime() returns code 0 (OK)
time dad971f1.9e1b5c44 Sun, May 8 2016 10:06:09.617, (.617605507),
maximum error 238951 us, estimated error 199 us, TAI offset 0
ntp_adjtime() returns code 0 (<font color="red">OK</font>)
modes 0x0 (),
offset 425.797 us, frequency <font color="red">15.796 ppm</font>, interval 1 s,
maximum error 238951 us, estimated error 199 us,
status 0x2001 (PLL,NANO),
time constant 10, precision 0.001 us, tolerance 500 ppm,
</pre>
<p>
One notices that I have quite an unprecise crystal in my test machine.
Since I have NTP running, the system clock is now far below 1 PPM.
</p>
<p>
The second problem is the clock of our sound adapter.
They use own crystals.
Because they are made for audio signals (and not for high precise base stations), they can't be used without calibration.
Cheap USB adapters may even have different clocks on TX and RX.
I found out that the clock speed changes when the USB voltage changes.
The USB voltage changes, when the current changes, due to different volumes on the output.
To minimize this effect, don't use extension cables.
</p>
<p>
Since we have precise system clock now, we can measure the speed of our sound adapter.
Later we will use the measurement result to adjust our signal processor.
Be sure to have your machine running for at least 3-4 days (with your sound adapter attached, in case you have USB sound adapter).
The machine must have network connection to the NTP server.
I suggest to use 'ntp1.ptb.de' and 'ntp2.ptb.de' as reference.
Use command line option '-M' or '--measure' to measure my sound adapter.
Let it run for one hour.
</p>
<pre>
# src/cnetz/cnetz -k 131 -M
...
dsp.c:218 notice : Clock: RX=4.75 TX=36.84; Signal: RX=135.38 TX=-378.58 ppm
dsp.c:218 notice : Clock: RX=10.61 TX=31.09; Signal: RX=135.38 TX=-378.58 ppm
dsp.c:218 notice : Clock: RX=3.01 TX=26.55; Signal: RX=135.38 TX=-378.58 ppm
...
dsp.c:218 notice : Clock: RX=19.46 TX=19.45; Signal: RX=19.39 TX=19.42 ppm
dsp.c:218 notice : Clock: RX=19.45 TX=19.50; Signal: RX=19.39 TX=19.42 ppm
dsp.c:218 notice : Clock: RX=19.48 TX=19.47; Signal: RX=19.39 TX=19.42 ppm
dsp.c:218 notice : Clock: RX=19.44 TX=19.44; Signal: RX=19.35 TX=19.43 ppm
dsp.c:218 notice : Clock: RX=19.44 TX=19.49; Signal: RX=19.35 TX=19.43 ppm
</pre>
<p>
One can see that the measured clock from the sound card (sample rate) differs about +19.45 PPM.
Because I did not do any correction to the signal processing, the same error applies to the signal.
Use command line option '-S 19.45,19.45' or '--clock-speed 19.45,19.45' to compensate the clock error by adjusting the signal processor.
Let it run again for one hour and you will see that clock deviation is below 1 PPM.
</p>
<p>
<font color="red">Importaint: We need to connect to PLL and discriminator!</font>
</p>
<p>
C-Netz does not use a modulated tone to carry bits of information, instead it modulates the carrier directly.
This image shows the demodulated signal from a receiver:
</p>
<center><img src="c-netz-burst_full.png"/></center>
<p>
Generally a receiver will do de-emphasis and filtering after demodulating the signal.
We don't want that.
It may work, but be sure to get a receiver with disciminator output.
Many receivers can be modified, so search the Web for more infos.
</p>
<p>
On the transmitter we don't want to have filtering and pre-emphasis.
It may work, but be sure to get a transmitter that allows to disable emphasis.
I took the schematics of my transmitter and connected the sound card
directly to the PLL.
</p>
<p>
<font color="red">Importaint: We need to transmit correct polarity, use auto polarity detection always!</font>
</p>
<center><img src="c-netz-burst_part.png"/></center>
<p>
C-Netz uses FSK (Frequency Shift Keying) by directly modulating the carrier, rather than modulating a tone, which is then transmitted via FM.
The advantage is much higher data rate.
The base station's carrier frequency is raised by 2.5 KHz to transmit a logical "1" and lowered by 2.5 KHz to transmit a logial "0".
(The mobile station transmits reversed polarity.)
The mobile station will only detect the correct polarity.
The three sync words of "11100010010", is shown in the picture above.
In the picture above, the polarity is wrong.
(The logical "1" points down and the logical "0" points up.)
To change polarty, use command line option '-F yes|no|auto' or '--flip-polarity yes|no|auto'.
(Note: don't confuse with '-P'!)
</p>
<p>
The 'auto' option (default) will generate a signal of two base stations.
Since we have time division multiplex on the main control channel, we can transmit a second base station easily.
The second base station uses reversed polarity, so there is one base station with correct and one with wrong polarity.
The two base stations have different time slots and different IDs.
If a first registration message is received from the phone, we check which base station this response belongs to.
Then we found the correct polarity and turn off the base station with the wrong polarity.
</p>
<p>
The decoder itself does not care about what polarity it receives from the mobile station.
It just checks for sync words with both polarities and chooses right polarity automatically.
</p>
<p>
I have a transmitter and a receiver without emphasis, my soundcard has a clock error of about 19.2 PPM.
To run the base station I the following command line options:
</p>
<pre>
# cnetz -k 131 -E -e -S 19.25,19.25
...
cnetz.c:142 notice : You selected channel 131 ('Orga-Kanal') for combined callin
g + traffic channel. Some phones will reject this.
dsp.c:96 info : Using clock speed of 19.2 ppm (RX) and 19.2 ppm (TX) to correc
t sound card's clock.
cnetz.c:274 info : Entering IDLE state on channel 131.
Base station on channel 131 ready, please tune transmitter to 465.090 MHz and re
ceiver to 455.090 MHz.
</pre>
<p>
The sofware complains about using control channel 131 for voice traffic too.
This is the easiest way to use a single transmitter and receiver without switching.
But this is not compliant, so especially newer phone will reject this, like the Nokia C130.
Old phones like BSA, Storno or Phillips phones don't care.
When we make a call and another phone is regisered, the phone will loose coverage when we switch from control channel to traffic channel.
After the call, the other phone re-registers again.
</p>
[<a href="index.html">Back to main page</a>]
</td></tr></table></center>
</body>
</html>