Floating point error in tuner_r82xx.c

Steve Knoeck knoeck at yahoo.com
Wed Jan 11 07:06:17 UTC 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20170111/df957979/attachment.html>


More information about the osmocom-sdr mailing list