Definition of USB Interfaces is different in Windows


#1

Hi,
I am writing a Windows interface for USRP using libusb-win32. However, I
am
facing a problem. When I run the testlibusb wizard (a utility tool for
displaying information about USB devices) in Windows, it tells me that
the
USRP has only one interface: Interface 0. This interface has three
alternative settings. Each having 6 endpoints. These interfaces are
different than those defined in usrp_interfaces.h. Please let me know
which
interface should I be using as the RX and TX interface in Windows?

Thanks.


#2

Ujala Q. wrote:

Hi,
I am writing a Windows interface for USRP using libusb-win32. However, I am
facing a problem. When I run the testlibusb wizard (a utility tool for
displaying information about USB devices) in Windows, it tells me that the
USRP has only one interface: Interface 0. This interface has three
alternative settings. Each having 6 endpoints. These interfaces are
different than those defined in usrp_interfaces.h. Please let me know which
interface should I be using as the RX and TX interface in Windows?

Is this before you download the data files to the USRP? If so, I think
the additional endpoints are configured after you load the firmware into
the FPGA.

Philip


#3

On Fri, Apr 24, 2009 at 01:01:39AM +0600, Ujala Q. wrote:

Hi,
I am writing a Windows interface for USRP using libusb-win32. However, I am
facing a problem. When I run the testlibusb wizard (a utility tool for
displaying information about USB devices) in Windows, it tells me that the
USRP has only one interface: Interface 0. This interface has three
alternative settings. Each having 6 endpoints. These interfaces are
different than those defined in usrp_interfaces.h. Please let me know which
interface should I be using as the RX and TX interface in Windows?

Thanks.

Are you sure you’re plugged into a USB 2.0 port?

The USRP requires USB 2.0.

Eric


#4

Yes, I am sure. Because I am running USRP on Ubuntu with GNU Radio on
the
same computer and usb port and it is running absolutely fine.
I read another thread on a forum, which gives same interfaces and
endpoint
numbers on Windows:
http://www.nabble.com/removed_email_address@domain.invalid

I get the exact information on Windows as he gets them on Fedora 9.

Thanks.


#5

On Fri, Apr 24, 2009 at 05:27:06PM +0600, Ujala Q. wrote:

I connected the USRP to the USB 2.0 port and obtained the information of the
device using the lsusb -v command in Ubuntu. The output is attached below.
Even in Ubuntu, the interfaces and endpoints come out to be different than
those defined in usrp_interfaces.h. So what is going on here? Which are the
actual interfaces and end points?
Bus 005 Device 003: ID fffe:0002

As Philip pointed out, you haven’t loaded the FX2 firmware yet.
You can tell this by looking at the bcdDevice field. When it’s got
the “real” firmware loaded, it has a non-zero value to the left of the
radix point.

Here’s what it looks like after you load std.ihx:

Bus 001 Device 011: ID fffe:0002
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
idVendor 0xfffe
idProduct 0x0002
bcdDevice 1.02
iManufacturer 1 Free Software Folks
iProduct 2 USRP Rev 2
iSerial 6 00000000
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 50
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 3 Command & Status
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 4 Transmit Path
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 5 Receive Path
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0001
Self Powered


#6

Thanks for pointing out the problem. But doesn’t the FX2 firmware
download
automatically? Isn’t it a part of the USRP’s boot sequence? How can I
load
the firmware then to get rid of this problem?


#7

I connected the USRP to the USB 2.0 port and obtained the information of
the
device using the lsusb -v command in Ubuntu. The output is attached
below.
Even in Ubuntu, the interfaces and endpoints come out to be different
than
those defined in usrp_interfaces.h. So what is going on here? Which are
the
actual interfaces and end points?
Bus 005 Device 003: ID fffe:0002
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
idVendor 0xfffe
idProduct 0x0002
bcdDevice 0.02
iManufacturer 0
iProduct 0
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 171
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 1
bNumEndpoints 6
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x88 EP 8 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 2
bNumEndpoints 6
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x88 EP 8 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 3
bNumEndpoints 6
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x88 EP 8 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)

Thanks.


#8

Hi.

I am having a similar problem getting two USRPs to run on one computer
on NetBSD. gnuradio can only run one USRP at a time. It can only run
USRP #0 and when I create a usrp source/sink with which=1 it says
“Unable to find USRP #1”.

Are you saying more needs to be done than specifying which=1?

Where are these constructors mentioned:
usrp_basic, usrp_basic_rx, usrp_basic_tx, usrp_standard,
usrp_stardard_rx, usrp_standard_tx.

I ran the gnuradio-examples multi_usrp_oscope.py as well. It also is
“Unable to find USRP #1”, so I think there is an incompatibility with
gnuradio/NetBSD regarding multiple USRPs.


#9

On Sat, Apr 25, 2009 at 01:23:40AM +0600, Ujala Q. wrote:

Thanks for pointing out the problem. But doesn’t the FX2 firmware download
automatically? Isn’t it a part of the USRP’s boot sequence? How can I load
the firmware then to get rid of this problem?

If you use the C++ interface we provide, then yes, it does get loaded
by the library. Since you’re not, you’ll need to load it yourself.
I suggest that you go back and look at the code for these
constructors: usrp_basic, usrp_basic_rx, usrp_basic_tx, usrp_standard,
usrp_stardard_rx, usrp_standard_tx.

Are you sure you don’t want to create a C-callable wrapper for the
known correct C++ code?

Eric


#10

Hi,As suggested by you, I am now using the usrp_standard.h to implement
USB
2.0 interface for Windows. However, I am facing a problem.

The function usrp_loads_standard_bits() in usrp_prims library loads the
FX2
firmware by calling the following two functions:
get_proto_filename
find_file

In short are we trying to access the std.ihx firmware file by calling
these
two functions? In Windows ofcourse my firmware would not be lying in the
directory specified by std_paths.h (/usr/local/share). Shall I change
the
directory path in std_path.h library, to some path where I have
downloaded
std.ihx myself? Also, I cannot use functions such as access (path, R_OK)
in
Windows, because it is a function of unistd.h which is only available
for
Unix/Linux. How should I go about this problem, so that the firmware can
be
loaded into the FX2 through through Windows platform?

Thanks.


#11

Eric, I tried implementing the given task of developing a USB interface
for
Windows by using the following main program that is written for Linux
and
successfully executes on it. However, when I tried to use the same code
with
Windows I faced a problem. The code includes usrp_standard.h, which
includes
further libraries, and like this libraries are nested within libraries.
It
became very cumbersome for me to download all those usrp libraries
manually.
Plus, there are some libraries that work with Linux only, like sys/cdefs
etc. So only after trying this approach and failing I switched over to
the
approach of extracting only specific functions from usrp libraries. Is
there
any other approach that I can try?
#include “usrp_standard.h”
// Dumy Function to process USRP data
void process_data(int buffer)
{
}
#define SAMPELS_PER_READ (512) // Must be a multiple of 128
int main (int argc, char **argv)
{
bool loopback_p = false;
bool counting_p = false;
bool width_8_p = false;
int which_board = 0;
int decim = 8; // 32 MB/sec
double center_freq = 0;
int fusb_block_size = 0;
int fusb_nblocks = 0;
int nchannels = 1;
int gain = 0;
int mode = 0;
int noverruns = 0;
bool overrun;
int total_reads = 10000;
int i;
int buf[SAMPELS_PER_READ];
int bufsize = SAMPELS_PER_READ
4;

if (loopback_p) mode |= usrp_standard_rx::FPGA_MODE_LOOPBACK;

if (counting_p) mode |= usrp_standard_rx::FPGA_MODE_COUNTING;

usrp_standard_rx *urx = usrp_standard_rx::make (which_board, decim, 1,
-1,
mode, fusb_block_size, fusb_nblocks);

if (urx == 0)
{
fprintf (stderr, “Error: usrp_standard_rx::make\n”);
exit (1);
}

if (width_8_p)
{
int width = 8;
int shift = 8;
bool want_q = true;
if (!urx->set_format(usrp_standard_rx::make_format(width, shift,
want_q)))
{
fprintf (stderr, “Error: urx->set_format\n”);
exit (1);
}
}
// Set DDC center frequency
urx->set_rx_freq (0, center_freq);
// Set Number of channels
urx->set_nchannels(1);
// Set ADC PGA gain
urx->set_pga(0,gain);
// Set FPGA Mux
urx->set_mux(0x32103210); // Board A only
// Set DDC decimation rate
urx->set_decim_rate(decim);
// Set DDC phase
urx->set_ddc_phase(0,0);

urx->start(); // Start data transfer

printf(“USRP Transfer Started\n”);
// Do USRP Samples Reading
for (i = 0; i < total_reads; i++)
{
urx->read(&buf, bufsize, &overrun);
if (overrun)
{
printf (“USRP Rx Overrun\n”);
noverruns++;
}
// Do whatever you want with the data
process_data(&buf[0]);
}

urx->stop(); // Stop data transfer
printf(“USRP Transfer Stoped\n”);

delete urx;
return 0;
}

Thanks.