LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't communicate with printer VIA USB cable


@Lchjxlz wrote:

Read 8 bytes or 2 bytes ,the same error return (Hex 0xBFFF0015)..thanks


That most likely means that the data you think you need to send to the device is not everything you need to use. Those messages might be embedded in a lower level protocol such as USB-HID. It also might be that it does expect the data to be send to a specific USB endpoint or not as a bulk data message.

 

Without the full programmer reference manual we can't do more for you.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 18
(1,098 Views)

i don't know why C# can receive the data the same command, please refer the command manual,thanks

0 Kudos
Message 12 of 18
(1,078 Views)

If as you said, how to do if might be embedded in a lower level protocol or specific USB endpoint?

0 Kudos
Message 13 of 18
(1,077 Views)

That "command manual" (that's quite an overexagaration for a simple Excel spreadsheet detailing some commands) only specifies the byte format of the commands, not how to transport them over USB.

 

USB is simply an electrical wire with defined logic and a low level bit serial protocol. A VISA USB Raw session directly targets that. No HID, VCP, MSS class protocol implementation on top of that for you. If your protocol is supposed to be transferred inside HID protocol frames, you have to implement that HID protocol too. But it could also instead use one of several dozen other USB class profiles, or to make matters more interesting also a Huawei proprietary profile. Nothing about any of this is detailed in your "Manual".

 

You mention C# which supposedly works, so can you show us that C# code. With that we might be able to guess what USB profile needs to be used and give you some more ideas. You may also have to read a few thousend pages of the according USB specification(s) to understand that profile.

 

One other point, I assume you try to do this for a realtime target or something? USB Raw was a nice idea when VISA was introduced but the computer landscape has changed since. Nowadays you can't install a device driver on any normal desktop OS without the driver being signed. That also applies to INF only drivers like a VISA USB Raw driver. Here the actual low level driver that VISA uses is already signed but Windows still won't let you install the INF file for a specific device unless this INF file is properly signed. This means that you either need a root authority signed certificate and in the case of Windows drivers you nowadays need to submit the signed driver to Microsoft who will countersign it and only then will Windows 10 allow you to install that driver. If it is indeed for a LabVIEW realtime target you are for now still in the green area, but even NI Linux RT may at some point inherit driver signing requirements from mainstream Linux.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 14 of 18
(1,055 Views)

Thanks ,can you help to share me some vi demo for usb HID ,VCP,MSS class,thanks

 

it's for realtime target,thansk

0 Kudos
Message 15 of 18
(1,033 Views)

@Lchjxlz wrote:

Thanks ,can you help to share me some vi demo for usb HID ,VCP,MSS class,thanks

 

it's for realtime target,thansk


No I can't.

 

But you can search on the internet for some information. 

 

https://zone.ni.com/reference/en-XX/help/370131S-01/ni-visa/usingnivisatocommunicatewithyourusbdevic... explains how you can set endpoints for bulk transfer as well as how use control transfers and interrupt transfers if your device should need them.

 

But be aware. VISA USB Raw was always an exotic beast in the VISA interfaces, rarely used by anyone since dealing with USB raw is terribly tricky. Add to that that VISA USB Raw didn't always work as intended, and due to the exotic nature of that interface, NI's resources to fix bugs in it where always very limited.

 

Today with the driver signing requirement this interface is basically nearly useless and NI's motivation to spend any time on it is pretty much non-existent.

 

You haven't:

 

- told us on which platform you want to use it and why

- posted the actual VIs you are using instead of just images

- shown us the C# code that supposedly works

 

Without these things I consider this topic closed as far as I'm concerned.

 

And just for your information:

 

You claimed that you are sure to have send binary data. But the image "read with test panel.png" that shows you trying things with the VISA test panel clearly and absolutely undoubtedly shows that you have NOT done that. you send the literal hex string characters, not the hex codes, as can be also seen in the number of bytes transferred which is 27 and NOT 14.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 16 of 18
(1,026 Views)

Thanks, as you mentioned , what method to communicate with USB of Labview?it's rarely to use VISA to communicate via USB.

 

for C# , i have only the .exe tool ,please kindly refer ,thanks

0 Kudos
Message 17 of 18
(1,018 Views)

Well if you only have an exe tool, then don't talk about a C# example. It does not matter in what language the exe is written, if someone has the FULL information on how to do something he can talk to the device in pretty much every language.

 

But we don't have the full information! Whoever gave you that Excel spreadsheet clearly just wanted to get rid of you as it fails to document the lower level details of talking to the device over USB. Without more detailed information and/or example source code in C, C#, Python, Lua or whatever there is really nothing anybody here can do.

 

And VISA can be perfectly used for USB devices that implement the USB TMC (Test and Measurement Class). In that way they appear almost like a GPIB device to LabVIEW. It can also be used for USB devices that implement the USB CDC (Communication Device Class) as that will be picked up by the OS as serial port and then accessible through VISA ASRL sessions. It can even be used for proprietary USB devices such as FTDI serial port controllers, who have their own driver that installs them as a serial port in the OS and they too will be picked up as VISA ASRL resource.

 

But USB Raw is indeed an old and quite cumbersome variant nowadays. As explained it is very useless on modern OSes, including Windows 7 and later due to driver signing requirements. Even if you manage to get this working in LabVIEW through VISA USB Raw, you can NOT distribute such an application to other users for use on any Windows or Mac OS X computer without going through the according driver signing procedure or requiring them to switch the OS into a special developer mode that disables signed driver requirements. And any company administrator will be in a hot rage if a user asks them to have their computer switched to such a mode.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 18 of 18
(1,015 Views)