osmocom-analog/docs/sdr.html

284 lines
8.5 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>SDR setup</center></h2>
<center><img src="sdr.jpg"/></center>
<ul>
<li><a href="#intro">Introduction</a>
<li><a href="#limesdr">LimeSDR and LimeSDR Mini</a>
<li><a href="#uhd">UHD</a>
<li><a href="#mchan">Multiple channels</a>
</ul>
<p class="toppic">
<a name="intro"></a>
Introduction
</p>
<p>
A far more convenient way is to use an SDR.
Why would you (not) want to do that?
<ul>
<li>Not a bunch of cables and radios, just one device.
<li>Simulate multiple channels with a single SDR channel.
<br>Keep control channel while using voice channel(s).
<li>No audio level (deviation) calibration is required.
<li>The polarity of the frequency deviation (FFSK) is always correct.
<li>No radio mod for discriminator output required.
<li>No radio mod for modulator input required.
<li>Don't care about correct emphasis.
<li>Carrier FSK never returns to zero, no AC coupling.
<li>Switching to channel 19 (B-Netz) works without transmitter hack.
<li>More experience is required to run an SDR.
<li>The device must be full-duplex.
<li>In 2017, they are still more expensive than analog radios.
</ul>
</p>
<p>
It may sound weird, but you are able to simulate multiple channels with only one SDR.
The I/Q data of an SDR allows to shift the frequency.
By adding multiple frequencies, shifted by different offset, allows to transmit multiple down-link channels at a time.
By using a filter, the mix of received up-link channels can be separated.
Multiple channels require multiple CPU usage or even more.
</p>
<p>
How to use an SDR and install the driver software and drivers is beyond the scope of this document.
I assume that you successfully used your SDR with Gnu Radio,
know how to select antenna connectors,
know about DC calibration,
know about clock settings,
know about transmit and receive gains,
and so on...
</p>
<p class="toppic">
<a name="limesdr"></a>
LimeSDR and LimeSDR-Mini
</p>
<p>
If you have this device, you need to install the SoapySDR, then the LimeSuite and finally run configure with Osmocom Analog, compile and install.
Run Osmocom Analog with --help again, and you should see a bunch of option for SDR.
In case of B-Netz, I use the following parameters:
</p>
<pre>
# bnetz --sdr-soapy \
--sdr-rx-antenna LNAL \
--sdr-rx-gain 25 \
--sdr-tx-gain 30 \
--sdr-samplerate 5000000 \
--sdr-bandwidth 15000000 \
-s 100000 \
-k 17
</pre>
<p>
In order to change from analog sound card to SDR, you need <b>--sdr-soapy</b> option.
In my setup I use antennas directly connected to the SDR.
Being about 1-10 meters away, I use the <b>gain</b> as defined above.
The <b>sample rate</b> must be 5 MHz minimum.
The default <b>bandwidth</b> follows the sample rate, if not specified using <b>--sdr-bandwidth</b>.
Higher sample rate causes more CPU, RAM and USB load.
The local oscillator frequency causes the transmitted signal to be noisy, so I shift it 1 MHz away, using the default <b>--sdr-lo-offset</b>.
The audio processing rate of 100 KHz (<b>-s 100000</b>) is used to generate two channels: <b>17</b> and 19.
Note that channel 19 is not given here, but will be used automatically.
With B-Netz, the transmitter switches from any voice channel to the paging channel (19) whenever the phone gets paged.
</p>
<p>
Alternatively you can have these options pre-set by just a single option: <b>--limesdr</b>
But still you can add any SDR option afterwards to set or modify them.
</p>
<pre>
# bnetz --limesdr -k 17
</pre>
<p>
LimeSDR-Mini does need some different antenna setting:
</p>
<pre>
...
--sdr-rx-antenna LNAW \
--sdr-tx-antenna BAND2 \
...
</pre>
<p>
As above, you can have these options pre-set by just a single option: <b>--limesdr-mini</b>
</p>
<pre>
# bnetz --limesdr-mini -k 17
</pre>
<p>
<font color="red">Important: Select your RX antenna input!</font>
</p>
<p>
Be sure to select the right RX antenna input.
The frequencies we use require the low frequency filter network, so I suggest to connect your antenna to RX_1_L and select "--sdr-rx-antenna LNAL".
Different versions of LimeSuite have different default antenna inputs, so be sure to set your RX antenna.
</p>
<p>
<font color="red">Important: Always use two or more channels, to avoid one channel being at the center of the spectrum!</font>
</p>
<p>
My LimeSDR setup causes a bad RX signal, when the RX frequency of the channel (uplink) equals the center frequency of the RX spectrum.
This center frequency is used as RX frequency, when only one channel is created for the base station.
By creating two channels ('-k 15 -k 17') or an even number would eliminate the problem.
The center frequency is between the channels now.
</p>
<center><img src="display-spectrum.png"/></center>
<p>
Press 's' to get an ASCII art graph of received frequency spectrum.
The spectrum's bandwidth is defined by the sample rate (-s) and not by the SDR sample rate!
If you don't get nice peaks, but maybe several peaks, you might over-driven the input.
Note that the peak will spread by the frequency deviation, so the peak might look noisy on the top.
If the peak is quite low, check the input gain.
</p>
<center><img src="display-iq.png"/></center>
<p>
The RX gain is quite important.
You can monitor it by pressing 'q' key.
You will get an ASCII art plot of received IQ data.
Press 'q' again and you will get a logarithmic view of IQ vectors.
Press 'q' again to turn off this view.
Please monitor this view when the phone tries to call or register.
If the dots are yellow, or red, the received signal may overdrive the ADC.
Especially when the linear view shows a deformed circle (or even rectangle), reduce RX level.
</p>
<p class="toppic">
<a name="uhd"></a>
UHD
</p>
<p>
Most things apply to the things stated at the LimeSDR section.
I have good experience, even without using IF offset or special resampling (--sdr-samplerate) or special bandwidth settings.
</p>
<p>
You can run any UHD device using SoapySDR or UHD API.
Use "--sdr-uhd" to use the UHD API.
</p>
<p>
</p>
<p class="toppic">
<a name="mchan"></a>
Multiple Channels
</p>
<p>
Multiple channels can be useful, to keep the control channel, while establishing one or even multiple voice channels.
One nice feature of SDR is that a spectrum is transmitted and not just one modulated carrier.
Because the carrier is actually generated in software, we can generate multiple carriers that fit in our spectrum.
I suggest to have at least one channel space between channels you want to generate.
I suggest to use channel 1 and 3 or even channel 1 and 4 for NMT system.
The software will notice you, if the channels wont fit into the spectrum.
In this case increase the sample rate (-s) to generate a wider spectrum. (--sdr-samplerate must not need to be changed)
</p>
<p>
If multiple channels are defined, the channel type for the first channel is automatically set to the control channel,
the other channels to voice channels.
You may still alter this by specifying channel type for each channel.
</p>
<p>
Note that the CPU usage increases for the main thread.
I suggest to monitor the usage using "top -H".
You will see each thread. Be sure not to get too close to 100 percent.
I suggest to stay below 60% for each threads.
</p>
<p>
<b>Example: C-Netz</b><br>
Two channes are created, one the OgK (control channel) and one SpK (speech channel).
The distance between channels is 20 KHz (two channels).
Because C-Netz uses only odd channel numbers for 10 KHz spacing, we use channel 131 (OgK) and 135 (SpK).
</p>
<pre>
# cnetz --sdr-soapy \
--sdr-rx-antenna LNAL \
--sdr-rx-gain 30 \
--sdr-tx-gain 30 \
--sdr-samplerate 5000000 \
--sdr-bandwidth 15000000 \
-s 100000 \
-k 131 -k 135 \
-C 0,0
</pre>
<p>
<b>Example: Test TV signal</b><br>
Transmit PAL 'FUBK' test image on TV channel 21.
</p>
<pre>
# osmotv --sdr-soapy \
--sdr-tx-gain 60 \
--sdr-bandwidth 60000000 \
-s 13750000 \
-c 21 \
tx-fubk
</pre>
<p>
<b>Example: Receive or transmit a radio broacast channel</b><br>
Receive radio station at 105.6 MHz with German stereo carrier (Pilot-Tone) and output it on sound card 0, device 0.
If you replace <b>--rx</b> by <b>--tx</b>, you will transmit from sound card.
</p>
<pre>
# osmoradio --limesdr \
-f 105600000
-M fm
-s 500000
-S
-a hw:0,0
--rx
</pre>
<hr><center>[<a href="index.html">Back to main page</a>]</center><hr>
</td></tr></table></center>
</body>
</html>