LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Set Configuration is always set to 0

Hello,

 

I have a development board where I am developing firmware for a USBTMC device. This device will contain 2 configuration descriptors. In Labview, I issue a Control Out transfer to set the configuration to use per USB specification. Here is the code:

 

usbtmc_ctrl_out_setcnfg.PNG

 

The bmRequestType's bit-map field corresponds to a Host-to-Device (0), Standard (00), Device (00000) request type. The request, 0x09, corresponds to SET_CONFIGURATION and value is the configuration descriptor number I wish to set.

 

When I run this code and observe on my ellisys USB analyzer, I see that the configuration value being set is 0 instead of 2. See below:

usbcap_setcfg_0.PNG

The highlighted area of the table shows what was actually sent over the bus to my device. This is problematic for 2 reasons. One, the code is not setting the desired configuration as expected. Two, instead of setting to the default configuration (1), VISA is setting the configuration to 0 which translates as "not configured".

 

I'm using LabVIEW 2014 64-bit with NI VISA 14.0.

 

Can anyone give any guidance on how I might be able to properly set the configuration of my USBTMC device using LabVIEW and NI VISA?

 

Thanks!

0 Kudos
Message 1 of 9
(4,659 Views)

Amandion,

 

Could you run an I/O trace to see what the VISA thinks is being written to your device? I'll link a walkthrough here.

 

Performing a Good NI I/O Trace Capture for Debugging/Troubleshooting

http://digital.ni.com/public.nsf/allkb/282C5D41E2BA04F2862574BA007803B9

Austin
Staff Software Engineer
NI
0 Kudos
Message 2 of 9
(4,595 Views)

Attached is the nitrace file using the instructions you posted. It is also small enough that I can copy and paste here:

 

1. viParseRsrc (0x00001002, "USB0::0x20B1::0...MQFZkDt_::INSTR", 7, 0)
Process ID: 0x000027B8 Thread ID: 0x00002E14
Start Time: 10:34:26.073 Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

 

2. VISA Open ("USB0::0x20B1::0...MQFZkDt_::INSTR", False, 0, 0, "USB0::0x20B1::0...MQFZkDt_::INSTR")
Process ID: 0x000027B8 Thread ID: 0x00002E14
Start Time: 10:34:26.074 Call Duration 00:00:00.007
Status: 0 (VI_SUCCESS)

 

3. VISA USB Control Out ("USB0::0x20B1::0...MQFZkDt_::INSTR", 0, 9, 2, 0)
Process ID: 0x000027B8 Thread ID: 0x00002E14
Start Time: 10:34:26.081 Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

 

4. VISA Close ("USB0::0x20B1::0...MQFZkDt_::INSTR")
Process ID: 0x000027B8 Thread ID: 0x00002E14
Start Time: 10:34:26.081 Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

 

As far as I can tell, number 3 indicates that "VISA USB Control Out" thinks it is passing config value number 2. However, I can continue to see that a value of 0 is actually being sent over the bus with my USB analyzer.

 

An additional info is appreciated.

 

Thanks!

0 Kudos
Message 3 of 9
(4,573 Views)

Amandion,

 

It definitely seems like VISA thinks it's writing the command correctly. Are there any other VISA drivers on your system? Keysight also makes VISA drivers, do you know if you have those installed? Also, can you send any other commands? Another good troubleshooting step would be to try the same thing on a different computer.

Austin
Staff Software Engineer
NI
0 Kudos
Message 4 of 9
(4,537 Views)

Hi Austin,

 

Sorry for the delay.

 

I did have Agilent VISA drivers installed too. I uninstalled all VISA implementations from my computer including NI VISA. I then installed the latest NI VISA (v15.5) and re-tried my test. I saw the same results where the configuration value for SET_CONFIGURATION is being set to 0 no matter what I actually set it to in my VI. Other commands appear to work. Using the same "control out" primitive in the VISA palette for USB I can send SET_FEATURE to set RemoteWakeup on the device (bRequest = 3, wValue = 1) and my USB analyzer shows me that command is making it to the device as-is. I can also use the "control in" primitive to read the configuration descriptor and that works OK too. One other command that had unexpected results was SET_ADDRESS. I tried to set the address to 0 and my analyzer showed me that the command had bmRequestType modified to be a vendor request instead of a standard request. I suppose this is a safety measure as you would never want to change the address of your USB device in LabVIEW code, that is the responsibility of the USB hub.

 

I tried the same SET_CONFIGURATION example on a clean Windows 7 x64 virtual machine with LabVIEW 2014 x64 and NI VISA 15.5 installed. I saw the same results.

 

I then tried the same example on a MacBook with OS X Yosemite, LabVIEW 2014 and NI VISA 14.0 and it appears to work! My USB analyzer shows me that the configuration descriptor value I wish to set is what I actually set in the VI.

 

So it looks like this is a Windows problem? Can you give me any more insight on this?

 

Thanks!

0 Kudos
Message 5 of 9
(4,439 Views)

Amandion,

 

Is the version of LabVIEW on the Mac 64-bit as well?

Austin
Staff Software Engineer
NI
0 Kudos
Message 6 of 9
(4,399 Views)

Hi Austin,

 

LabVIEW 2014 on the MacBook is 64-bit where I am running the example. In case 64-bit VISA should be used should it not?

0 Kudos
Message 7 of 9
(4,376 Views)

Amandion,

 

It is possible that the 64-bit VISA driver is interacting strangely. Try setting the 32-bit driver as your primary driver. I'll link instructions for doing so.

 

Configuring 32-Bit NI-VISA as the Primary VISA

http://digital.ni.com/public.nsf/allkb/B283196340462DFD86257633006DC799

Austin
Staff Software Engineer
NI
0 Kudos
Message 8 of 9
(4,346 Views)

Amandion,

 

Actually, if the whole system is 64-bit you are right to be using the 64-bit driver. Earlier when you tried it on a virtual machine, was the virtual machine on the same Windows computer that is giving you issues? If possible, I would like you to try it on a completely different Windows computer instead of a virtual machine. It may also be worthwhile to uninstall and reinstall VISA drivers in case there's some sort of corruption in the driver.

Austin
Staff Software Engineer
NI
0 Kudos
Message 9 of 9
(4,340 Views)