Project

General

Profile

Osmo-fl2k » History » Version 37

laforge, 04/29/2018 09:00 PM
video lkink

1 9 steve-m
h1. osmo-fl2k
2 2 steve-m
3 19 laforge
{{>toc}}
4 19 laforge
5 3 steve-m
h2. Introduction
6 1 steve-m
7 27 laforge
Since [[sdr:rtl-sdr]] has been released a couple of years ago, cheap SDR receivers are ubiquitous. SDRs with transmission capability have become cheaper as well, but are still more expensive. osmo-fl2k allows to use USB 3.0 to VGA adapters based on the Fresco Logic FL2000 chip, which are available for around $5, as general purpose DACs and SDR transmitter generating a continuous stream of samples by avoiding the HSYNC and VSYNC blanking intervals.
8 3 steve-m
9 27 laforge
h2. History
10 1 steve-m
11 27 laforge
The idea of using VGA adapters as a transmitter has a long history. 
12 27 laforge
* In 2001 Erik Thiele released "Tempest for Eliza":http://www.erikyyy.de/tempest/, which transmits a signal that can be received with an AM radio.
13 27 laforge
* In 2005 Fabrice Bellard used an ATI Radeon 9200SE to transmit "DVB-T, PAL and NTSC video signals":https://bellard.org/dvbt/.
14 27 laforge
* Later in 2009, Bartek Kania published "VGASIG":https://bk.gnarf.org/creativity/vgasig/, which allows to transmit wideband FM radio in realtime using SDL and a regular graphics card. 
15 27 laforge
* In 2013, siro at das Labor used all three DAC outputs of a VGA card and "attached an I/Q modulator to transmit arbitrary signals":https://wiki.das-labor.org/w/VGAtoBaseband.
16 27 laforge
17 3 steve-m
However, a major downside with regular graphics cards is that the generated signal of the RAMDAC is not entirely user controllable, as VGA uses "horizontal and vertical blanking":https://en.wikipedia.org/wiki/Video_Graphics_Array#Signal_timings, thus interrupting the signal. In comparison to competitor devices from DisplayLink, which resemble a classic graphics card with USB 2.0/3.0 interface, Fresco Logic took a different approach for their USB to VGA adapter, which they've also "patented":https://patents.google.com/patent/US20130346646A1/. Instead of having the framebuffer for the VGA DAC in the device itself, they use the memory of the host computer and continuously stream the display content via USB. This makes such adapters very cheap, as it essentialy reduces the adapter to a single chip without requiring framebuffer memory. The main drawback is that if the host CPU or USB bus is busy or congested, this results dropouts and flickering of the screen.
18 4 steve-m
19 3 steve-m
After reverse-engineering the USB protocol of the FL2000 in 2016, Steve Markgraf discovered through experimentation that it is possible to operate the FL2000 in a way that both horizontal and vertical synchronization are disabled, thus creating a continous stream of samples. This work resulted in osmo-fl2k, which so far was used to transmit low-power FM, DAB, DVB-T, GSM, UMTS and GPS signals.
20 7 steve-m
21 21 laforge
h2. Supported Hardware
22 1 steve-m
23 1 steve-m
h3. USB 3.0 VGA Dongles
24 1 steve-m
25 27 laforge
Only devices based on the Fresco Logic FL2000 chip are supported. Typically they are branded as "USB 3.0 to VGA" adapters, and are advertised with a maximum resolution of 1920 × 1080 for USB 3.0 and 800 × 600 for USB 2.0. Sometimes also 1920 × 1200 is advertised as maximum resolution (this mode only works with few xHCI controllers and enabled RLE compression). 
26 27 laforge
27 27 laforge
If they are advertised with 2048 × 1152 maximum resolution and support for Mac OS X, or only have a USB 2.0 interface, they contain a DisplayLink chipset and are *not* compatible with osmo-fl2k! The price range for the FL2000-based adapters is $5-15, whereas the DisplayLink devices typically cost more than $25. Also note that devices sold with USB type C connector contain a different chipset (e.g. Realtek RTD2166) and are just DisplayPort to VGA converters.
28 27 laforge
29 8 steve-m
Sources include Aliexpress, eBay and Amazon. The devices are available in various sizes, sometimes also with additional DVI or HDMI support. Two of the most typical devices are shown below.
30 8 steve-m
31 8 steve-m
{{thumbnail(fl2k_devices.jpg, size=700, title=FL2000 based devices)}}
32 6 steve-m
33 1 steve-m
{{thumbnail(fl2k_pcb_top.jpg, size=500, title=FL2000 PCB top view)}}
34 1 steve-m
35 6 steve-m
{{thumbnail(osmo-fl2k_pinout.png, size=500, title=FL2000 VGA pinout)}}
36 7 steve-m
37 6 steve-m
h2. USB Host Controller comparison
38 27 laforge
39 35 steve-m
The SDR/DAC performance in Megasamples per second depends on the xHCI controller and the host computer. Below are some benchmarking results for your reference.
40 35 steve-m
41 35 steve-m
You can benchmark your USB host controller by running:
42 35 steve-m
<pre>
43 35 steve-m
fl2k_test -s 162e6
44 35 steve-m
</pre>
45 35 steve-m
46 35 steve-m
Then you will get something like this:
47 35 steve-m
48 35 steve-m
<pre>
49 35 steve-m
real sample rate: 157023826 current PPM: -30717 cumulative PPM: -30717
50 35 steve-m
</pre>
51 35 steve-m
52 35 steve-m
In this example, the system cannot deliver more than 157 MS/s to the device (*3 DAC channels = 471 MB/s). You can then run fl2k_test again with a sample rate lower than what was determined as maximum to see if it works stable and to determine your clock error.
53 5 steve-m
54 5 steve-m
|*USB 3.0 Host controller*|*Achievable sample rate*|
55 36 steve-m
|Intel Corporation 8 Series USB xHCI HC (rev 04)|157 MS/s|
56 5 steve-m
|Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)|157 MS/s|
57 1 steve-m
|Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)|155 MS/s|
58 33 steve-m
|"Samsung Galaxy S5 (SM-G900F)":https://github.com/steve-m/android_kernel_samsung_klte/commit/24ed6c98a67d7c29ff705fd8cd71f104d1e8d6f7 msm-dwc3 (based on Synopsys DesignWare USB3.0 IP)|148 MS/s|
59 33 steve-m
|Odroid XU4 (based on Synopsys DesignWare USB3.0 IP)|147 MS/s|
60 5 steve-m
|ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller|140 MS/s|
61 5 steve-m
|Fresco Logic FL1100 USB 3.0 Host Controller (rev 10)|140 MS/s|
62 5 steve-m
|Fresco Logic FL1100 USB 3.0 Host Controller (rev 01)|136 MS/s|
63 5 steve-m
|Fresco Logic FL1009 USB 3.0 Host Controller (rev 02)|136 MS/s|
64 5 steve-m
|Etron Technology, Inc. EJ188/EJ198 USB 3.0 Host Controller|129 MS/s|
65 5 steve-m
|VIA Technologies, Inc. VL805 USB 3.0 Host Controller (rev 01)|123 MS/s|
66 5 steve-m
|Etron Technology, Inc. EJ168 USB 3.0 Host Controller (rev 01)|117 MS/s|
67 5 steve-m
|Renesas Technology Corp. uPD720202 USB 3.0 Host Controller (rev 02)|115 MS/s|
68 1 steve-m
|Intel USB 2.0 EHCI Controller|14 MS/s|
69 19 laforge
70 19 laforge
h2. Download
71 19 laforge
72 19 laforge
h3. Source Code
73 19 laforge
74 19 laforge
Source code is available from git.osmocom.org
75 29 steve-m
* web access: http://git.osmocom.org/osmo-fl2k
76 1 steve-m
* read-only clone access: @git clone git://git.osmocom.org/osmo-fl2k@
77 29 steve-m
78 29 steve-m
h3. Compiling
79 29 steve-m
80 29 steve-m
In order to compile and install the code, you first need to install the libusb headers if not already present:
81 29 steve-m
82 29 steve-m
<pre>
83 29 steve-m
# On distributions based on debian
84 29 steve-m
sudo apt-get install libusb-1.0-0-dev
85 29 steve-m
</pre>
86 29 steve-m
87 29 steve-m
Then you can continue with:
88 29 steve-m
89 29 steve-m
<pre>
90 29 steve-m
git clone git://git.osmocom.org/osmo-fl2k.git
91 29 steve-m
mkdir osmo-fl2k/build
92 29 steve-m
cd osmo-fl2k/build
93 29 steve-m
cmake ../ -DINSTALL_UDEV_RULES=ON
94 29 steve-m
make -j 3
95 29 steve-m
sudo make install
96 29 steve-m
sudo ldconfig
97 29 steve-m
</pre>
98 29 steve-m
99 29 steve-m
Before being able to use the device as a non-root user, the udev rules need to be reloaded:
100 29 steve-m
101 29 steve-m
<pre>
102 29 steve-m
sudo udevadm control -R
103 29 steve-m
sudo udevadm trigger
104 29 steve-m
</pre>
105 29 steve-m
106 25 steve-m
h2. Using the Software
107 23 laforge
108 25 steve-m
h3. Realtime WBFM transmission
109 1 steve-m
110 25 steve-m
With fl2k_fm it is possible to transmit wideband FM radio of your soundcard output.
111 1 steve-m
112 34 steve-m
You need to install the following additional tools:
113 34 steve-m
<pre>
114 34 steve-m
sudo apt-get install sox pv
115 34 steve-m
</pre>
116 34 steve-m
117 25 steve-m
First, you need to know the name of the monitor source of your audio output:
118 1 steve-m
119 30 steve-m
<pre>
120 30 steve-m
# pacmd list-sources | grep name | grep monitor
121 30 steve-m
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
122 30 steve-m
</pre>
123 1 steve-m
124 25 steve-m
To transmit the audio output as mono WBFM at 95 MHz, you can use the following command:
125 26 steve-m
126 30 steve-m
<pre>
127 30 steve-m
pacat -r -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | \
128 25 steve-m
pv -B 256k | \
129 25 steve-m
sox -t raw  -r 44100 -e signed-integer -L -b 16 -c 2 - -c 1 -e signed-integer -b 16 -t raw - \
130 25 steve-m
biquad 4.76963 -2.98129 0 1 0.78833 0 sinc -15k loudness 5 | \
131 30 steve-m
fl2k_fm - -s 130e6 -c 35e6 -i 44100
132 30 steve-m
</pre>
133 1 steve-m
134 1 steve-m
In this case, SoX is performing the 15 kHz lowpass filtering of the audio, stereo to mono conversion and FM pre-emphasis (with the biquad filter).
135 25 steve-m
pv is providing some additional buffering, but is optional.
136 25 steve-m
137 1 steve-m
To transmit stereo WBFM with RDS, the following command can be used:
138 1 steve-m
139 30 steve-m
<pre>
140 30 steve-m
pacat -r -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | \
141 1 steve-m
pv -B 256k | \
142 26 steve-m
sox -t raw -r 44100 -e signed-integer -L -b 16 -c 2 - -c 2 -e signed-integer -b 16 -t raw - \
143 26 steve-m
biquad 4.76963 -2.98129 0 1 0.78833 0 sinc -15k rate -h 228000 loudness 5 | \
144 30 steve-m
fl2k_fm - -s 130e6 -c 30e6 -i 228000 --stereo --rds
145 30 steve-m
</pre>
146 26 steve-m
147 26 steve-m
Now SoX also re-samples the audio to 228 kHz, which is required when using the RDS modulator.
148 30 steve-m
fl2k_fm accepts 16 bit signed raw PCM audio samples.
149 25 steve-m
150 22 steve-m
h3. GSM transmission
151 1 steve-m
152 1 steve-m
The GNU Radio flowgraphs as well as baseband samples required to transmit GSM and UMTS can be found at https://github.com/steve-m/fl2k-examples.
153 1 steve-m
154 1 steve-m
{{thumbnail(osmo-fl2k_gsm.jpg, size=500, title=GSM transmission using FL2K)}}
155 1 steve-m
156 25 steve-m
h2. Presentation Slides / Recording
157 25 steve-m
158 25 steve-m
On April 22nd, 2018, Steve Markgraf publicly released @osmo-fl2k@ at OsmoDevCon.
159 25 steve-m
* slides of the presentation available at http://people.osmocom.org/steve-m/fl2k_slides/osmo-fl2k.html
160 37 laforge
* video recording released at https://media.ccc.de/v/HWVZPK
161 22 steve-m
162 20 laforge
h2. Contact / Mailing List
163 20 laforge
164 20 laforge
All questions should be directed to the public osmocom-sdr@lists.osmocom.org mailing list, to which you can subscribe at https://lists.osmocom.org/mailman/listinfo/osmocom-sdr
165 28 laforge
166 28 laforge
h2. Legal Aspects / Keeping the RF Spectrum Clean
167 28 laforge
168 28 laforge
If you are operating a radio transmitter of any sort, particularly a DIY solution or a SDR transmitter, it is assumed that you are familiar with both the legal aspects of radio transmissions, as well as the technical aspects of it.  *Do not operate a radio transmitter unless you are clear of the legal and regulatory requirements*.  In most jurisdictions the operation of homebrew / DYI transmitters requires at the very least an amateur radio license.
169 28 laforge
170 28 laforge
The raw, unfiltered DAC output contains lots of harmonics at multiples of the base frequency.  This is what is creatively (ab)used if you use osmo-fl2k to generate a signal much higher than what you could normally achieve with a ~ 165MHz DAC without upconversion.  However, this means that the frequency spectrum will contain not only the one desired harmonic, but all the lower harmonics as well as the base frequency.
171 28 laforge
172 28 laforge
Before transmitting any signals with an FL2000 device, it is strongly suggested that you check the resulting spectrum with a spectrum analyzer, and apply proper filtering to suppress any but the desired transmit frequency.
173 28 laforge
174 28 laforge
Operating a transmitter with the unfiltered FL2000 DAC output attached to an antenna outside a RF shielding chamber is dangerous. Don't do it!
175 28 laforge
176 28 laforge
You have the following alternatives to broadcasting over the air:
177 28 laforge
* add proper output band pass filtering for your desired TX frequency, or
178 28 laforge
* operate transmitter + receiver in a shielded RF box / chamber, or
179 28 laforge
* connect transmitter + receiver over coaxial cable (with proper attenuators)
Add picture from clipboard (Maximum size: 48.8 MB)