Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Timeout in ibrd long before timeout has expired.

david_c_partridge_0-1585051117156.png

As you can see it set a timeout of T1000s and then sent a command to a device followed by an ibrd.

 

however the ibrd terminated pretty much immediately even though the device was still processing the *CAL? command

 

What could be going on?

 

David

0 Kudos
Message 1 of 7
(3,391 Views)

Looks like the instrument responded, possibly with a \r or \n or NULL character.  But without seeing your code or knowing the instrument in question it will be hard to diagnose the problem. A few questions that might lead you to a solution..

 

Are your termination characters properly setup?

Is the value T1000s defined in your code?  (I believe its in a header file somewhere, otherwise you can supply an float 1000.0)

If you read the status does it give you an error?

 

Hope that helps.

Craig

0 Kudos
Message 2 of 7
(3,359 Views)

T1000s is defined in NIGLOBAL.bas as the value 17 which gives a 1000 second timeout.

 

> Global Const T1000s = 17 ' Timeout of 1000 s (maximum)

 

The instrument is a Tektronix TDS3000B 'scope

 

AFAIK a status of 0xc100 says timeout with no response.

 

David

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

VERY interesting - I changed the timeout value from T1000s to TNONE, and that works fine !

 

The trace did show a value ot 17 being passed to the ibtmo call previously so it's not as if I had been passing an invalid value ...  However when it didn't crash at that point it did consistently timeout after about 15s (the default IIRC)

 

Application appears not to be inclined to crash randomly anymore hmmmm

 

David

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

I'd like to see the chain of read write commands you are making to understand how you use the timeout.  Are you connected by USB, GPIB or LAN?  PC or laptop.  USB can be flaky for long delays.  I had a DMM which ran the following

 

ibtmo(hp3458a, T1000s) ;; Set very long timeout!
ibwrt(hp3458a, "CALL TEST1", 0)  ;; call subprogram measurement setup

ibwrt(hp3458a, "STB?", 0) ;; read status 
ibwait(hp3458a, TIMO|RQS) ;; wait until the program is finished reading or timeout
stb_rqs=ibrd(hp3458a, 3) ;; read return value then decide how to proceed

 

works fine on GPIB with PCI card but fails 4/10 times with GPIB-USB adaptor due to PC USB port issues.

 

Yours doesn't look like the same issue, but without more code hard to diagnose.

Craig

0 Kudos
Message 5 of 7
(3,329 Views)

You may be onto something there - this is connected via a GPIB-USB-HS and it's a laptop.

 

The code now reads:

 

   ibask TDS, IbaTMO, CurrentTimeOut   ' find current timeout

   WriteDevice TDS, "*CAL?"

   ibtmo TDS, TNONE                    ' change timeout to None from T1000s

   Msg = Space(20)

   ibrd TDS, Msg                       ' don't use AskDevice or ReadDevice - they use fixed T/O of 3s

   :

   :

   ibtmo TDS, CurrentTimeOut ' reset timeout to default

 

However - it's odd that the T/O happened after 15s or is that the point at which USB starts giving problems?

 

David

 

 

 

 

0 Kudos
Message 6 of 7
(3,324 Views)

In case there's any doubt, the code used to read:

 

ibask TDS, IbaTMO, CurrentTimeOut ' find current timeout

WriteDevice TDS, "*CAL?"

ibtmo TDS, T1200s     ' Long timeout

Msg = Space(20)

ibrd TDS, Msg ' don't use AskDevice or ReadDevice - they use fixed T/O of 3s

:

:

ibtmo TDS, CurrentTimeOut ' reset timeout to default

 

and yet the ibrd was terminating with a timeout (status 0xC100) after 15 seconds.

Does anyone know why this happens and how to solve it.

David

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