junzis / pyModeS

Python decoder for Mode S and ADS-B signals
GNU General Public License v3.0
546 stars 153 forks source link

[R82XX] PLL not locked #133

Closed WilliamZhang20 closed 7 months ago

WilliamZhang20 commented 2 years ago

Hi, I'm trying to see the data with the command modeslive --source rtlsdr since I'm using a RTL-SDR. I've installed pyModeS, pyrtlsdr but I get this problem:

~ $ modeslive --source rtlsdr 
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 2000000.052982 Hz
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/pyModeS/extra/rtlreader.py", line 181, in run
    self._read_callback(data, None)
  File "/home/pi/.local/lib/python3.9/site-packages/pyModeS/extra/rtlreader.py", line 159, in _read_callback
    messages = self._process_buffer()
  File "/home/pi/.local/lib/python3.9/site-packages/pyModeS/extra/rtlreader.py", line 79, in _process_buffer
    threshold = max(frame_pulses) * 0.2
ValueError: max() arg is an empty sequence

Reattached kernel driver

Right after I run the command, the correct screen (from the repo README) does show up, but it never detects any aircraft. After about 30 seconds, the screen cuts out and the traceback is printed. I've searched everywhere, but have not been able to solve it. Even when I set my latlon, the results were the same. I've also gotten

rtlsdr_demod_write_reg failed with -1 
r82xx_write: i2c wr failed=-9 reg=06 len=1

For more information:

Is there any way for me to fix this problem? Thanks.

appaie commented 7 months ago

hey ive got the exact same problem, have u gotten any solution? cheers

WilliamZhang20 commented 7 months ago

Woah a reply two years later, a lot has changed :)

It turns out, that updating the Python version from 3.5 to 3.9 in a Raspberry Pi to fit the Python and numpy requirements of pyModeS did not work. It caused the computer to malfunction, which made me have to factory reset the whole thing!

Long story short: I would say the issue here is quite complex, as it involves both potential hardware and software issues. For example, you can check this link on PLL locking. Previously I also encountered bias tee issues, but what made it 100% work for me was to install MalcolmRobb or Antirez's dump1090 and follow its structure.

However, if pyModeS is for you, as it does look much better overall in retrospect, then I recommend either getting a better antenna or plugging it into a more modern Raspberry Pi. I had used Debian 9 (Stretch), which only contains versions 2.7 and 3.5 of Python. To update Python while still in Stretch is very risky. It would be safer to start with a Raspberry Pi that has Debian version 11 (Bullseye) or newer.

Cheers and good luck.

xoolive commented 7 months ago

Indeed this doesn't look like a pyModeS bug, more something with pyrtlsdr

I would just say the purpose of pyModeS is not to be a replacement for dump1090: the demodulation part is super naive anyway, even for a 2M demodulation, and all dump1090 forks do better.

However, pyModeS is quite good for offline re-decoding of messages when you have info missing from what you collected before.

I would close that bug if you don't mind: look at that script for what is is, just some basic example, "it would be possible". It's not optimised for that kind RTL-SDR decoding.