Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

viWrite and RAW USB

Hello,

I would like to create my own USB 2.0 Raw device. To achieve this, I will use a Cypress component which handles the USB 2.0 protocol on my device.
To link my device with Labview, I am planning to use VISA and an own communication protocol.

I think I have to do something in my programm like:

viWrite(instr, "request_read", 12, &output)

Where "request_read" is a command string that have to be recognised by my device.
My questions are :

Does VISA will send the string as is over USB or will it add something like a BULKOUT-Header (like with the USBTMC protocol) or anything else ....?

Does the fact that I define my device as a RAW device instead of an INSTR Device (with the VISA Driver Developer Wizard) will change something i
n the behavior of viWrite (and viRead, viOpen...)?

Does it exist any sample programms describing how to code a USB Raw communication?

Thanks for any help,

Grégory.
0 Kudos
Message 1 of 7
(5,076 Views)
Gregory:

You're on the right track.

Raw means exactly that - VISA Write doesn't do anything except send it to the bulk OUT pipe. This is pretty much the same thing that happens on Serial or TCPIP SOCKET resources.

Technically, there may be other bits that the lower-level drivers send across the wire in those cases (the stop and parity bits for ASRL INSTR, the TCPIP headers for TCPIP SOCKET), but the "data stage" per se is unmodified. So what your device *firmware* sees is exactly what you sent in VISA Write. I hope this makes sense.

There are no sample programs yet, because it's unique for each device - with your Cypress board, you can make it understand any protocol you want. It's hard to write a sample program that anyone could look at
and make sense of, if they can't use it as-is with their device.

Dan Mondrik
National Instruments
Message 2 of 7
(5,074 Views)
First of all, thanks for your quick and good answer.

I think a sample program would be good to show how to initialise the programm. For example, I looked the introductory programming examples in the NI-VISA User Manual and the first example is:

int main(void)
{
ViStatus status;
ViSession defaultRM, instr;
ViUInt32 retcount;
ViChar buffer[MAX8CNT];

.....
}

I think that for a USB Raw device, it is not the same initialisation. (Perhaps I am wrong) Where can I find how to correctly initialise my program with a USB Raw device ?

Regards,

Grégory
0 Kudos
Message 3 of 7
(5,074 Views)
Gregory:

The very beginning of the program will indeed be the same. The main change is that the resource string will be different.

If your USB device is of the type where you have to download the firmware each time, you may have to call viUsbControlOut after opening the session, in order to send the firmware. If your device has multiple endpoints of the same type, you may have to set the endpoint (pipe) address attributes, in order to communicate with your device properly.

A general VISA USB example (along with a thorough walkthrough of the steps) is located at this URL:

http://zone.ni.com/devzone/conceptd.nsf/webmain/6792BAB18242082786256DD7006B6416?opendocument

I hope this helps.

Dan Mondrik
0 Kudos
Message 4 of 7
(5,078 Views)
Hello Dan:

I just followed this old link for a new problem I have. I just bought a USB to Serial cable and I wanted to be able to do just what is in this link

http://zone.ni.com/devzone/conceptd.nsf/webmain/6792BAB18242082786256DD7006B6416?opendocument

however I have a problem witht the statement "copy to INF folder" because in Win2K I am not able to see it? I have generated the INF file already but I can't figure out how I should put it there?

Regards,

Berns B.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 5 of 7
(4,893 Views)
Hello:

I have attempted to read from a second serial port on a computer notebook (and also a as well from a Serial to USB cable into the same PC) the serial bytes spited out to control a control box from a main computer running a VISA/RS232C controller VI, but each time I connect the custom piggy back serial cable the entire connection becomes offline? This is some loading of sort I know but what can be done in terms of hardware?

Regards,

Berns B.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 6 of 7
(4,895 Views)
Hi Dr.Berns,

For Windows 2000 the default ini folder path is C:\winnt\inf. Make sure that under Control Panel >> Folder Options >> View, "Show hidden files and folders" is selected.

For the serial issue, make sure that you can perform a loopback test on both the notebook and the other PC.

http://zone.ni.com/devzone/conceptd.nsf/webmain/D48BA43C59B60277862569EE000501FD#6

If you can perform a simple loopback test on both computers using HyperTerminal, then they should be able to communicate with each other using HyperTerminal. Once you can communicate between computers using HyperTerminal, Then your hardware should be configured correctly. Make sure that the baud rates are set the same on both computers.

Michael Chaney
National Instruments
0 Kudos
Message 7 of 7
(4,872 Views)