Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Fixing connectivity issues on the SR510 over GPIB

I connected a National Instruments GPIB-USB-B addapter to the Standford Research Systems SR510 so that it could connect to my computer. In NI's GPIB Measurement and Automation explorer, I do detect an instrument through this interface, with primary address 23, which is appropriate. There is a note that the intrument did not respond to a *IDN? query, which isn't too surprising since the manual doesn't show *IDN? as a supported command. Unfortunately, it won't respond to anything else, either. If I communicate with the device using the NI 488.2 Communicator, all commands make the ERR status LED flash, along with the ACT indicator. The same thing happens if I use VISA interactive control to write anything to the SR510, like B1/r, which should adjust a setting, but instead only lights up the error LED. I downloaded the "certified" SR510 driver from www.ni.com, unzipped it to the appropriate directory, and it shows the same results (I can run it, but the only thing it will do is light up the error indicator on the SR510). I sort of hoped the gold star next to the sr510 under the "certified" column would mean this would be easy...

Anyway, I notice similar problems have been had in the past, but I don't see an answer on these forums. Can someone help me?
0 Kudos
Message 1 of 32
(8,556 Views)
I would check the manual for your device to see if your device requires an EOS byte. Some devices, require a carriage return, or a linefeed character to be appended to the end of the string written to the device. In the VISA interactive control try adding \r or \n to the string.

Also does the manual for your device explain what the error it is displaying means? If it does this might give us some insight on what is going wrong.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 2 of 32
(8,527 Views)
Thanks for responding. It does require a carriage return. I've added a \r, a \n, and both, but none of those things get around the error. The error itself means "invalid remote command." I would sort of assume that the certified driver would be set up to use the right end of message character, since the "certified" part implies that it works for someone. NIMax sees the device, and I have the right driver in the right directory, and VISA is installed...is there some major part of connecting to a GPIB address using a driver that I'm not aware of?

Jeff
0 Kudos
Message 3 of 32
(8,524 Views)
Jeff,

As I suspected your device doesn't appear to recognize the commands you are sending it. If your device requires a carriage return you would append \r to your string. For example if I wanted to send *IDN? to my device using the Visa Interactive Control, I would send *IDN?\r

It might be possible that you need to send your commands in a specific order. For example you might need send a command to configure your device, before you send a command to take a measurement.

If these things don't work create a NI Spy capture sending a simple command to your device. This will let us see what is being sent to your instrument, and hopefully provide a better idea how to fix it. The following link will show you how to use NI Spy if you are not familiar. NI Spy
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 4 of 32
(8,507 Views)
This is what I get if I send Z/r, the command to reset to default values followed by the carriage return the device manual says is necessary. I used VISA Interactive Control's Basic I/O Tab to send the command.

1. viWriteAsync (0x00177D18, "Z.", 2, 0x0404001F)
Process ID: 0x00000BD0 Thread ID: 0x00000BD4
Start Time: 14:01:39.453 Call Duration: 00:00:00.031
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000: 5A 0D Z.

2. Start: ibnotify callback (UD0, 0x100, 0, 2 (0x2), 0x00177D18)
Process ID: 0x00000BD0 Thread ID: 0x00000AEC
Start Time: 14:01:39.468 Call Duration: 00:00:00.000
ibsta: 0x100 iberr: 0 ibcntl: 2(0x2)

3. Completing viWriteAsync (0x00177D18, 0x0404001F, "Z.", 2)
Process ID: 0x00000BD0 Thread ID: 0x00000AEC
Start Time: 14:01:39.468 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000: 5A 0D Z.

4. Invoking VISA user callback (0x00177D18, 0x3FFF2009, 0x00169058, 0x0032A6B0)
Process ID: 0x00000BD0 Thread ID: 0x00000AEC
Start Time: 14:01:39.468 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)

5. Finish: ibnotify callback(UD0)
Process ID: 0x00000BD0 Thread ID: 0x00000AEC
Start Time: 14:01:39.468 Call Duration: 00:00:00.000
ibsta: 0x100 iberr: 0 ibcntl: 2(0x2)

6. Asynchronous I/O Resynchronized for ibwrta()
Process ID: 0x00000BD0 Thread ID: 0x00000AEC
Start Time: 14:01:39.453 Call Duration: 00:00:00.015
ibsta: 0x100 iberr: 0 ibcntl: 2(0x2)



The ACT light on my SR510 lit up to indicate GPIB activity, but the reset command itself was ignored.
0 Kudos
Message 5 of 32
(8,489 Views)
Z\r was the command I wrote, not Z/r.
0 Kudos
Message 6 of 32
(8,486 Views)
Another important question is why the driver wouldn't work. It clearly has the correct command syntax, but it has no ability to control or read output from my device. What can I do to simulataneously start troubleshooting that?

Here's the driver:

http://sine.ni.com/apps/we/niid_web_display.download_page?p_id_guid=E3B19B3E9403659CE034080020E74861
0 Kudos
Message 7 of 32
(8,488 Views)
I read through the manual for your device, and by looking at your NI Spy captures what you sent should work. You could try the GPIB with RS232 echo mode to see what the SR510 is receiving. This would be very easy to setup if you have a serial cable, and serial port on your computer.

1. Open Hyperterminal
2. Type any name and choose any icon
3. Choose Connect Using COM1 (your serial port)
4. Match the serial settings to match SW2 on the SR510

You will now see all of the commands in that the SR510 sends and receives

Also what version of NI-488.2 do you have? You can find this in the Software folder in MAX.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 8 of 32
(8,469 Views)
Great idea, and it helped a lot. At least I'm able to see what's going on now. I did as you said, setting the SR510 to echo over RS232, and I saw some interesting results.

First, I tried what SRS has been telling me, ibwrt "G20\r". The terminal showed:

OK> 20
_

The OK> is the command prompt that was there before I entered anything. Note that there's no G before the 20 and that while the cursor (which I represent by an underline here) moved to the next line, but that a new OK> prompt did not appear.

I thought that maybe it was just truncating the first character I send for some reason, so I sent an ibwrt " G20\r" and the terminal showed:

OK>G20
_

And the impressive thing is that the gain on the front panel display switched to setting 20! It appears that I can put in any character as the first byte in the string and it gets thrown out. "GG 20\r" works, for instance. Still, no new OK> prompt appeared. I tried entering the command in hyperterminal to see what would happen and saw:

OK>G20
OK>

Even though no OK> prompt comes up after a GPIB command, new commands are still accepted, so I'm guessing the OK> prompt may be only intended for RS232 terminal use.

Now if I try reading data from the SR510 by sending ibwrt " G\r" and then ibrd 20, the output I see in Interactive Control is

ud3: ibrd 20
[2100] ( end cmpl )
count: 4
32 30 0d 0a 2 0 . .

and hyperterminal shows

20

on the read command.

So it looks like all I need to do to communicate normally with the SR510 is add a garbage character before every write. Unfortunately, the NI certified driver doesn't do this. I'm guessing the reason I need this garbage character is that I've got something set up incorrectly with GPIB. Your last idea was extremely helpful; I hope you've got another good one up your sleeve.

Jeff
0 Kudos
Message 9 of 32
(8,460 Views)
I have NI 488.2 version 2.20.

I was told by SRS that the SR510 is 488.1 compliant, but not 488.2 compliant, as well.
0 Kudos
Message 10 of 32
(8,459 Views)