Running Osmo-FL2K on VMWare Workstation Pro
Thank you to Sajjad Golchin Poor for writing in and letting us know about his success with getting Osmo-FL2K to run in WMWare Workstation Pro. Osmo-FL2K is a driver that enables very cheap VGA dongles to work as a SDR transmitter. Previously in our initial first tests with the FL2K-SDR we discovered that it wouldn't connect to a Virtual Box virtual machine, but theorized that it might work in the commercial (non-free) version of VMWare as that has known working USB3.0 support. Regarding his tests in VMWare, Sajjad writes:
...I started working with Virtualbox but as you said the USB 3.0 drivers have some problems and cannot disconnect dongle from the host and attach back to the guest.
So I went for VMWare Workstation Pro 14 and after booting the GNU radio live image and attaching the dongle and installing the drivers it worked perfectly at transmitting WBFM on the virtual machine. For permanent use of dongle I downloaded and installed Ubuntu 16.04 latest version and it is working flawlessly right now on the VMWare.
Something that I realized during my test was that the maximum achievable sample rate in VMWare environment is a little bit lower (by Max. 10Ms/s) than what was expected but I guess it is ok for most applications. (it may be because of VMWare USB 3.0 drivers.)
Another thing that I came up with was that some sample buffers may drop during the delivering process to FL2K and it can ruin the whole transmission process. for example, when I was transmitting WBFM after a few minutes it stopped transmitting without any warning/error in the console and the machine thought that it is delivering the samples right to the device. It happened to me both in the VMWare environment and GNU radio live bootable so it might be a software issue.
Sajjad also that he's able to achieve sample rates of at least 145 MS/s in VMWare, but that maximum rate that it locks at always seems to vary between 145 - 157 MS/s
We have been wondering if anyone else has been successful in getting an FL2K dongle to run smoothly in a virtual environment? If you have please post in the comments.
![Examples of compatible Osmo-FL2K USB to VGA Adapters.](https://www.rtl-sdr.com/wp-content/uploads/2018/04/fl2k_devices-700x341.jpg)
I instal osmo-fl2k on Windows 10 and when il try to release il, pthreadvc2.dll is not fou de. I found the dl file but i dont know in wich folder i must paste il. Can i get help please?
Does FL_2K work for USB 2.0 in Ubuntu? Any luck?
Broken links
Here you go: https://github.com/winterrace/fl2k_win
It works on windows 7 64 bit with the pthread dlls and the latest ZADIG from http://zadig.akeo.ie/
Of futher note (hopefully someone from osmocom will see this) the bug where the broadcast intermittently ceases in fl2k_fm under both an ubuntu virtual machine and directly ran as a windows exe seems to have something to do with cpu affinity and / or process priority – generally it starts spitting out the underflow message on stdout then the signal drops out and the process requires a restart.
– so as second approach I compiled it with MS Visual C++ 2015. This was a less direct approach since there is no compatible project contained. I started with a new project by adding the main cpp and h files (e.g. fl2k_fm.c, libosmo-fl2k.c, osmo-fl2k.h) and resolving any compile problems by including missing files / adjusting the include and linking directories and so on. Overall, it went quite smoothly. I mainly had to download and link against https://libusb.info/ and https://www.sourceware.org/pthreads-win32/ to make it work.
Regarding libusb, don’t use the precompiled lib version that comes with the download, this won’t work due to a structural change in VS2015. There are compile switches for backward compatibility removing these errors but the resulting exe files frequently crashed on exit. Instead, compile libusb from source (which is easy since it it comes with projects for the different VS versions) and link against that. This will remove the instabilities.
Sorry for the fragments, some Kind of anti-spam feature was nagging me
With one exception, the fl2k code itself can remain as it is. There are some warnings about several unused variables, unsafe casts or functions which you can ignore. One thing which needs to be fixed is a Sleep(0.5) within a WIN32-section. This has to be Sleep(500) since in Win32 Sleep takes its argument as integer in milliseconds.
This way I managed to compile working versions of all 4 binaries fl2k_file, fl2k_fm, fl2k_test and fl2k_tcp.
Compared with the cygwin binaries, the VS binaries had a significantly better performance in my tests.
can you upload the binaries somewhere pretty please?
Here you go:
https://we.tl/4XQX5j38dg (250 KB, online 7 days from now)
Password is “OSMO-FL2K”.
It would be nice to hear if it worked for you!
Oh, one more hint:
Of course, as with RTL-SDR, you have to use Zadig to install the libusb Driver.
In my case, it did NOT work to install the driver for “USB Video Device” (ID 1D5C-2000-00), because FL2K dongles are composite devices. You have to check “Options->List All Devices” and uncheck “Ignore Hubs or Composite Parents”. You will find the correct device with “(Composite parent)” in its name (ID 1D5C-2000 in my case, so without -00)
I just downloaded them but when I opening the files I get an error –> pthreadVC2.dll is missing
I downloaded _pthreadVC2.dll_ file from dllme.com but again when I trying to open the .exe file I get a 0xc000007b error.
Can you send me an e-mail at to discuss this issue together?
Sorry, I forgot to add this DLL to the zip file 🙁
You can download the correct DLL file here:
ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
Take it from the directory dll/x64
I tried the prebuilt binaries with Zadig WinUSB driver on my Windows 10 x64 machine, but it seemed to have some trouble with the libusb:
>fl2k_test
usb_claim_interface 1 error -12
libusb: warning [libusb_exit] some libusb_devices were leaked
libusb: warning [libusb_exit] application left some devices open
Failed to open fl2k device #0.
Any idea how to fix this?
I also had no success with the WinUSB driver (in my case under Win7).
All I can tell is that in runs using libusb (Win 7 as well).
However, in rare cases i get similar Errors. re-plugging mostly helps..
I did not test it under Win10, yet.
I have been running the binaries under win7 x64 with libusb0 (v1.2.6.0) and the only issue i have noticed so far – (noticed it in a ubuntu 15.10 VM as well) Is that after a random amount of time, the transmission abruptly ends / drops even though the fl2k_fm application is still running – I have been debugging this some and I have traced it down to an issue with processor affinity and / or process priority – I can start up fl2k_fm and pipe some audio to it using sox (under windows) and then immediately go in and set the process priority on fl2k_fm to realtime and I have been able to transmit this way for 16+ hours straight with no buffer underflow messages and no drop outs. The busier your cpu is, the more / quicker this dropout bug seems to bite. I’m sure some fixes need to be made in the code for both linux and windows in order to fix this bug. Also, if you crank the app up and with it transmitting, change the cpu affinity in task manager, the transmission will immediately drop out (hence why I think it is related to cpu affinity).
I just really hope somehow the above information gets picked up by the developers of the osmo-fl2k code for bugfix purposes!
Also, for those of you that would like to pipe audio into fl2k_fm using sox on windows, you will need:
https://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2-win32.zip/download
and something like virtual audio cable.
Would you upload the VS2015 projects to build these binaries?
Here’s the VS2015 project: https://we.tl/6hetlQ9buq . Just…
– open fl2k/vs15/fl2k.sln
– change between debug/release build setting (optional)
– build
and you will find the executables in fl2k\vs15\x64
You can also rebuild libusb if you wish, but a precompiled version is already included.
I also had a few issues with FL2K in VMware Workstation Pro (12 in my case). In particular it was slow to detect the FL2K device, and when using the transmit program, it would also randomly stop transmitting. I did manage to make it work for some brief demonstrational purposes though:
https://www.youtube.com/watch?v=G0tjzPHFFA8
What is the benefit of running FL2K in a virtualized Ubuntu?
I compiled the FL2K binaries for Windows so they run fine natively on my business PC.
By the way, I also observed such drop-outs when playing with the fm example. Seems to be some kind of bug / bothersome effect.
Can you please post the instructions to compile on Windows?
Thanks!
I don’t have my business PC here to check back exactly, but from my memory it was like this…
I managed to build exe files in 2 different ways:
– the most direct way was using https://www.msys2.org/ based on cygwin. I managed to build working exe files following some standard tutorials for CMAKE with MSYS2 found on the web. This matches the project files coming with FL2K so there were no special tricks beyond that…
This kinda worked but I had some starting problems and my debugging possibilities with these exe files were limited.
Has any one been able to get a FL2K VGA to transmit WSPR?
Can I use a FL2k as a antenna analyzer source?
Seasalt