orko Posted February 21, 2009 Report Share Posted February 21, 2009 Hey all, Well, I finally did it. I'm deep into the bowels of NI-VISA and trying to understand it's USB RAW functionality. I have a device with one interface, and three endpoints (EP2 & 4 are BULK IN and EP3 is BULK OUT), not including the default Control EP(0) of course. I set NI's USB RAW driver up by creating an INF file through the driver wizard, and can send BULK OUT requests and request BULK IN transfers just fine over EPs 2&3. My troubles start when I try and set the BULK IN pipe to 84, and read from the other pipe. I'm using a protocol analyzer to see the traffic, and see that everything looks good before I set the "BULK-IN Pipe" VISA property node to 84. As soon as I try and switch over, though...I see a CLEAR_FEATURE HALT_ENDPOINT setup request go to EP0... and I never see the BULK-IN requests from EP4...the VI just sits there and times out repeatedly and I see no traffic after that point to the device. I was hoping that someone else had tried to perform BULK IN transfers on more than one pipe. The finished app will be reading from 2 or more pipes asynchronously, so I want to get this figured out... This is a pretty simple program, although I don't have it here at home. If it would help in solving this, I could upload a sample tomorrow. Basically, I'm opening up a VISA USB RAW session, setting the VISA BULK-IN pipe to 82 and the BULK-OUT pipe to 3. Then I do some transfers using VISA WRITE/READ (which work). Then set the VISA BULK-IN pipe to 84...and try to read again. That's when I see the weirdness I described above. Oh, and just for clarity...the device works with the native device driver on all endpoints. And no, just using that driver is not going to be good enough Thanks for any pointers or suggestions! Quote Link to comment
andymatter Posted February 21, 2009 Report Share Posted February 21, 2009 It sounds like something is causing VISA to reset EP4. You *should* be able to request data from the endpoint at this time, so it sounds weird to me that transfers won't work. Have you tried opening duplicate VISA sessions, each dedicated to a single endpoint instead of switching between each of them in one session? I'm currently mucking around with USB and LabVIEW using a third-party driver. I actually haven't used NI's VISA USB. After I started reading about it and asked NI a few questions, I was frightened away by its lack of features, unclear functionality and jargon that doesn't completely follow that of the USB world. But, hey, don't let me scare you away from it. I would be very interested in hearing about your successes/failures. As long as you're not hoping to stream huge gobs of data in real time, I'm sure you can get VISA to behave. Quote Link to comment
orko Posted February 22, 2009 Author Report Share Posted February 22, 2009 QUOTE (andymatter @ Feb 20 2009, 01:33 PM) It sounds like something is causing VISA to reset EP4. You *should* be able to request data from the endpoint at this time, so it sounds weird to me that transfers won't work. That's what I'm thinking. For some reason I'm seeing these odd HALT_ENDPOINT control msgs sent instead of the Bulk-In reads that I'm commanding from LabVIEW. QUOTE (andymatter @ Feb 20 2009, 01:33 PM) Have you tried opening duplicate VISA sessions, each dedicated to a single endpoint instead of switching between each of them in one session? Tried that today actually. Still the same problem. I'm actually forced to pursue other methods of Bulk transfers using a .NET driver I had lying around. It won't be easy to get it to fit my needs, but so far I'm getting nowhere with the native LabVIEW USB read/writes on more than one endpoint. Thanks for your comments! Quote Link to comment
shoneill Posted February 22, 2009 Report Share Posted February 22, 2009 QUOTE (orko @ Feb 21 2009, 08:46 AM) That's what I'm thinking. For some reason I'm seeing these odd HALT_ENDPOINT control msgs sent instead of the Bulk-In reads that I'm commanding from LabVIEW.Tried that today actually. Still the same problem. I'm actually forced to pursue other methods of Bulk transfers using a .NET driver I had lying around. It won't be easy to get it to fit my needs, but so far I'm getting nowhere with the native LabVIEW USB read/writes on more than one endpoint. Thanks for your comments! Personally I think VISA USB RAW is quite buggy. I've got an issue open at the moment with NI support on some control transfers. Can you post an image of the code and a protocol analyzer example? Shane. Quote Link to comment
andymatter Posted February 25, 2009 Report Share Posted February 25, 2009 QUOTE (orko @ Feb 20 2009, 11:46 PM) ...I'm actually forced to pursue other methods of Bulk transfers using a .NET driver I had lying around... Oooh, .NET you say... It wouldn't happen to be Cypress Semiconductor's CyUSB driver, would it? That's the one I'm currently using. It works perfectly in LabVIEW if you're not doing sustained high-bandwith transfers (even though the driver was designed to do so). Setting everything up and transferring data using their simple XferData() method is pretty easy. I could even share a quick n' dirty example with you if you're interested. The problem I ran into, however, was when it was discovered that the device we (me & the company I work for) are building needs to output data faster than can be transferred using the XferData() method. CyUSB does provide more advanced methods for performing overlapped (asynchronous) transfers needed for higher-bandwidth streaming. Cypress' C# examples that come with the driver in the free SuiteUSB.NET 2.0 package use these methods and work just fine. The situation gets ugly when you attempt to call these advanced transfer methods in LabVIEW. I spent a LONG time trying to figure out what is causing these methods to fail in LabVIEW, but I wasn't able to figure it out, as the problem appears to be somewhere between LabVIEW and Windows. I couldn't figure out how to troubleshoot that sort of thing (advice?). I'm currently attempting to wrap up all my high-speed transfers using the advanced methods into a DLL, so as to keep them in their native .NET world when I want to use them. So far, my DLL crashes LabVIEW. Yeehaw. If you're not using CyUSB, then may I ask what driver it is? What does it cost? Does it provide data-tranfer methods that break up a transfer into its separate parts (i.e. something like BeginTransfer(), WaitForTransferCompleteCallback(), FinishTransfer())? I eagerly, droolingly await your reply. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.