[combined replies to Paul, Tom, Mark and Pete below]

Hi Paul,

Thanks for the helpful suggestions.  Yes, I spent a pleasant afternoon with the 
little 59309A, sides and bottom removed, 0.025 pins soldered on to the RAM, 
other interesting signals, and U2 the ROM.  That makes it easy to pick any 16 
for the Salea logic analyzer, which BTW is super easy to use and perfect for 
this.

The good news is that the HP-IB bus looks fine (when sending commands to the 
clock) and the inputs and outputs for U14 the SN7489N 4x16 RAM look reasonable. 
The RAM ME pin toggles, but the RAM WE pin stays high (never asserted), 
following that back though U10 shows the clock AKA TB2 looks good, but the 
other LOAD input to U10 is never set.  Following LOAD which is AKA TP1 back, we 
get to U4A which is a D-FF, input is pin 2 which has a 10k pullup and is 
sourced from our friendly ROM U2, pin 10.  I have hooked up a dozen of the ROM 
output pins and they all are busy toggling, but pin 10, LOAD never changes.  
So, maybe we are stuck in some strange state due to my not understanding the 
Prologix ++read, or perhaps U2 LOAD bit is not working.

Carefully moved the ROM U2 into anti-static foam, then checked the socket, pin 
10 reads 9.98kOhm to the +5 line, so the socket and pullup per schematic are 
both good.

While reverse engineering this clock, I realized that the entire clock 
including HP-IB remote setting commands will all work perfectly without the U2 
ROM (!).

Tomorrow I will try reading U2, it has eight address lines, sixteen output 
lines, power +12 +5 -2 with a Teensy++ uC to step through the addresses while 
reading the outputs.

Reading U2 seems the most straightforward way to test it.   If the LOAD bit has 
failed, that should be obvious from reading it  Or maybe U2 is good, and I just 
don't understand how LOAD works with RAM while talking.

That's the status so far.  This is a nice device to debug.  Very much the 
opposite of 25 Gbps SerDes debug.

Hi Tom,

Thanks, yes there was a URL link to hp59309.c as the 3rd line in the hp59309.py 
source, so folks could easily find your original code.

After connecting a Salea logic analyzer to the GPIB bus, the traffic looks ok 
right up until I do a ++read 10 which is the first time we put the 59209A into 
TALK mode.  Per your suggestion, I have changed the code to always do ++read 10.

I would have tried hp59309.c with debug flag if I had a Prologix USB adapter.

Hi Tom and Mark,

Thank you both for your very generous offers to test using your known-good 
59309A clocks.

Hi Mark,

If you have the time, it would be informative to try the attached hp59309.py 
with your clock and Prologix Ethernet adapter.  Change line 9 to your adapter 
IP address, and line 12 to your clock HP-IB address.  This version uses Tom's 
suggestion of ++read 10.  It will set the clock, and then try to read the 
clock.  It should finish in a second or two.

Hi Pete,

Yes the -2v reading -2.9v seemed suspicious.  I forced it to -2v and saw no 
change in symptoms.  Also Paul measured the -2v line in his clock and it read 
-3v so while suspicious, not likely the root cause.

Cheers,

Bob

#!/usr/bin/python
# v1.1 Initialize HP 59309A GPIB clock to local time
# Thanks to TVB for http://www.leapsecond.com/tools/hp59309a.c
# For UTC, use datetime.utcnow instead of datetime.now

import datetime, socket, string, sys, time

# IP address of Prologix Controller 
host = "192.168.20.7"

# GPIB address of HP 59309A clock
addr = "2"

# Read one line from Prologix
def gpib_read(s):
  buf = ""
  while (1):
    c = s.recv(1)
    if not c:
      print "Connection closed"
      sys.exit(1)
    if c == '\n':
      return buf
    if c != '\r':
      buf = buf+c

# Send one command and EOL to Prologix
def gpib_send(s, cmd):
  s.send(cmd+"\n")

# Send one GPIB command and return reply
def gpib_query(s, cmd):
  gpib_send(s, cmd)
  gpib_send(s, "++read 10")
  return gpib_read(s)

# Send Prologix command and return reply
def prologix_query(s, cmd):
  gpib_send(s, cmd)
  return gpib_read(s)

prologix_cfg = [
  ("++savecfg",     "0"),    # do not update eeprom
  ("++mode",        "1"),    # device=0 controller=1
  ("++auto",        "0"),    # automatic read-after-write
  ("++eoi",         "0"),    # disable EOI
  ("++eos",         "3"),    # 0=CR+LF 1=CR 2=LF 3=none
  ("++read_tmo_ms", "1000"), # set read timeout (milliseconds)
  ("++addr",        addr)    # user-supplied gpib address
] 

# Initialize Prologix, only change as needed
def prologix_init(s):
  for cmd, val in prologix_cfg:
    old = prologix_query(s, cmd)
    if old != val:
      gpib_send(s, cmd + " " + val)

# Quiesce Prologix
def prologix_done(s):
  gpib_send(s, "++loc")
  gpib_send(s, "++mode 0")

if __name__ == "__main__":
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.settimeout(2)
     
  # Connect to Prologix on port 1234
  try :
    s.connect((host, 1234))
  except :
    print "Unable to connect to", host
    sys.exit(1)

  # Confirm we are talking to Prologix
  if "Prologix" not in prologix_query(s, "++ver"):
    print "Wrong IP address or not a Prologix controller"
    sys.exit(1)

  # Initialize Prologix as controller, no auto read
  prologix_init(s)

  was = datetime.datetime.now()
  while (1):
    now = datetime.datetime.now()
    if was.second != now.second:
      break
  
  time.sleep(0.2) # This plus 58309A internal delay works for me
  gpib_send(s, "R")

  # Repeat D days, M months, H hours and S seconds
  # Note that count of 0 i.e. null cmd seems ok
  tt = now.timetuple()
  gpib_send(s, "D" * ( tt.tm_yday - 1 ))
  gpib_send(s, "H" * tt.tm_hour)
  gpib_send(s, "M" * tt.tm_min)
  gpib_send(s, "S" * tt.tm_sec)

  print "Clock was set to", now.strftime("%Y-%m-%d %H:%M:%S")
  print "Now trying to read time from hp59309A"

  # Read time from the clock
  print gpib_query(s, "C")

  prologix_done(s)
  print "All done."



_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to