Discussion:
[Hackrf-dev] Precise synthesizer tuning
Phil Karn
2018-09-23 02:06:32 UTC
Permalink
I would like to determine the *exact* frequency of the HackRF when set
to a given frequency. Like nearly all modern tuners they use
"fractional-N" synthesis. They can only tune to frequency steps that are
often not a simple fraction of 1 Hz, and this step size often varies
with operating band.

I'd like to have either of two things, ideally both:

A formula that gives the exact frequency to which the HackRF tunes when
set to frequency 'f'.

A frequency where the HackRF synthesizer is exactly correct (assuming an
accurate timing reference) and the minimum frequency step that will keep
the synthesizer exactly on frequency throughout the HackRF's coverage
range. (This step size may vary with band as various dividers are
changed, but using the largest step size across the full coverage is the
easiest way.)

If I know the actual frequency of the synthesizer I can easily correct
for any offset in the software oscillator I use to downconvert the low
digital IF to DC.

I could probably figure this out by digging into the firmware and the
synthesizer data sheets, but I wanted to first see if someone could save
me the trouble.

Thanks!

Phil Karn, KA9Q
Michael Ossmann
2018-09-26 07:36:52 UTC
Permalink
Phil,

Unfortunately the answer is rather complicated because there are two
frequency synthesizers involved, not just one. The code that handles
tuning in the firmware is set_freq() here:

https://github.com/mossmann/hackrf/blob/master/firmware/common/tuning.c#L57

To determine the exact frequency you would have to look at that function
and the functions it calls to set the frequency of the two
mixer/synthesizer parts (and read the data sheets of those parts).

It's a bit simpler if you use set_freq_explicit (which is invoked when
using certain command line options with hackrf_transfer) because it
lacks the fancy automatic IF determination that tries to avoid spurs
that can be caused by various harmonics.

I think it would be a good idea to provide an easy way to retrieve this
information from a running HackRF, so I've added an enhancement to the
issues list:

https://github.com/mossmann/hackrf/issues/524

One way to accomplish part of that functionality today would be to use
the hackrf_debug command to retrieve register values from the max2837
and rffc5072, but you'd still have to read the data sheets to know how
to compute the frequencies from the register values.

Mike
Post by Phil Karn
I would like to determine the *exact* frequency of the HackRF when set
to a given frequency. Like nearly all modern tuners they use
"fractional-N" synthesis. They can only tune to frequency steps that are
often not a simple fraction of 1 Hz, and this step size often varies
with operating band.
A formula that gives the exact frequency to which the HackRF tunes when
set to frequency 'f'.
A frequency where the HackRF synthesizer is exactly correct (assuming an
accurate timing reference) and the minimum frequency step that will keep
the synthesizer exactly on frequency throughout the HackRF's coverage
range. (This step size may vary with band as various dividers are
changed, but using the largest step size across the full coverage is the
easiest way.)
If I know the actual frequency of the synthesizer I can easily correct
for any offset in the software oscillator I use to downconvert the low
digital IF to DC.
I could probably figure this out by digging into the firmware and the
synthesizer data sheets, but I wanted to first see if someone could save
me the trouble.
Thanks!
Phil Karn, KA9Q
_______________________________________________
HackRF-dev mailing list
https://pairlist9.pair.net/mailman/listinfo/hackrf-dev
Loading...