EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Waveform read problems
From: [email protected]
To: Mark Rivers <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Fri, 27 Jul 2012 17:23:31 -0700 (PDT)
Thanks for the advice. I'll definitely look into StreamDevice, it sounds really nice. Unfortunately, I've done a little more debugging and I'm pretty sure the problem is in asyn, not my driver. For instance when I try to connect directly with asynOctet, I get:

epics> asynOctetConnect("NW","L1")
epics> asynOctetWriteRead("NW","*IDN?")
2012/07/27 16:43:04.491 10.95.101.61:5025 write 6
*IDN?\n
2012/07/27 16:43:04.492 10.95.101.61:5025 read 47
Agilent Technologies,E5071C,MY46213997,A.10.06\n
eomReason 0x2
Agilent Technologies,E5071C,MY46213997,A.10.06
epics> asynOctetWriteRead("NW",":SENS1:FREQ:DATA?")
2012/07/27 16:43:17.503 10.95.101.61:5025 write 18
:SENS1:FREQ:DATA?\n
2012/07/27 16:43:17.505 10.95.101.61:5025 read 2048
+5.00000000000E+008,+5.05000000000E+008,+5.10000000000E+008,+5.15000000000E+008,+5.20000000000E+008,+5.25000000000E+008,
eomReason 0x1
+5.00000000000E+008,+5.05000000000E+008,+5.10000000000E+008,+5.15000000000E+008,+5.20000000000E+008,+5.25000000000E+008,+5.30000000000E+008,+5.35000000000E+008,
epics>

No Segfault this time however, the entire data stream is truncated after 2048 characters. I'm getting the impression there is something fundamental I'm not understanding about how asyn manages data. I looked over Eric's Stream device tutorial and could find no reason why converting my driver support to stream device would solve this problem since asyn is still handling the communication. My problem remains that I don't understand how to get asyn to read more than 2048 characters. The solution must be very simple otherwise asyn could never have been used with a wf record.

Cheers,

Andrew

On Fri, 27 Jul 2012, Mark Rivers wrote:

You might want to consider using streamDevice rather than the asynGpib software.  asynGpib is rather obsolete; steamDevice is much nicer.  You don't need to write any C code if you use streamDevice.

Eric Norum has recently written a new version of his "HowToDoSerial" tutorial, explaining how to use asyn with streamDevice.  It will be in the next release of asyn, but meanwhile you can find it here:

http://cars.uchicago.edu/software/epics/HowToDoSerial_StreamDevice.html

Cheers,
Mark


________________________________________
From: [email protected] [[email protected]] on behalf of [email protected] [[email protected]]
Sent: Friday, July 27, 2012 4:53 PM
To: [email protected]
Subject: Waveform read problems

Hey Everyone,

I'm using Asyn to create a driver for the Agilent E5071C Network analyzer and am trying to create a working waveform record to readout the analyzer traces. The output of the analyzer is a list of ASCII values separated by commas. For instance, :SENS1:FREQ:DATA? returns the frequency values where the power was measured in Hz. The output is:+5.00000000000E+008,+5.05000000000E+008,+5.10000000000E+008,+5.15000000000E+008,+5.20000000000E+008,+5.25000000000E+008, ... I'm able to communicate with the analyzer, however I create a Segmentation violation when processing waveform records to store this array.


epics> dbtr AGE5071C:FREQ
ACKS: NO_ALARM      ACKT: YES           APST: Always        ASG:
BKPT: 00            BUSY: 0             DESC: Frequency Series Hz
DISA: 0             DISP: 0             DISS: NO_ALARM      DISV: 1
2012/07/27 14:12:12.823 DTYP: AGE5071C      EGU: Hz             EVNT: 0             FLNK:CONSTANT 0
10.95.101.61:5025 write 18
:SEFTVL: DOUBLE        HASH: 0             HOPR: 0
NS1INP:GPIB_IO #L1 A0 @9                   LCNT: 0             LOPR: 0
:FREMPST: Always        NAME: AGE5071C:FREQ NELM: 10000         NORD: 0
Q:DANSEV: NO_ALARM      NSTA: NO_ALARM      PACT: 1             PHAS: 0
TA?PINI: NO            PREC: 0             PRIO: LOW           PROC: 0
\n
PUTF: 0             RARM: 0             RPRO: 0             SCAN: Passive
SDIS:CONSTANT       SEVR: INVALID       SIML:CONSTANT       SIMM: NO
SIMS: NO_ALARM      SIOL:CONSTANT       STAT: UDF           TIME: <undefined>
TPRO: 0             TSE: 0              TSEL:CONSTANT       UDF: 1
VAL: (nil)
epics> 2012/07/27 14:12:12.825 10.95.101.61:5025 read 2048
+5.00000000000E+008,+5.05000000000E+008,+5.10000000000E+008,+5.15000000000E+008,+5.20000000000E+008,+5.25000000000E+008,
2012/07/27 14:12:12.825 10.95.101.61:5025 read 1972
000000E+009,+1.01500000000E+009,+1.02000000000E+009,+1.02500000000E+009,+1.03000000000E+009,+1.03500000000E+009,+1.04000
Segmentation fault


I'm defining the gpibCMD as:

{&DSET_WF, GPIBREAD, IB_Q_HIGH, ":SENS1:FREQ:DATA?", NULL, 0, 32000, readWF, 0, 0, NULL, NULL, NULL},

and the custom convert routine I'm using is:

// WF read routine for AGE5071C
static int readWF(struct gpibDpvt *pdpvt,int P1, int P2, char**P3) {

 printf("%s","TEST****************************************");

 struct waveformRecord *pwf=(struct waveformRecord *)pdpvt->precord;
 asynUser *pasynUser = pdpvt->pasynUser;

 double* value = (double *)pwf->bptr;
 double data;
 int n;
 char* buffer = "\0";

 pwf->nord=0;
 strcpy(buffer,pdpvt->msg);

 while ((pwf->nord < pwf->nelm) && sscanf(buffer,"%lE,%n",&data,&n)==1) {

   memcpy(value+pwf->nord,&data,sizeof(double));
   pwf->nord++;
   buffer+=n;

   asynPrint(pasynUser,ASYN_TRACE_FLOW,"(NORD,VAL) : (%i,%E)\n",pwf->nord,data);

 }

 if (pwf->nord == 0) return -1;

 return 0;

}

Since none of my error messages are printed I conclude the pdpvt->msg array is being overfilled somehow before my convert routine is even processed. I'm really not sure how to debug this since everything that I've written seems to work fine. The debug messages reveal no problems until the Segmentation violation occurs. I also don't understand why the reads can only handle a maximum of 2048 characters at a time. If anyone has experience writing device support for a waveform record your advice would be very helpful. Thanks.

Andrew


Replies:
RE: Waveform read problems Mark Rivers
References:
RE: Waveform read problems Mark Rivers

Navigate by Date:
Prev: RE: Waveform read problems Mark Rivers
Next: RE: Waveform read problems Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Waveform read problems Mark Rivers
Next: RE: Waveform read problems Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·