[time-nuts] SR620 TCXO calibration

Dr. David Kirkby (Kirkby Microwave Ltd) drkirkby at kirkbymicrowave.co.uk
Mon Jun 19 16:03:24 EDT 2017


On 19 June 2017 at 15:35, David C. Partridge <david.partridge at 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;


More information about the time-nuts mailing list