[hpsdr] Ozy and WinUSB

Bill Tracey bill at ewjt.com
Thu Jul 23 22:50:19 PDT 2009


Hi Alberto,

Happy to hear your getting into WinUSB.  In the long run this is 
probably the right thing for Windows platforms.

I think the endpoint count does not include the default ep0 control 
endpoint which is the only one configured by default when the FX2 on 
Ozy is repowered.    For info on the default configuration of the FX2 
after power up take a look at chapter 3 of the Cypress FX2  tech ref 
(http://www.keil.com/dd/docs/datashts/cypress/fx2_trm.pdf).      One 
(admittedly tedious) thing you could do to see if your WinUSB code is 
doing what you expect is to load Ozy with the existing libusb base 
code,  uninstall the libusb based driver, unplug the USB cable from 
Ozy (leaving Ozy powered so the firmware stays loaded).  Plug USB 
cable back in - tell Windows to use WinUSB based driver now and run 
your code.  You should see 3 endpoints at this point.

To see how to load the FX2 firmware take a look at loadFW.c  and 
USB.c n 
svn://206.216.146.154/svn/repos_sdr_hpsdr/trunk/OzyUtil-NativeWin/src. 
The code basically puts the CPU into rest , loads the RAM with the 
firmware image  and then takes the CPU out of reset.   This will 
cause the FX2 to reenumerate with the PC and start running the code 
and configuration downloaded.  Section 3.8 of the tech ref gives an 
overview of the process.

This is all done using the default control endpoint, so I think it 
will work even with the WinUSB claiming there are no endpoints since 
it looks like its endpoint count does not  include the default 
control endpoint.   Taking a quick look as the WinUSB docs,  I'd 
guess you need to use WinUsb_ControlTransfer  calls for this.

Once the FX2 is loaded, the FPGA needs to be loaded.  For this see 
loadFPGA.c and OZY.c.   The FPGA  loading is done by sending vendor 
specific control messages to the firmware  on ep0  and the firmware 
then configures the FPGA.  If you want to look at the code running in 
the FX2 it is 
at  svn://206.216.146.154/svn/repos_sdr_hpsdr/trunk/OzyFX2 - although 
I don't think any change should be needed to it to go to WinUSB.

Cheers,

Bill (kd5tfd)


At 04:38 PM 7/23/2009, Alberto I2PHD wrote:
>***** High Performance Software Defined Radio Discussion List *****
>
>I started to write a WinUSB interface to talk to Ozy. I am doing 
>this essentially for two reasons :
>
>1) The current libusb interface won't likely be supported by the 
>64-bit version of the upcoming Windows 7,
>    while WinUSB  will. At least M$oft guarantees this.
>
>2) I know nothing about USB nor WinUSB, and this looks like a good 
>way to learn something...:-)
>
>So far, I have been able to code an INF file, and to install 
>successfully the drivers needed by WinUSB.
>Additionally, I wrote a small sample code that successfully issues the
>
>GetDevicePath, SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces
>OpenDevice
>WinUsb_Initialize
>WinUsb_QueryDeviceInformation
>
>calls (not necessarily in this order). As a last thing I issue the 
>WinUsb_QueryInterfaceSettings API,
>to know the characteristics of the USB device, i.e. the Ozy card.
>
>And here is where I am having problems, and the reason for making this post.
>
>That API fills a structure of type USB_INTERFACE_DESCRIPTOR, which 
>has a field that contains the number
>of the endpoints of the device. I find that field always set to zero.
>
>Being totally ignorant, as said, of the USB architecture, I made an 
>hypothesis which could be totally
>wrong, so I ask those expert in this field.
>Does that depend from the fact that the firmware hasn't (at that 
>point) been loaded yet into the Ozy FPGA ?
>If this is true, how can I load that firmware into the FPGA using 
>WinUSB (libusb is out of the picture),
>given that I have no endpoints to contact ?
>
>Please enlighten me, this USB stuff is a bit confusing, at least initially...
>
>Thanks
>
>73  Alberto  I2PHD



 1248414619.0


More information about the Hpsdr mailing list