Re: [time-nuts] SR620 TCXO calibration

2017-06-20 Thread Dr. David Kirkby (Kirkby Microwave Ltd)
On 19 June 2017 at 21:43, David C. Partridge 
wrote:

> Yes please. ...
>

OK, the code is here

http://www.kirkbymicrowave.co.uk/tmp/srs-0.02.tar.gz

Note

1) It has only be tested on Solaris SPARC, with a National Instruments GPIB
card.

2) I would expect it to run under Linux, with few if any changes. If any
are needed for an NI card, please let me know. I don't mind trying to get
it to run under Linux, or any Unix system.

3) I've no idea how easy it would be to run under Windoze, and have no
intention of trying to help getting it to run under Windoze.

4) There's no man page, but there is some rudimentary in-built help, if you
run it with the wrong number of arguments. Below I run it with none, so it
generates a semi-helpful help message. It needs at least one option, and a
GPIB address. So something like

srs --time 12

would run it time-internval mode, and expect to find the SR620 on address
12.

I've NOT distributed this before, and have made no attempt to clean it up
to consider it in a fit state to distribute. But feel free to try it. Send
any comments directly to me.

Consider it released under the GPL version 2, or at your option any later
version.

drkirkby@buzzard:~/srs-0.02/src$ ./srs
srs - Version 0.02, by David Kirkby, G8WRB, drkir...@kirkbymicrowave.co.uk
Dumps data from a Stanford Research SR620 time-interval counter
Usage: srs [options] GPIB_address
**MODE**
  --time
  --width
  --risefall
  --frequency (or use --freq)
  --phase
  --count

**SOURCE (or start)**
  --A
  --B
  --reference (or use --ref)
  --ratio

**SAMPLE SIZE**
  --size n (n=1 to 100)

**DISPLAY**
  --mean
  --rel
  --jitter
  --max
  --min
  --trig
  --dvm
**OTHERS**
  --autocal
  --readcalbyte n
  --setcalbyte n m (sets calbye n to the value m)
  --settimebase (Put 10 MHz into input A before running this, to correct
the timebase)
  --help
  -h, --help
  -v, --version
  -V, --verbose
___
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.


Re: [time-nuts] SR620 TCXO calibration

2017-06-19 Thread David C. Partridge
Yes please. ...

-Original Message-
From: time-nuts [mailto:time-nuts-boun...@febo.com] On Behalf Of Dr. David 
Kirkby (Kirkby Microwave Ltd)
Sent: 19 June 2017 21:03
To: Discussion of precise time and frequency measurement
Subject: Re: [time-nuts] SR620 TCXO calibration

On 19 June 2017 at 15:35, David C. Partridge <david.partri...@perdrix.co.uk>
wrote:

> I think I'm being dense, but I can't work out how to get this thing to
> display CalDat 04.   I have managed to get it to display CalDat 0 value,
> but
> can't work out how to step through to view adjust CalDat 04.
>
> Once I do  get there, how do I manage to adjust the CalDat value while 
> observing the output of measuring my GPSDO 10MHz output at the same time?
>
> Please could someone put me out of my misery?
>
> Thanks
> Dave
>


I can't recall how you step the data, but it must be in the manual.

I wrote a bit of C code that attempts to correct the timebase, if 10 MHz is put 
into channel A. It measures the frequency on channel A, then adjust the crystal 
frequency until the frequency is 10 MHz. That's probably not the best way on a 
TI counter, but seems to work reasonably well - at least any errors are small 
compared to the fact that only integer values may be programmed into the 
calbytes. Hence it seems impossible to fully correct this.

One issue is that frequency shift is non-linear with respect to the calbytes. 
So the approach I took was to shift the value by 4, see the effect of the 
shift, and then use that to try to work out a suitable correction.

Below is the bit of C-code. If you want the complete set of code, which reads 
data from the SR620, I can send you it. I don't think it is well commented, and 
in any case has only been tested on Solaris. It will only work with an NI card, 
but I would expect it to work under

case SETTIMEBASE:
  output(device_descriptor,"MODE3;"); /* Set frequency mode */
  output(device_descriptor,"SRCE0;");  /* Measure source A */
  do {
calbyte_4=read_calbyte(device_descriptor,4);
frequency=read_frequency(device_descriptor);
frequency_error=frequency-1e7;
if (fabs(frequency_error) < 0.0008)  {
  printf("GOOD ENNOUGH frequency error=%lf\n\n",frequency_error);
  exit(0);
}
printf("cb4=%d f=%lf\n",calbyte_4, frequency);

if(frequency_error > 0)
  set_calbyte(device_descriptor, 4, calbyte_4+3);
else
  set_calbyte(device_descriptor, 4, calbyte_4-3);

printf("Changed calbyte 4 a little cb4=%d f=%lf\n",calbyte_4, 
frequency);
new_frequency=read_frequency(device_descriptor);
new_frequency_error=new_frequency-1e7;

if(frequency_error > 0)
  frequency_change_per_calbyte=(new_frequency-frequency)/3; /* in 
Hz/calbyte */
else
  frequency_change_per_calbyte=-(new_frequency-frequency)/3; /* in 
Hz/calbyte */

printf("frequency_change_per_calbyte=%lf\n",frequency_change_per_calbyte);
/* Do a correction of half the value calculated */
calbyte_change=-(int)
((new_frequency_error/frequency_change_per_calbyte)+0.5);

/* Attempt to correct the frequency */
set_calbyte(device_descriptor, 4, calbyte_4+calbyte_change);


/* Read the frequency, then exit if within an acceptable tollerence */
frequency=read_frequency(device_descriptor);
frequency_error=frequency-1e7;
calbyte_4=read_calbyte(device_descriptor,4);
printf("new cb4=%d frequency error=%lf\n\n",calbyte_4, frequency_error);
  } while (fabs(frequency_error) > 0.0008);
  exit(0);
break;
___
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.

___
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.


Re: [time-nuts] SR620 TCXO calibration

2017-06-19 Thread David C. Partridge
actually I think mine also has an OCXO

D.

-Original Message-
From: time-nuts [mailto:time-nuts-boun...@febo.com] On Behalf Of Dr. David 
Kirkby (Kirkby Microwave Ltd)
Sent: 19 June 2017 21:21
To: Discussion of precise time and frequency measurement
Subject: Re: [time-nuts] SR620 TCXO calibration

I should have added, mine had an OCXO - I just see you had a TCXO.

I don't have the SR620 any more. I swapped it, along with a HP 4.2 GHz signal 
generator, for an HP 4291B impedance and material analyzer.

Dave
___
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.

___
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.


Re: [time-nuts] SR620 TCXO calibration

2017-06-19 Thread Dr. David Kirkby (Kirkby Microwave Ltd)
I should have added, mine had an OCXO - I just see you had a TCXO.

I don't have the SR620 any more. I swapped it, along with a HP 4.2 GHz
signal generator, for an HP 4291B impedance and material analyzer.

Dave
___
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.


Re: [time-nuts] SR620 TCXO calibration

2017-06-19 Thread Dr. David Kirkby (Kirkby Microwave Ltd)
On 19 June 2017 at 15:35, David C. Partridge 
wrote:

> I think I'm being dense, but I can't work out how to get this thing to
> display CalDat 04.   I have managed to get it to display CalDat 0 value,
> but
> can't work out how to step through to view adjust CalDat 04.
>
> Once I do  get there, how do I manage to adjust the CalDat value while
> observing the output of measuring my GPSDO 10MHz output at the same time?
>
> Please could someone put me out of my misery?
>
> Thanks
> Dave
>


I can't recall how you step the data, but it must be in the manual.

I wrote a bit of C code that attempts to correct the timebase, if 10 MHz is
put into channel A. It measures the frequency on channel A, then adjust the
crystal frequency until the frequency is 10 MHz. That's probably not the
best way on a TI counter, but seems to work reasonably well - at least any
errors are small compared to the fact that only integer values may be
programmed into the calbytes. Hence it seems impossible to fully correct
this.

One issue is that frequency shift is non-linear with respect to the
calbytes. So the approach I took was to shift the value by 4, see the
effect of the shift, and then use that to try to work out a suitable
correction.

Below is the bit of C-code. If you want the complete set of code, which
reads data from the SR620, I can send you it. I don't think it is well
commented, and in any case has only been tested on Solaris. It will only
work with an NI card, but I would expect it to work under

case SETTIMEBASE:
  output(device_descriptor,"MODE3;"); /* Set frequency mode */
  output(device_descriptor,"SRCE0;");  /* Measure source A */
  do {
calbyte_4=read_calbyte(device_descriptor,4);
frequency=read_frequency(device_descriptor);
frequency_error=frequency-1e7;
if (fabs(frequency_error) < 0.0008)  {
  printf("GOOD ENNOUGH frequency error=%lf\n\n",frequency_error);
  exit(0);
}
printf("cb4=%d f=%lf\n",calbyte_4, frequency);

if(frequency_error > 0)
  set_calbyte(device_descriptor, 4, calbyte_4+3);
else
  set_calbyte(device_descriptor, 4, calbyte_4-3);

printf("Changed calbyte 4 a little cb4=%d f=%lf\n",calbyte_4,
frequency);
new_frequency=read_frequency(device_descriptor);
new_frequency_error=new_frequency-1e7;

if(frequency_error > 0)
  frequency_change_per_calbyte=(new_frequency-frequency)/3; /* in
Hz/calbyte */
else
  frequency_change_per_calbyte=-(new_frequency-frequency)/3; /* in
Hz/calbyte */

printf("frequency_change_per_calbyte=%lf\n",frequency_change_per_calbyte);
/* Do a correction of half the value calculated */
calbyte_change=-(int)
((new_frequency_error/frequency_change_per_calbyte)+0.5);

/* Attempt to correct the frequency */
set_calbyte(device_descriptor, 4, calbyte_4+calbyte_change);


/* Read the frequency, then exit if within an acceptable tollerence
*/
frequency=read_frequency(device_descriptor);
frequency_error=frequency-1e7;
calbyte_4=read_calbyte(device_descriptor,4);
printf("new cb4=%d frequency error=%lf\n\n",calbyte_4,
frequency_error);
  } while (fabs(frequency_error) > 0.0008);
  exit(0);
break;
___
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.


[time-nuts] SR620 TCXO calibration

2017-06-19 Thread David C. Partridge
I think I'm being dense, but I can't work out how to get this thing to
display CalDat 04.   I have managed to get it to display CalDat 0 value, but
can't work out how to step through to view adjust CalDat 04.

Once I do  get there, how do I manage to adjust the CalDat value while
observing the output of measuring my GPSDO 10MHz output at the same time?

Please could someone put me out of my misery?

Thanks
Dave





___
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.