WinUSB Notes

From HPSDRwiki

Jump to: navigation, search
THIS MATERIAL SHOULD BE CONSIDERED AS OBSOLETE, BUT INFORMATIVE
THAT IS BECAUSE libusb0 HAS BEEN PUBLISHED BY openhpsdr.org AS A SIGNED DRIVER
PLEASE SEARCH THE FORUM'S ARCHIVES FOR MORE INFORMATION ON THE TOPIC OF LIBUSB0

Here are the signed libusb0 drivers:

 svn://svn.openhpsdr.org/svn/repos_hpsdr_kiss/branches/K9TRV/libusb0-driver-signed

Please see my listserver posting on 12 May 2010 in the archives...

BECAUSE OF THIS, I HAVE STOPPED ANY MAINTENANCE ON THE WinUSB version of KISS

Update, 28 July 2010, George Byrkit, K9TRV

This page contains information on using WinUSB with HPSDR hardware.

First, let's all be clear that WinUSB used as a driver replaces libusb0 used as a driver for some particular device, like the Ozy board. If you install WinUSB as the driver for Ozy, libusb0 is no longer the driver. So applications that use libusb0 (like PowerSDR, until Bill Tracey KD5TFD finished porting PowerSDR to WinUSB, or like CWSkimmer, which use libusb0 to speak to OZY) are not able to coexist with my branch of KISS. My branch of KISS Konsole uses WinUSB.

So it's an either/or proposition. If you need libusb0, and can install libusb0 as the driver, and can run PowerSDR, you want to use Phil VK6APH's branch of KISS Konsole. His branch is the 'original', and is considered to be the main development branch. I try to keep step with his branch, and feed common bugs and hopefully their solutions back to him. I'm keeping step best as I can with Phil's development work using the HERMES board, as well.

It seems that WinUSB is needed to use KISS (thus my branch is needed...) on Windows 64 bit OS versions, such as Vista 64 bit and Windows 7, 64 bit. Some have reported trouble using libusb0-based KISS on Windows 7 32 bit. These people report that my WinUSB branch does work fine on Windows 7, 32 bit (with WinUSB installed as the driver). This problem on 32 bit Vista and 32 bit Windows 7 has recently (approx 15 Jan 2010) traced to a problem in HPSDR_USB_LIB_V1.dll by Bill Tracey (KD5TFD), who has fixed this problem! He has mentioned this on the reflector (hpsdr mailing list), and has posted a fixed library. Phil is testing and updating his development branch to include this fixed file. Those of you using Vista 32 bit and Windows 7 32 bit may well wish to use that version and not my WinUSB version! That way, you can use both PowerSDR and KISS, and optionally use CWSkimmer and other similar applications.

Is there anything that WinUSB can do that libusb0 cannot do, other than work on a 64 bit machine? It seems that, yes, there is at least one advantage to WinUSB. WinUSB is able to detect an OZY or HERMES board that is plugged in or powered on AFTER KISS has been launched. Libusb0 required that Ozy be plugged in and powered on BEFORE launching/running KISS (or PowerSDR). So this is an advantage. Is there any disadvantage? I think that yes, there is. I don't have data to back it up, but libusb0 seems more 'performant' than WinUSB. What do I mean by that? I think that libusb0 has fewer delays and may use a larger blocksize for transfers than WinUSB does. What is the evidence? KISS using libusb0 has no troubles doing the normal (band) spectrum display, along with the full bandwidth display. I found that I had to reduce the number of data points (samples) for the full spectrum display from 8192 to 4096, to get rid of distorted, chopped audio. I think that Alberto came to the same conclusion.

WinRad origins

The first thing that you will need is the WinUSB driver package from Alberto, I2PHD, from www.weaksignals.com. Alberto I2PHD's WinRad site Go to his website and download his WinRad package, which will give you his WinUSB driver installer. Using this installer should let you install WinUSB as the driver for your hardware on Windows XP, Vista and Windows 7, whether you have a 32 bit OS, or Intel/AMD 64 bit OS (x86 architecture) or Intel Itanium IA64 64 bit OS versions of windows installed.

You will also be able to use WinRad, until Bill KD5TFD ports PowerSDR to WinUSB.

Alberto has some very good notes on installing the driver, or replacing libusb0 with WinUSB, as part of his package. I suggest that you read his notes and follow his directions. I think that you have to install WinUSB twice for Ozy, once when Ozy contains no programming, and once when Ozy has has its firmware downloaded. You can also find these drivers, newly fixed so that 64 bit Intel/AMD x86 OS install works, in the WinUSBDrivers folder under my SVN archive listed below. You will still want Alberto's instructions...

There were errors in the 64 bit installers, due to an error Microsoft had in their 'Using WinUSB' document. I consulted with Microsoft, who made me aware of the errors. I communicated these facts to Alberto I2PHD and Phil N8VB, who are updating their .inf files to fix the 64 bit x86 architecture processor installations correspondingly. Some teamwork and mutual communications was involved. Everyone has a better result due to the work that was done co-operatively.

Other interesting projects and info on WinUSB

1) The SourceForge (www.sourceforge.net) project called LibUsbDotNet. You can download both source and binary. This is a project that allows .Net code to use either libusb0 or WinUSB, without the application program having to know which driver is installed for the hardware. This is not yet being used by KISS or HPSDR, but does hold some promise on Windows for this option. Using LibUsbDotNet would allow a single version of KISS, for example, to exist that would work with either libusb0 or WinUSB.
2) the website http://www.lvr.com/winusb.htm, which contains information on WinUSB, USB in general, sample code, much other information and sample code on things like Serial Ports, Parallel Ports, ethernet, and more. Its maintainer, Jan Axelson, has also written a number of books on these topics. I found his winusb_cs to be very helpful to study in porting KISS and its support programs from libusb0 to WinUSB. Jan Axelson's website

What has been ported from libusb0 to WinUSB?

1) Phil Harman VK6APH's project KISS Console
2) supporting programs like loadfw.exe, loadfpga.exe and writei2c.exe
3) there is also a Visual Studio 2008 project called WinUSBAPI that is Alberto's Borland C++ Builder code ported to VS2008 C++. It doesn't yet have all the methods that the C# project WinUSBManaged that I wrote does. Hopefully, I'll find the time to back-port those methods from WinUSBManaged to WinUSBApi.

The purpose of the 'supporting programs' (which also use winusbmanaged.dll) is to replace the current versions that use libusb0. With these, you can update the versions in your usbblaster-binaries folder so that you can still update the firmware in Penelope, Mercury and other boards. You may have multiple places where these are needed. Up-to-date copies are in my "KISS Konsole\bin\release" and "Kiss Konsole\bin\debug" folders, so that initozy11.bat that is in those folders will continue to work.

Where can I find this new code that uses WinUSB? Try this svn path (K9TRV's KISS Branch):

svn://svn.openhpsdr.org/svn/repos_hpsdr_kiss/branches/K9TRV

So, you're going to be running or recompiling the KISS code on a 64 bit machine?

If so, then you'll need to check the 'fftw' subfolder in my branch for the 64 bit dll. I've provided the installers for the 32 bit and 64 bit fftw dlls, from the http://www.fftw.org/ website. Please either install the 64 bit package and replace all versions of the 32 bit dll with the dll it installs. Much easier is to copy and rename the libfftw3f64.dll to libfftw3f.dll, especially in the bin\release and bin\debug folders of my version of the KISS Konsole project. I've already placed libfftw3f64.dll in those directories for your convenience. Replacing the current libfftw3f.dll is then all you need to do. I suggest that you rename the current libfftw3f.dll file (to anything else...), then copy libfftw3f64.dll and rename the copy to libfftw3f.dll. Thanks to Dr. Hermann von Hasseln, DL3HVH, for this information!

The alternative to this renaming is to rebuild SharpDSP, but ONLY after editing its file DSPBuffer.cs to change the line containing library_name = "libfftw3f.dll" to library_name = "libfftw3f64.dll".

The issue here is that both KISS and Sharp_DSP are built with the 'mixed cpu' setting (see Configuration Manager), and thus when run on a 64 bit system, 64 bit code is generated (at run time! you don't even need to recompile! That's how .NET framework programs work...), and all DLLs that are called MUST BE 64 bit dlls. If you will tolerate 32 bit code on your 64 bit system, you can use the Configuration Manager and change the cpu type for BOTH KISS and Sharp_DSP to 'x86'. This will cause only 32 bit code to be generated. This will allow the 32 bit versions of FFTW as well as libusb0 to be used...

So I cannot test the above, as I don't have a 64 bit OS installed to check it on. You can also find processor selection on the Build page of a project's properties. Double-click on Properties in the Kiss Konsole project in the solution explorer pane. This will bring up some tabbed dialogs in the main window. Select the 'build' tab. Note the combo-box to the right of the text saying 'Platform target'. This will by default be set to 'Any CPU'. You could choose to set it to 'x86' to force 32 bit code to be generated. Selecting 'x64' would force 64 bit code to be generated, which wouldn't work on 32 bit OS installations, and would require all 64 bit dlls be available (libusb0, probably and libfftw3f for 64 bit for sure!). I'd be willing to be that no one has an Itanium CPU, so please don't select that one...

If you change the setting for KISS Konsole, make SURE that you make the setting for Sharp_DSP match! Otherwise, things just won't work... In my KISS branch, the Sharp_DSP project is part of the KISS Konsole solution, so this is easier to do. If you are using Phil's branch, you either need to add the Sharp_DSP project to the KISS solution, or make sure that you open the Sharp_DSP solution and make the needed changes in the Sharp_DSP project build settings and rebuild.

Personal tools