Re: Agilent 82357B repeatable hard failure

dave penkler <[email protected]> Thu, 28 Sep 2023 19:13:12 +0200
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAL=kjP0fMJsOdBpXEgLpxz05PArkt_+k8np-7d09_54XnHNvbg@mail.gmail.com>
Hi Jim,
Please find attached a new version of onebyte to check that board level
reads work after setting ATN at the end of the read.
The attached patch for the driver is against the current SVN and sets ATN
at the end of the read as you proposed.
@MichaelK you might try this one on the R&S power meter.
It worked on my Beiming clone:
In the ibsta 0x174 = CMPL | REM | CIC | ATN | LACS  we see the ATN bit set.
$ onebyte2 -d8
  0x0168 ibwrt
H 0x0174 ibrd dev
E 0x0174 ibrd board
W 0x0174 ibrd board
L 0x0174 ibrd board
E 0x0174 ibrd board
T 0x0174 ibrd board
T 0x0174 ibrd board
- 0x0174 ibrd board
P 0x0174 ibrd board
A 0x0174 ibrd board
C 0x0174 ibrd board
K 0x0174 ibrd board
A 0x0174 ibrd board
R 0x0174 ibrd board
D 0x0174 ibrd board
, 0x0174 ibrd board
E 0x0174 ibrd board
3 0x0174 ibrd board
6 0x0174 ibrd board
3 0x0174 ibrd board
1 0x0174 ibrd board
A 0x0174 ibrd board
, 0x0174 ibrd board
0 0x0174 ibrd board
, 0x0174 ibrd board
2 0x0174 ibrd board
. 0x0174 ibrd board
1 0x0174 ibrd board
- 0x0174 ibrd board
5 0x0174 ibrd board
. 0x0174 ibrd board
0 0x0174 ibrd board
- 0x0174 ibrd board
1 0x0174 ibrd board
. 0x0174 ibrd board
0 0x0174 ibrd board

 0x2174 ibrd board
Cheers,
-Dave


On Thu, 28 Sept 2023 at 17:59, dave penkler <[email protected]> wrote:

> Hi Jim,
> Can you please let us know if the removal of TCS in the SVN works for your
> reading of the calibration data.
> I have thought some more about your proposal to set ATN at the end of the
> read. We just need to verify that board level reads after the first device
> level read still work with the ATN workaround.
> If it does that would give us a reliable board level ibsta, From the logic
> analyser traces it looks like the board gives valid ADSR responses when it
> is in the Talker Active state i.e. after ibwrt.
> -Dave
>

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
onebyte2.c (text/x-csrc, 1.8 KB)
/* Agilent/Keysight 82357B ibsta test programme Version 2 */
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#include <getopt.h>
#include <gpib/gpib_user.h>
#include <gpib/ib.h>

char *myProg;

static void myError(char * mess) {
  int erc = ThreadIberr();
  fprintf(stderr,"error: %s\n", mess);
  fprintf(stderr," - %s\n", gpib_error_string(erc));
  if (erc == 0) fprintf(stderr," system error: %s\n",strerror(ThreadIbcnt()));
  exit(1);
}

void usage(int brief) {
  fprintf(stderr,"Usage: %s [-h] -d <device pad> [-m <minor>] [<command>]\n",
	  myProg);
  if (brief) exit(1);
  fprintf(stderr,"  Default <minor> is 0\n");
  fprintf(stderr,"  Default <command> is *IDN?\n");
  exit(0);
}

int main(int argc, char **argv) {
  int c,ibsta;
  int minor = 0;
  int pad = -1;
  int ud,run=1;
  uint8_t buf[256];
  char *cmd = "*IDN?";

  myProg = argv[0];
  while ((c = getopt (argc, argv, "m:d:h")) != -1) {
    switch (c)  {
    case 'm': minor = atoi(optarg); break;
    case 'd': pad   = atoi(optarg); break;
    case 'h': usage(0); break;
    default:  usage(1);
    }
  }
  if (pad < 0) {
    fprintf(stderr,"Need device pad argument.\n");
    usage(1);
  }
  if (optind < argc) cmd = argv[optind];

  ud = ibdev(minor,pad,0,T3s,1,0);
  if (ud < 0) myError("ibdev fail");
  if (ibwrt(ud,cmd,strlen(cmd)) & ERR) myError("ibwrt fail");
  ibsta = ibwait(minor,0);
  printf("  0x%04x ibwrt\n",ibsta);
  if ((ibsta = ibrd(ud,buf,1)) & ERR) myError("ibrd fail");
  run = !(ibsta & END);
  ibsta = ibwait(minor,0);
  printf("%c 0x%04x ibrd dev\n",buf[0],ibsta);
  while (run) {
    if ((ibsta = ibrd(minor,buf,1)) & ERR) myError("ibrd fail");
    run = !(ibsta & END);
    printf("%c 0x%04x ibrd board\n",buf[0],ibsta);
  }
  exit(0);
}
agilent_82357a.patch (text/x-patch, 720 B)
Index: drivers/gpib/agilent_82357a/agilent_82357a.c
===================================================================
--- drivers/gpib/agilent_82357a/agilent_82357a.c	(revision 2061)
+++ drivers/gpib/agilent_82357a/agilent_82357a.c	(working copy)
@@ -571,6 +571,17 @@
 		if(trailing_flags & (ATRF_EOI | ATRF_EOS)) *end = 1;
 	}
 	kfree(in_data);
+	{ /* Fix for valid ibsta */
+		struct agilent_82357a_register_pairlet write;
+		int ret;
+		write.address = AUXCR;
+		write.value = AUX_TCA;
+		ret = agilent_82357a_write_registers(a_priv, &write, 1);
+		if(ret)
+		{
+			printk("%s: agilent_82357a_write_registers() returned error\n", __FUNCTION__);
+		}
+	}
 	//FIXME check trailing flags for error
 	return retval;
 }