Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU Radio KrakenSDR Block: "Exception: Failed to get IQ Samples" #5

Closed
ADolbyB opened this issue Mar 8, 2024 · 6 comments
Closed

Comments

@ADolbyB
Copy link

ADolbyB commented Mar 8, 2024

Hello,

I am having a problem using the KrakenSDR in GNU Radio. It seems it will not get IQ samples. Here is all the information I collected so far. My apologies for the length of this post, but I was trying to be as comprehensive as possible:

PC Specs:
Dell Precision 5540 i9-9880H 2.3Ghz, 64GB RAM.
GNU Radio v3.10.7.0
Using a 20W Apple USB-C Charger Brick for iPad with Anker fast charging cables as the Kraken Power Supply.

  1. Linux Mint 21.3 Fresh Install on separate partition

  2. Install all system updates.

  3. Install the following per Install Scripts

sudo apt update
sudo apt-get install g++-12
  1. Install the following per Kraken Forum:
sudo apt update
sudo apt-get install libc++-dev libc++abi-dev
  1. Install GNU Radio and PPA:
sudo add-apt-repository ppa:gnuradio/gnuradio-releases
sudo apt-get update
sudo apt-get install gnuradio python3-packaging
  1. Make new directory, download and run the Install Script:
mkdir ~/krakensdr_doa
cd krakensdr_doa
wget https://raw.githubusercontent.com/krakenrf/krakensdr_docs/main/install_scripts/krakensdr_x86_install_doa.sh
sudo chmod +x krakensdr_x86_install_doa.sh
./krakensdr_x86_install_doa.sh

*** Note that during this step, the make process fails due to a missing rtl-sdr.h file not found.
Here is a snippet of the output:

Cloning into 'heimdall_daq_fw'...
remote: Enumerating objects: 1398, done.
remote: Counting objects: 100% (270/270), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 1398 (delta 241), reused 230 (delta 226), pack-reused 1128
Receiving objects: 100% (1398/1398), 1.95 MiB | 4.95 MiB/s, done.
Resolving deltas: 100% (910/910), done.
cp: cannot stat '/home/sdr/librtlsdr/build/src/librtlsdr.a': No such file or directory
cp: cannot stat '/home/sdr/librtlsdr/include/rtl-sdr.h': No such file or directory
cp: cannot stat '/home/sdr/librtlsdr/include/rtl-sdr_export.h': No such file or directory
gcc -Wall -std=gnu99 -march=native -O2 -I. -c -o ini.o ini.c
gcc -Wall -std=gnu99 -march=native -O2 -I. -c -o log.o log.c
gcc -Wall -std=gnu99 -march=native -O2 -I. -c -o iq_header.o iq_header.c
gcc -Wall -std=gnu99 -march=native -O2 -I. -c -o sh_mem_util.o sh_mem_util.c
gcc -Wall -std=gnu99 -march=native -O2 -I. log.o ini.o iq_header.o -o rtl_daq.out rtl_daq.c -lpthread -lzmq  -L. -lrtlsdr -lusb-1.0
rtl_daq.c:49:10: fatal error: rtl-sdr.h: No such file or directory
   49 | #include "rtl-sdr.h"
      |          ^~~~~~~~~~~
compilation terminated.

To fix the above error:
7) Delete and reinstall the librtlsdr library:

sudo apt purge librtlsdr*
sudo rm -rf /usr/lib/librtlsdr* /usr/include/rtl-sdr* /usr/local/lib/librtlsdr* /usr/local/include/rtl-sdr*
  1. Reinstall librtlsdr to system:
git clone https://github.com/krakenrf/librtlsdr
cd librtlsdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig 
echo 'blacklist dvb_usb_rtl28xxu' | sudo tee --append /etc/modprobe.d/blacklist-dvb_usb_rtl28xxu.conf
  1. Remake the _daq_core:
cd ~/krakensdr_doa/heimdall_daq_fw/Firmware/_daq_core
make

and now the _daq_core will build.

  1. Install gr-krakensdr GNU Radio Block as per GNU Radio OOT Block Install Instructions
sudo apt-get install gnuradio-dev cmake libspdlog-dev clang-format
git clone https://github.com/krakenrf/gr-krakensdr
cd gr-krakensdr
mkdir build
cd build
cmake ..
make
sudo make install
  1. Edit daq_chain_config.ini:
cd ~/krakensdr_doa/heimdall_daq_fw/Firmware
nano daq_chain_config.ini

Make the following changes:

[data_interface]
out_data_iface_type = eth
  1. Run ./heimdall_only_start.sh: This script starts and shows the Have Coffee Watch Radar and seems to be working properly.
    Run gnuradio-companion & and try to run the in the kraken_fft_display.grc in the ~/gr-krakensdr/examples folder.
    The following is shown in the Terminal:
Generating: '/home/sdr/gr-krakensdr/examples/kraken_fft_display.py'
>>> Warning: This flow graph may not have flow control: no audio or RF hardware blocks found. Add a Misc->Throttle block to your flow graph to avoid CPU congestion.

Executing: /usr/bin/python3 -u /home/sdr/gr-krakensdr/examples/kraken_fft_display.py

Qt GUI: Could not restore geometry: restoreGeometry(self, Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type 'NoneType'
Sending control message
vmcircbuf_prefs::get :info: /home/sdr/.gnuradio/prefs/vmcircbuf_default_factory failed to open: bad true, fail true, eof true
Control interface communication finished
Reconfiguration succesfully finished
Sending control message
Control interface communication finished
Reconfiguration succesfully finished
Sending control message
Control interface communication finished
Reconfiguration succesfully finished
Failed to get IQ Samples
Exception: 
Failed to get IQ Samples
Exception: 
Failed to get IQ Samples
Exception: 
Failed to get IQ Samples
Exception: 
Failed to get IQ Samples
Exception: 
Failed to get IQ Samples
Exception: 

Note that in the above case, the GUI shows, but basically 'freezes' instantly since the Kraken can't collect IQ samples.

A quick note: Prior to discovering the librtlsdr delete/reinstall to get the _daq_core to build, I had the problem where GNU Radio could not connect to the Kraken, and the output in the terminal was:
Ethernet Connection Failed, Error: <class 'ConnectionRefusedError'> with no GUI display.

So I have made some progress since that was happening.

What should I try from here?

Thanks,

-- Joel

@ADolbyB
Copy link
Author

ADolbyB commented Mar 8, 2024

Note that after the GNU Radio FFT flow graph fails to get IQ samples, If I run the kraken_test in the terminal, then I get the following output:

sdr@nTSDR05:~$ kraken_test 
Found 5 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 1004
  1:  Realtek, RTL2838UHIDIR, SN: 1000
  2:  Realtek, RTL2838UHIDIR, SN: 1001
  3:  Realtek, RTL2838UHIDIR, SN: 1002
  4:  Realtek, RTL2838UHIDIR, SN: 1003

Using device 0: Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device #0.

Unplugging Kraken from USB data port and reconnected, re-ran the ./heimdall_only_start.sh results in:

sdr@nTSDR05:~$ kraken_test 
Found 5 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 1004
  1:  Realtek, RTL2838UHIDIR, SN: 1000
  2:  Realtek, RTL2838UHIDIR, SN: 1001
  3:  Realtek, RTL2838UHIDIR, SN: 1002
  4:  Realtek, RTL2838UHIDIR, SN: 1003

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T/2 tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...
Allocating 15 (non-zero-copy) user-space buffers

If I then open 5 separate terminals and run the following:
kraken_test -d0 kraken_test -d1 kraken_test -d2 kraken_test -d3 kraken_test -d4
Then all channel tests will open and run without error.
If I then try the Kraken FFT test program again in GNU Radio, it still will not collect IQ samples (Same problem).

Thanks,
-- Joel

@krakenrf
Copy link
Owner

krakenrf commented Mar 8, 2024

Can you please post the contents of the logs from Firmware/_logs?

@ADolbyB
Copy link
Author

ADolbyB commented Mar 8, 2024

Thanks for the prompt reply.

Another quick note: After finishing the original post, I tried the kraken_correlator_test.grc and got the same results: failed to get IQ samples. However, the noise source light switches on and stays on as it is supposed to.

Here are the contents of the log files located in ~/krakensdr_doa/heimdall_daq_fw/Firmware/_logs:

  1. decimator.log has no contents (0 bytes)

  2. Here are the contents from delay_sync.log:

INFO:__main__:IQ adjustment vector: abs:[1. 1. 1. 1. 1.]
INFO:__main__:IQ adjustment vector: phase:[0. 0. 0. 0. 0.]
WARNING:shmemIface:Shared memory not exist
WARNING:shmemIface:Shared memory not exist
WARNING:shmemIface:Shared memory not exist
WARNING:shmemIface:Shared memory not exist
CRITICAL:__main__:Failed to acquire new data frame, exiting..
INFO:shmemIface:Terminate signal sent
/home/sdr/miniforge3/envs/kraken/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 6 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
  1. Here are the contents of hwc.log:
Traceback (most recent call last):
  File "/home/sdr/krakensdr_doa/heimdall_daq_fw/Firmware/_daq_core/hw_controller.py", line 702, in <module>
    HWC_inst0.start()
  File "/home/sdr/krakensdr_doa/heimdall_daq_fw/Firmware/_daq_core/hw_controller.py", line 415, in start
    active_buff_index = self.in_shmem_iface.wait_buff_free()            
  File "/home/sdr/krakensdr_doa/heimdall_daq_fw/Firmware/_daq_core/shmemIface.py", line 188, in wait_buff_free
    signal = unpack('B', os.read(self.fw_ctr_fifo, 1))[0]
struct.error: unpack requires a buffer of 1 bytes
/home/sdr/miniforge3/envs/kraken/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 2 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
/home/sdr/miniforge3/envs/kraken/lib/python3.9/multiprocessing/resource_tracker.py:229: UserWarning: resource_tracker: '/delay_sync_hwc_A': [Errno 2] No such file or directory: '/delay_sync_hwc_A'
  warnings.warn('resource_tracker: %r: %s' % (name, e))
/home/sdr/miniforge3/envs/kraken/lib/python3.9/multiprocessing/resource_tracker.py:229: UserWarning: resource_tracker: '/delay_sync_hwc_B': [Errno 2] No such file or directory: '/delay_sync_hwc_B'
  warnings.warn('resource_tracker: %r: %s' % (name, e))
  1. iq_server.log has no contents (0 bytes)

  2. logs file contents:

Realtek data acquistion module : rtl_daq.log
Sample delay synchronizer      : sync.log
Sample rebuffer                : rebuffer.log
Squelch module                 : squelch.log
IQ sample decimator            : decimator.log
Delay synchronizer module      : delay_sync.log
IQ Server                      : iq_server.log
Hardware controller module     : hwc.log
  1. Contents of rebuffer.log:
00:03:44 FATAL rtl_daq.h:62: IQ header read error 
  1. contents of rtl_daq.log
Found Rafael Micro R820T/2 tuner
Found Rafael Micro R820T/2 tuner
Found Rafael Micro R820T/2 tuner
Found Rafael Micro R820T/2 tuner
Found Rafael Micro R820T/2 tuner
Allocating 12 (non-zero-copy) user-space buffers
Allocating 12 (non-zero-copy) user-space buffers
Allocating 12 (non-zero-copy) user-space buffers
Allocating 12 (non-zero-copy) user-space buffers
Allocating 12 (non-zero-copy) user-space buffers
rtlsdr_demod_write_reg failed with -9
r82xx_write_arr: i2c wr failed=-9 reg=05 len=1
rtlsdr_demod_write_reg failed with -9
r82xx_write_arr: i2c wr failed=-9 reg=05 len=1
rtlsdr_demod_write_reg failed with -9
r82xx_write_arr: i2c wr failed=-9 reg=05 len=1
rtlsdr_demod_write_reg failed with -9
r82xx_write_arr: i2c wr failed=-9 reg=05 len=1
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9
rtlsdr_demod_write_reg failed with -9

@krakenrf
Copy link
Owner

krakenrf commented Mar 9, 2024

rtlsdr_demod_write_reg failed with -9

This is the core problem. This usually means that there is some problem communicating with the KrakenSDR. So most likely a USB data cable problem. Please try another high quality USB cable, and also try the ports on the back of your PC. Sometimes the ports on the front of desktop computers are internally connected with very low quality cabling, and so they won't work well with high data rate devices.

It could also be a power supply issue, but the Apple charger is probably going to be good quality unless it happens to be a fake Apple product.

Edit: Just realized the Dell Precision 5540 is a laptop. Still try other USB ports on the laptop. If you're using a dock try eliminate that too.

@ADolbyB
Copy link
Author

ADolbyB commented Mar 10, 2024

Thank you for the feedback.

I have on order some new cables and a bigger power supply.

I'll check back after they arrive and I get this up and running so we can close this issue.

Thanks Again,

-- Joel

@ADolbyB
Copy link
Author

ADolbyB commented Apr 3, 2024

Hi again,

Thanks for your patience. I had some time to test this issue, and it seems like the KrakenSDR just does not like my laptop for some reason. As a result I will close this issue.

Just an FYI for anyone who wants to know, the cables and charger I ordered were Anker brands:

They worked excellent in my case, however, that was not the solution to this problem.

I fired up another laptop with a Win10 image and WSL2 running Ubuntu 22.04. I installed the USBIPD-WIN package and was able to bind the 5 KrakenSDR radios to WSL. I did a manual x86_64 install of the krakensdr_doa and gr-krakensdr in WSL2 the same way as i described at the beginning of this post. When I fire up the kraken_fft_display.grc It seemed to work pretty well. No dropped IQ samples this time and no failures. Although this is not ideal, it is something I can deal with. It appears to be some problem with my laptop USB ports and not related to the KrakenSDR.

Thanks for all your help and Best Regards,

--Joel

@ADolbyB ADolbyB closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants