Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

IBNOTIFY function hangs after some time when timeout is configured to 30 secs but SRQ reply takes ~ 120 secs

I’ll summarize our problem:
We’re a client on one end of a GPIB card and we’re using driver version NI-488.2.

During our initialization process we set the timeout to 30 seconds and then register to ibnotify with a mask of TIMO | RQS (0x4800).

Everything works fine, and we get the regular SRQ notifications and also timeout notifications whenever there’s an idle state for 30 seconds.

Once in a while (after a few hours run), we stop receiving any notifications from the GPIB driver.


Things we checked:
  • The ibnotify callback always returns a mask of 0x4800 (very simple – no if’s are involved).
  • No error is reported by the GPIB driver
  • When we see that we stop getting notification from the driver, after a while we see that the thread that was used by the driver in order to give us notification was returned to the system, and is used by the thread pool for other operations.
  • This might have something to do with a write operation occurring on another thread.
  • When using the NI Spy, we see that the messages correctly arrive to our side of the GPIB.

Attached the LangInt.dll we use and NISpy logs

Download All
0 Kudos
Message 1 of 7
(4,034 Views)
Hello IgalGurvits,

I've got a few questions for you.  Can you please clarify what you mean by "When using the NI Spy, we see that the messages correctly arrive to our side of the GPIB"?  Does that mean that you're always receiving the correct messages or that by using NI-Spy the messages start  to correctly arrive?  What software are you using to communicate?  What version of 488.2 are you using?

Thanks!

Meghan
Applications Engineer
0 Kudos
Message 2 of 7
(4,005 Views)

This issue happens regardless if NI SPY is up or not.

The symptom is that deviceis sending SRQ but ibnotify is not triggering the calback function (this happens when GPIB timeout is configured to

30 secs and SRQ is send after 120 secs, this happens sometimes...)

At this case I can use ibrsp to read the SRQ value, so it's does sent by device.

I am using langint.dll to work with GPIB driver ver # 1.0.1532.22842

gpib-32.dll rev 2.4.0.3055

 

 

0 Kudos
Message 3 of 7
(3,980 Views)
Hello IgalGurvits,

From what you are describing, ibnotify is doing exactly what it is supposed to do.  If the timeout is set for 30s and SRQ doesn't happen for 120s, then ibnotify would timeout and not register the SRQ.  If you put ibnotify in a loop, so that it starts over after a timeout, then you may solve your issue.

Thanks!

Meghan
Applications Engineer

Message Edited by Meghan R on 02-20-2007 03:49 PM

0 Kudos
Message 4 of 7
(3,959 Views)

As far as I understand from docs, ibnotify will execute HandleSRQ time after time whil NotifyMask (the reply from HandleSRQ function is not 0)

It's working fine, and it's do handling 120s delays for SRQ arrival, but sometimes failed.

Below is the implementation.

Thanks.

 

definition of mask is:

public const int NotifyMask = 0x4800;

call to the ibnotify function is:

status = li.ibnotify(Dev, NotifyMask, _handleSRQ, o);

HandleSRQ code is:

private int HandleSRQ(int ud, int callback_ibsta, int callback_iberr, int callback_ibcntl, object RefData)

{

OTLogger.Instance.Debug(string.Format("GPIB.HandleSRQ() started: ud = {0}, status = 0x{1:X}, error = 0x{2:X}, cntl = 0x{3:X}, RefData = {4}",

ud, callback_ibsta, callback_iberr, callback_ibcntl, RefData));

if ((callback_ibsta & c.ERR) == c.ERR)

{

throw new OTException(OTErrors.GPIBHandleSRQFailed, string.Format("GPIB.HandleSRQ(): failed to handle SRQ stat {0} err {1}", li.ibsta.ToString(), li.iberr.ToString()));

}

if ((callback_ibsta & c.RQS) == c.RQS)

{

readSRQ();

}

OTLogger.Instance.Debug("GPIB.HandleSRQ() ended");

//ThreadPool.QueueUserWorkItem(_listenForDevice);

return NotifyMask;

}

0 Kudos
Message 5 of 7
(3,934 Views)
Hello IgalGurvits,

ibnotify will timeout after 30s, so if the SRQ comes after 120s, it will not notify you of the SRQ. 

Have you disabled automatic serial polling? From NI-488.2 Help - "For device-level usage, notification on RQS is not guaranteed to work if automatic serial polling is disabled. By default, automatic serial polling is enabled."


Thanks!

Meghan
Applications Engineer
0 Kudos
Message 6 of 7
(3,918 Views)

No, I didn't

 

Will try to test it with autopolling disabled

 

Igal

0 Kudos
Message 7 of 7
(3,900 Views)