¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Quick and dirty GPSDO


 

I'm trying to run Erik Kaashoeks code for the 10 MHz reference. The problem seems to be that the LCD is stuck while the code seems to achieve lock.

The code is from 3 Dec 2021:?

My hardware is a SI5351 with a TCXO at 25 MHz and a 16x2 LCD, and no phase detector. Judging from the serial output on the Arduino monitor, it seems to be running OK. But hardly anything shows on the LCD, only the second line which says " F2DC V.5.2"., no lock information and no clock.

Here is the output on the serial monitor for the first 5 minutes:

0:00:05 dur=4 acount=25263408 dcount=-6480 calfact=0 acount=25263408 mincorr=10.0e-8 corr=1.5e0 xtal=26000000000?
0:00:11 dur=5 acount=32043408 dcount=13680 calfact=0 acount=32043408 mincorr=8.0e-8 corr=1.6e0 xtal=26000000000?
0:00:17 dur=5 acount=32043394 dcount=13666 calfact=0 acount=32043394 mincorr=8.0e-8 corr=1.6e0 xtal=26000000000?
0:00:23 dur=5 acount=32043405 dcount=13677 calfact=0 acount=32043405 mincorr=8.0e-8 corr=1.6e0 xtal=66650276864?
0:00:29 dur=5 acount=18754610 dcount=28690 calfact=0 acount=18754610 mincorr=8.0e-8 corr=5.0e-1 xtal=99999992832?
0:00:35 dur=5 acount=12500001 dcount=1 calfact=0 acount=12500001 mincorr=8.0e-8 corr=8.0e-8 xtal=100000000831 Lock
0:00:46 dur=10 acount=24999998 dcount=-2 calfact=0 acount=24999998 mincorr=4.0e-8 corr=-4.0e-8 xtal=99999996831 Lock
0:01:07 dur=20 acount=49999998 dcount=-2 calfact=0 acount=49999998 mincorr=2.0e-8 corr=-2.0e-8 xtal=99999994831 Lock
0:01:48 dur=40 acount=100000000 dcount=0 calfact=0 acount=100000000 mincorr=10.0e-9 corr=0.0e0 xtal=99999994831 Lock
0:03:09 dur=80 acount=200000000 dcount=0 calfact=0 acount=200000000 mincorr=5.0e-9 corr=0.0e0 xtal=99999994831 Lock
0:05:50 dur=160 acount=400000001 dcount=1 calfact=0 acount=400000001 mincorr=2.5e-9 corr=2.5e-9 xtal=99999995081 Lock

I would appreciate it if I could compare outputs with someone else?
?


--
Sverre

LA3ZA
http://la3za.blogspot.com


 

Just to add to my previous question. I can hear the output at 10.0 MHz, so there is definitely a Lock here.


--
Sverre

LA3ZA
http://la3za.blogspot.com


 

Got it to run by disabling CLOSE_LOOP in approx line 67-70 in ino-file:

#define CLOSE_LOOP? ? ? ? ? ? ? ?0 // 8 must be 0

Now, if I could only get the LCD to show GPS clock time, i.e. UTC time, and not just elapsed time since power was first turned on, I would be happy!

--
Sverre

LA3ZA
http://la3za.blogspot.com


 

Hi, Sverre,
I just uploaded my implementation of Erik's design, including the code. You are welcome to grab that and try it to see if there is any difference. Though you did not implement the hardware phase detector, my code is not using that so it should not make a difference. I have been playing with this since last fall, and made a couple of mostly cosmetic changes to the display routines. Schematics, pictures, and parts lists included.?
I am still having a 'hang' issue with the display stopping after some apparently random amount of time. I think it has to do with recovery from GPS loss of signal, but have not positively confirmed that.?
73,
Bill
N5BIA


 

Thanks Bill. I tried your version of the code, but it never gets beyond "Waiting for GPS" and shows the target frequency, in my case 10.0M and it does produce 10 MHz. The serial output also stops with "waiting for GPS".

I'll try to add the pin 3 LED for the frequency alarm and see if that tells me anything more

But my hardware runs fine with the original V5.1 software straight off of the F2DC website -?

--
Sverre

LA3ZA
http://la3za.blogspot.com


 

take a look at the code I uploaded this afternoon. probably not the cleanest way, but I managed to cobble together Erik's code and some if the examples I got from FD2C and got it to work. I'm not really familiar with C, so this has been slow going for me, but at least I'm learning....


 

Sverre:
I got the clock to work using examples from previous versions of Erik's program and from examples from FD2C. Probably not the cleanest or prettiest way, as I am just learning C using this as a learning exercise. Take a look in the folder I posted today:?/g/HBTE/files/Q&D%20GPSDO
73,
Bill
N5BIA


 

Thanks? Bill,

But I cannot see that the date has changed from 16 February in the file area. Are you sure the upload went without problems?

--
Sverre

LA3ZA
http://la3za.blogspot.com


 

Good day, Sverre,
I uploaded my latest revisions, along with a jpg of the front of the unit showing the display. I am sure that this is the latest. After a restart/fresh upload,, the top line should show 10.0M, the second reads "V5.4 F2DC PD0EK" until the GPS starts. Once the GPS starts, the top line should display the UTC time...


 

Thanks Bill,

I downloaded the?code and it identifies itself as "V.5.4 F2DC PD0EK", but still hangs on "Waiting for GPS". I'll have to look into this more tomorrow, maybe there are some subtle differences between the GPS signals

73

Sverre
LA3ZA



--
Sverre

LA3ZA
http://la3za.blogspot.com


 

SVERRE,
Take a look at whether your gps outputs GPRMC or GNRMC to begin a valid fix. I am using a uBlox gps off Amazon. The default output from those is GNRMC, most others start with GPRMC. Search for GNRMC in my source code and change it.?

Sorry I didn¡¯t catch this earlier - I had the same issue when I first started playing with this last fall. Very frustrating until I started questioning whether my GPS was defective and decided to monitor the serial output.?

73,
Bill


 

That was it! Thanks, now it locks


Sverre
LA3ZA

On Sat, Feb 26, 2022 at 6:25 PM Bill Buoy <bill@...> wrote:

SVERRE,
Take a look at whether your gps outputs GPRMC or GNRMC to begin a valid fix. I am using a uBlox gps off Amazon. The default output from those is GNRMC, most others start with GPRMC. Search for GNRMC in my source code and change it.?

Sorry I didn¡¯t catch this earlier - I had the same issue when I first started playing with this last fall. Very frustrating until I started questioning whether my GPS was defective and decided to monitor the serial output.?

73,
Bill


--
Sverre

LA3ZA
http://la3za.blogspot.com


 

I also had to comment out all the Serial.print statements in the?PPSinterrupt() procedure. Probably some critical timing issue.

I have a question about the meaning of the C in the display, showing the stable_ count variable, coming from the code below.

And why is md_FL multiplied by 4, I cannot find anything similar in the original F2DC code?


73
Sverre
LA3ZA

else
? ? md_FL = float(measdif * 4);? ?// why *4?
? md_FL = md_FL / 100;
? lcd.print(md_FL);
? lcd.print("Hz ");
? if (USE_PHASE_DETECTOR)
? {
? ? lcd.print(" A");
? ? lcd.print(int(p_delta_average));
? ? p_delta_average = 0;
? }
? else
? { lcd.print(" D");
? ? lcd.print(duration);
? }
? lcd.print(" C");
? lcd.print(stable_count);
? lcd.setCursor(15, 1); // added lock state indicator oct '21 web
? if (good)
? ? lcd.print("L");
? else
? ? lcd.print("#");
}

--
Sverre

LA3ZA
http://la3za.blogspot.com


 

The print statements are not executed if the phase detector is bypassed - note the?if USE_PHASE_DETECTOR.?If this is set FALSE, those statements are skipped.
The multiplication and division convert the raw error counts to frequency in HZ for the display. The original code as well as Erik's displayed this information in scientific notation. Not being fond of on-the-fly conversions, especially if not in engineering units, I made the NANO do the work :-)
The stable count (C) is the number of times that the algorithm reaches the distance (D) count and remains within tolerance. the 'L' indicates that the algorithm was in lock during the previous C passes. At least that is my understanding of how this works. If anyone can offer an improved interpretation, I am all ears!


 

BTW, the frequency comparison is actually taking place at 2.5 MHz, not the (in this case) 10 MHz, thus the factor of four to convert the frequency error count to Hz, or fractions thereof.


 

Hi Bill

Got it - thanks for the explanation.

The print statements?are, as you say, not used without the phase detector, so they have no effect.
--
Sverre

LA3ZA
http://la3za.blogspot.com