AnsweredAssumed Answered

SCPI 34970A Connection Exception

Question asked by stumpja on Oct 21, 2016
Latest reply on Nov 1, 2016 by tomc

Catchy title, right?  Anyways, I have written a program that talks to an Agilent 34970A roughly every minute (variable depending on input values, and also random depending on input values) and scans through almost 20 channels. I then parse all the data and make sure everything looks right. I have run into several issues, and I have worked through most of them, however, I am now stuck with one.


SOMETIMES, I get an exception when I first try to connect to the instrument. The short version of the exception is:

Keysight.CommandExpert.InstrumentAbstraction.CommunicationTimeoutException was unhandled
Message=Timed out while trying to query instrument errors

I have attached the full exception if it is useful to somebody. I have written my code in C#, and like I said it happen right when I try to connect to the instrument. This line of code is:

Ag3497x v34970A = new Ag3497x("ASRL1::INSTR");

How do I handle this exception? Originally I was using IVI-COM drivers, but found them to be cumbersome and unreliable. I read on here somewhere one person who preferred the SCPI commands, so I switched to these. However, when I was using the IVI drivers, there was a command to close the connection. I couldn't find on with the SCPI commands. Could this be part of the issue?


The full code I use to talk with and read data from the 34970A is as follows:

string readings = null;


Ag3497x v34970A = new Ag3497x("ASRL1::INSTR");

v34970A.SCPI.DISPlay.TEXT.Command("CYCLE TESTER");
v34970A.SCPI.CONFigure.VOLTage.AC.Command(100, "MAX", "@101:116");
v34970A.SCPI.SENSe.VOLTage.AC.BANDwidth.Command(1000, "@101:117");
v34970A.SCPI.CONFigure.VOLTage.AC.Command(10, "MAX", "@117");
v34970A.SCPI.SENSe.VOLTage.AC.BANDwidth.Command(1000, "@117");
v34970A.SCPI.CONFigure.VOLTage.AC.Command(300, "MAX", "@119");
v34970A.SCPI.SENSe.VOLTage.AC.BANDwidth.Command(60, "@119");
v34970A.SCPI.CONFigure.TEMPerature.Command("TCouple", "K", 1, "MAX", "@118");

v34970A.SCPI.READ.QueryAllData(null, out readings);

I run this code up to 10,000 times as required by the test the program is written for. I am connective via SERIAL as you can see in the code.


Anyways, any help would be much appreciated. As am sure you could understand, when a program fails at cycle 8000 out of 10000, it can be very frustrated, especially when 10000 cycles can take more than 10 days to complete. If you would like to know any other detail, please let me know, and I will provide it promptly.


Thanks again,




UPDATE: Forgot to add attachment of full exception log. This is done now and called debug2.txt.