Floating point error in tuner_r82xx.c

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Cinaed Simson cinaed.simson at gmail.com
Mon Feb 27 05:46:56 UTC 2017


On 01/10/2017 11:06 PM, Steve Knoeck wrote:
> Hi,
> 
> I get a floating point exception when I run rtl_tcp.  I traced the error
> with GDB to line 515 of tuner_r82xx.c
>     if (vco_fra > (2 * pll_ref_khz / n_sdm))
> I found that n_sdm was 0.
> 
> I don't understand how this code work and I'm very new to this software
> but it sure looks like a programming bug.
> 
> |   513          /* sdm calculator */||
> ||   514          while (vco_fra > 1) {||
> ||   515                  if (vco_fra > (2 * pll_ref_khz / n_sdm)) {||
> ||   516                          sdm = sdm + 32768 / (n_sdm / 2);||
> ||   517                          vco_fra = vco_fra - 2 * pll_ref_khz /
> n_sdm;||
> ||   518                          if (n_sdm >= 0x8000)||
> ||   519                                  break;||
> ||   520                  }||
> ||   521                  n_sdm <<= 1;||
> ||   522          }|
> 
> If the condition on line 515 ever evaluates to false then vco_fra
> doesn't get updated.  The loop will keep repeating with the same value
> of vco_fra until n_sdm becomes 0. 
> 
> Steve

I'm using rtl_tcp from
http://git.osmocom.org/rtl-sdr/rtl-sdr-0.5.3.tar.xz with
gnuradio-3.7.10.1 and it works perfectly.

Which version are you using?

-- Cinaed




More information about the osmocom-sdr mailing list