On 24 August 2014 01:22, Oliver Jowett <[email protected]> wrote:

> On 24 August 2014 01:00, keenerd <[email protected]> wrote:
>
>>
>>
> I am a bit curious about the sigma-delta-mod math.  We've got three
>> different sdm calculations now.  The one in osmocom's repo, this new
>> one from O. Jowett and M. Bavaro's version
>> (
>> http://michelebavaro.blogspot.com/2014/05/gnss-carrier-phase-rtlsdr-and.html
>> ).
>>
>
> Michele's looks equivalent to mine, I think; we seem to have independently
> come up with the same thing:
>
> vco_div = (pll_ref + 65536 * vco_freq) / (2 * pll_ref);
> sdm = (uint32_t) (vco_div % 65536);
>
> vs
>
> mysdm = (((vco_freq<<16)+pll_ref)/(2*pll_ref)) & 0xFFFF;
>

This part is equivalent but there's a corresponding change in calculating
the integer part of the divisor that's needed. This affects a small range
of VCO frequencies just below integer multiples of 2*pll_ref.

e.g. with pll_ref = 28.8MHz, vco_freq = 4*pll_ref-1 = 115.199999MHz, my
code yields nint=2, sdm=0 (effective VCO frequency of 115.2MHz) but
Michele's yields nint=1,sdm=0 (effective 57.6MHz)

Try tuning to 802.829990MHz (with PPM correction=0) +/- a few Hz to see
this effect (note the values below are the tuner's LO frequency, so they
include the IF offset):

[R82XX] requested 806399890Hz; selected mix_div=4 vco_freq=3225599560
nint=55 sdm=65535; actual_vco=3225599121; tuning error=-109Hz
[R82XX] requested 806399891Hz; selected mix_div=4 vco_freq=3225599564
nint=56 sdm=0; actual_vco=3225600000; tuning error=+109Hz

Oliver

Reply via email to