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;

The main differences versus the original osmocom code are

1) the old code works in kHz and runs into rounding issues since the
smallest frequency step is actually 400Hz-ish
2) the manual long division code looks dodgy (as Michele also noted)

This bit of the osmocom code seems to have been inherited wholesale from
the original "realtek driver" back in the mists of history - see e.g.
https://github.com/n1gp/gr-baz/blob/master/lib/rtl2832-tuner_r820t.cc - I
don't know if it's had much (any?) review.

FWIW I am just working empirically here - I don't have details of the
underlying hardware, I'm just assuming it's set up so that the VCO divisor
is effectively N + M/65536 since that seems plausible.

If the IF of the RTL2832U can be tweaked as Michele suggests (I have not
looked there at all) then you could improve the precision further.

Oliver

Reply via email to