hamarituc / lbgpsdo

Configuration Utility for Leo Bodnar GPSDO
GNU General Public License v3.0
16 stars 8 forks source link

Hi @BatchDrake @hamarituc .. #6

Closed hamarituc closed 6 months ago

hamarituc commented 9 months ago
          Hi @BatchDrake @hamarituc ..

I just got this software working on my Linux pc. how exactly do i modify the output frequency???? is i=0; while ! python3 lbgpsdo.py m --ignore-freq-limits --fin 5000000 --n3 5 --n2-hs 10 --n2-ls 580 --n1-hs 5 --nc1-ls 58 --bw 5; do i=expr $i + 1; done; echo "$i attempts until setting" seriously the only way? I literally only want to the change the output frequency to 40 MHz as i intend to inject this into an SDR

Originally posted by @Argonghost in https://github.com/hamarituc/lbgpsdo/issues/3#issuecomment-1826434118

Argonghost commented 9 months ago

This is the error i get when i try to modify output frequency:

$ ./lbgpsdo.py modify --fout1 40000000
usage: lbgpsdo.py [-h]
                  {list,l,status,s,detail,d,modify,m,backup,b,restore,r,identify,i,analyze,a,pll,p}
                  ...
lbgpsdo.py: error: unrecognized arguments: --fout1 40000000
hamarituc commented 9 months ago

It's not as simple as it might seem to get a desired output frequency. The output frequencies are determined by a set of dividers subjected to various constraints. Furthermore the solution isn't unique. Some solutions might be more favorable in terms of jitter than others. Finding an optimal solution requires a sophisticated algorithm I didn't have the time in the past to develop it. To get a 40MHz signal you may use the following configuration.

$ lbgpsdo analyze --fin 6000000 --n3 3 --n2-hs 10 --n2-ls 256 --n1-hs 8 --nc1-ls 16 --nc2-ls 64 --bw 15 --enable-out1
Output settings
---------------
Output 1:     40.000 MHz
Output 2:               
Phase:                  
Drive level:       8 mA 

PLL settings
------------
N3     =       3  Input divider factor
N2_HS  =      10  Feedback divider factor
N2_LS  =     256  
N1_HS  =       8  Output common divider factor
NC1_LS =      16  Output 1 divider factor
NC2_LS =      64  Output 2 divider factor
SKEW   =      +0  Clock skew
BWSEL  =      15  Loop bandwith code

Frequency plan
--------------
fin    =                         6000000 Hz     GPS reference frequency
f3     =    2000000/   1 Hz =    2000000 Hz     Phase detector frequency
fosc   = 5120000000/   1 Hz = 5120000000 Hz     Oscillator frequency
fout1  =   40000000/   1 Hz =   40000000 Hz     Output 1 frequency
fout2  =   10000000/   1 Hz =   10000000 Hz     Output 2 frequency
phase  =          0/   1 s  =      0.000 s      Phase offset output 1 --> 2
       =          0/   1 °  =      0.000 °      Phase angle w.r.t output 2
pres   =         25/  16 ns =      1.562 ns     Phase offset resolution
       =         45/   8 °  =      5.625 ° 

Or as configuration file.

{
  "out1": true,
  "out2": false,
  "level": 0,
  "fin": 6000000,
  "n3": 3,
  "n2_hs": 10,
  "n2_ls": 256,
  "n1_hs": 8,
  "nc1_ls": 16,
  "nc2_ls": 64,
  "skew": 0,
  "bw": 15
}

Or write it directly to your device

$ lbgpsdo modify --fin 6000000 --n3 3 --n2-hs 10 --n2-ls 256 --n1-hs 8 --nc1-ls 16 --nc2-ls 64 --bw 15 --enable-out1
Argonghost commented 9 months ago

Thanks! so what i did was i created a bash file with:` lbgpsdo analyze --fin 6000000 --n3 3 --n2-hs 10 --n2-ls 256 --n1-hs 8 --nc1-ls 16 --nc2-ls 64 --bw 15 --enable-out1

Now how do i save this setting to allow for PLL to lock into satellite?

Thanks again

hamarituc commented 9 months ago

Thanks! so what i did was i created a bash file with:` lbgpsdo analyze --fin 6000000 --n3 3 --n2-hs 10 --n2-ls 256 --n1-hs 8 --nc1-ls 16 --nc2-ls 64 --bw 15 --enable-out1

Now how do i save this setting to allow for PLL to lock into satellite?

Thanks again

The tool has several subcommands. Please read the README.md for more details.

$ lbgpsdo modify --fin 6000000 --n3 3 --n2-hs 10 --n2-ls 256 --n1-hs 8 --nc1-ls 16 --nc2-ls 64 --bw 15 --enable-out1
Argonghost commented 9 months ago

Hi,

when i plug the LBGPSDO rf cable to an SDR via u.fl - sma cable and i run the script provided just above, i keep getting the error given by:

(DIRECTORY) argonghost@ghostOS:~/Desktop/lbgpsdo$ ./40_Mhz_save.sh 
Traceback (most recent call last):
  File "/home/argonghost/Desktop/lbgpsdo/./lbgpsdo.py", line 1469, in <module>
    args.func(args)
  File "/home/argonghost/Desktop/lbgpsdo/./lbgpsdo.py", line 1050, in command_modify
    d.write(ignore_freq_limits = args.ignore_freq_limits)
  File "/home/argonghost/Desktop/lbgpsdo/./lbgpsdo.py", line 918, in write
    self.device.send_feature_report(bytes(buf))
  File "/home/argonghost/DIRECTORY/lib/python3.10/site-packages/hid/__init__.py", line 181, in send_feature_report
    return self.__hidcall(hidapi.hid_send_feature_report,
  File "/home/argonghost/DIRECTORY/lib/python3.10/site-packages/hid/__init__.py", line 148, in __hidcall
    raise HIDException(err)
hid.HIDException: ioctl (SFEATURE): Protocol error
Argonghost commented 9 months ago

Hi @hamarituc

i still get the following status:

(DIRECTORY) argonghost@ghostOS:~/Desktop/lbgpsdo$ ./lbgpsdo.py status
9E1F0B95ED  /dev/hidraw1: SAT unlocked  PLL locked    Loss: 1

Which i believe means that it didnt lock to any satellite despite enabling 40 MHz output as instructed above, can you help me

hamarituc commented 9 months ago

Hi @hamarituc

i still get the following status:

(DIRECTORY) argonghost@ghostOS:~/Desktop/lbgpsdo$ ./lbgpsdo.py status
9E1F0B95ED  /dev/hidraw1: SAT unlocked  PLL locked    Loss: 1

Which i believe means that it didnt lock to any satellite despite enabling 40 MHz output as instructed above, can you help me

Did it work in the past from the same location with the same GPS antenna? When did the GPS receiver sync the last time? Maybe it needs up to one hour with clear sight to the sky to update the GPS almanac data. The GPS lock state is independent from the divider settings.

Argonghost commented 9 months ago

hi @hamarituc

so im using the LBGPSDO as an external square wave input into a software defined radio (My SDR allows external clock input).

im not using UBlox receiver if thats what you're asking. my software defined radio is ADALM Pluto . Im still getting this status even after one hour:

9E1F0B95ED /dev/hidraw1: SAT unlocked PLL locked Loss: 1

hamarituc commented 9 months ago

hi @hamarituc

so im using the LBGPSDO as an external square wave input into a software defined radio (My SDR allows external clock input).

im not using UBlox receiver if thats what you're asking. my software defined radio is ADALM Pluto . Im still getting this status even after one hour:

9E1F0B95ED /dev/hidraw1: SAT unlocked PLL locked Loss: 1

Do I understand correctly that there is no GPS receiver connected to you GPS driven oscillator? In this case you don't have to wonder why the satellite status flag remains on unlocked. Which advantage do you expect in comparison to the 40MHz TCXO of the ADALM Pluto?

Argonghost commented 9 months ago

@hamarituc

ADALM Pluto's 40 MHz TCXO has very high instability that is not suitable for GNSS reception. LBGPSDO outputs a square wave that has low phase noise and is excellent as a general stable clock that any generic software defined radio or 'GPS receiver' can use . ADALM pluto allows you to switch off internal TCXO and admit an externally injected clock.

my 'GPS receiver' is the ADALM Pluto. from reading online about LBGPSDO, i thought that as soon as the gps clock is connected to any target, and you specify output frequency, it establishes gps lock. am i wrong?

Argonghost commented 9 months ago

@hamarituc

https://www.youtube.com/watch?v=o2IeXpsOQig

Please look at this video . this is exactly what im trying to set up. In the video the guy has a windows PC. I have a linux PC, thats why im using your software, and im experiencing trouble establishing satellite lock , however in the video he does it in 5 seconds.

hamarituc commented 9 months ago

@hamarituc

ADALM Pluto's 40 MHz TCXO has very high instability ...

It depends on the model.

... that is not suitable for GNSS reception.

GNSS signals are very wideband spread spectrum signals and not a problem to receive even the drifting reference clocks. The narrower the signal is you want to receive the higher the more stable the reference clock has to be.

LBGPSDO outputs a square wave that has low phase noise and is excellent as a general stable clock that any generic software defined radio or 'GPS receiver' can use . ADALM pluto allows you to switch off internal TCXO and admit an externally injected clock.

It seems your model is recent enough, because it has an external clock connector. Early models didn't have that connector. The TCXOs of more recent models are of better quality ... at least a HAM radio friend who is an expert on this field told me so (https://forum.amsat-dl.org/index.php?thread/4443-adalm-pluto-rev-d-und-ptt/&postID=24832#post24832).

my 'GPS receiver' is the ADALM Pluto. from reading online about LBGPSDO, i thought that as soon as the gps clock is connected to any target, and you specify output frequency, it establishes gps lock. am i wrong?

The GPSDO performs two tasks:

  1. It outputs a very accurate reference clock: 40MHz instead of 39.9999999MHz or 40.0000001MHz.
  2. It attenuates jitter of a clock signal. Jitter is a short term variation which can be regarded a a phase modulation of an ideal unjittered clock signal.

The latter one is done by the PLL logic inside the GPSDO. The former one only works with a highly accurate reference clock provided by a GPS receiver. Otherwise the GPSDO will run unguided and you will experience a frequency drift like with your ADALM Pluto TCXO. Maybe the magnitude of this drift if lower, because of the better thermal isolation of the GPSDOs TCXO compared to the ADALM Plutos TCXO.

@hamarituc

https://www.youtube.com/watch?v=o2IeXpsOQig

Please look at this video . this is exactly what im trying to set up. In the video the guy has a windows PC. I have a linux PC, thats why im using your software, and im experiencing trouble establishing satellite lock , however in the video he does it in 5 seconds.

You wan't to do some QO-100 QSOs. In this case you have to connect the GPS receiver to the GPSDO. Configure the GPSDO such the it outputs 40MHz. Then connect the output of the GPSDO to the reference clock input of the ADALM Pluto. Connect the TX output of the ADALM Pluto to your 2.4GHz PA. Connect the RX input of the ADALM Pluto to the output of the 10GHz LNB mixer. Don't connect the GPS receiver to the RX input of your ADALM Pluto. The ADALM Pluto is not meant to be a GNSS receiver as you initially stated.

With this setup your transmit frequency is accurate as it is coherent to the GPSDO reference clock. The receiving signal may drift anyway, because the Crystal Oscillator in the LNB is usually not stabilized. But you may use the second port of the GPSDO to provide a 25MHz reference signal for the LNB so that your receiving path is coherent with the reference clock as well. Otherwise you have to guide your receiver using the beacons of the QO-100 transponder.

Argonghost commented 9 months ago

@hamarituc Thank you so much for the detailed explanation. I was not aware of this part:

The GPSDO performs two tasks:

  1. It outputs a very accurate reference clock: 40MHz instead of 39.9999999MHz or 40.0000001MHz.
  2. It attenuates jitter of a clock signal. Jitter is a short term variation which can be regarded a a phase modulation of an ideal unjittered clock signal.

However please note that although I am trying to recreate the set up (Pluto + GPSDO) in the linked video, im not doing a QO 100 application. Im doing something much simpler. I only want to receive and decode GNSS signals thats all. And according to https://github-com.translate.goog/gnss-sdr/gnss-sdr/issues/496?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=es&_x_tr_pto=ajax,elem#issuecomment-822396238, it was advised to use external GPS clock as a clock injector into ADALM Pluto in order for GNSS-SDR to work. Because when i tested it before without GPSDO it did say "No PLL" .

Any advise on this?