Mictronics / pluto-gps-sim

PLUTO-GPS-SIM generates a GPS baseband signal IQ data stream, which is then transmitted by the software-defined radio (SDR) platform ADALM-Pluto.
MIT License
101 stars 50 forks source link

Error opening PLUTOSDR TX device: No such file or directory and segmentation error. #9

Closed fojac closed 4 years ago

fojac commented 4 years ago

When launching pluto-gps-sim (compiled fine, as well as other dependencies), either with -N pluto.local (pinging the pluto is OK) or with -U usb:1.6.5 (from iio_info -s), I get the following error :

'Using static location mode. Gain: -30.0dB RINEX date = 20200630 13:02: Start time = 2020/06/30,12:00:00 (2112:216000) PRN Az El Range Iono 10 131.7 35.4 22497854.6 2.4 Error opening PLUTOSDR TX device: No such file or directory'

Output of iio_info -s : Library version: 0.21 (git tag: 565bf68) Compiled with backends: local xml ip usb serial Available contexts: 0: ... [local:] 1: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=1044735411960006f2ff340008241XXXXX [usb:1.6.5]

When I do a iio_info -n pluto.local, I can grab all the information about the pluto : Library version: 0.21 (git tag: 565bf68) Compiled with backends: local xml ip usb IIO context created with network backend. Backend version: 0.18 (git tag: v0.18 ) Backend description string: 192.168.2.1 Linux (none) 4.14.0-42540-g387d584 #301 SMP PREEMPT Wed Jul 3 15:06:53 CEST 2019 armv7l IIO context has 9 attributes: hw_model: Analog Devices PlutoSDR Rev.B (Z7010-AD9364) hw_model_variant: 0 hw_serial: 1044735411960006f2ff34000824XXXXXX fw_version: v0.31 ad9361-phy,xo_correction: 40000000 ad9361-phy,model: ad9364 local,kernel: 4.14.0-42540-g387d584 ip,ip-addr: 192.168.2.1 uri: ip:pluto.local IIO context has 5 devices: (...) iio:device3: cf-ad9361-dds-core-lpc (buffer capable) 6 channels found: voltage0: (output, index: 0, format: le:S16/16>>0) 4 channel-specific attributes found: attr 0: calibphase value: 0.000000 attr 1: calibscale value: 1.000000 attr 2: sampling_frequency value: 2083998 attr 3: sampling_frequency_available value: 2083998 260499 voltage1: (output, index: 1, format: le:S16/16>>0) 4 channel-specific attributes found: attr 0: calibphase value: 0.000000 attr 1: calibscale value: 1.000000 attr 2: sampling_frequency value: 2083998 attr 3: sampling_frequency_available value: 2083998 260499 altvoltage3: TX1_Q_F2 (output) 5 channel-specific attributes found: attr 0: frequency value: 403443 attr 1: phase value: 0 attr 2: raw value: 1 attr 3: sampling_frequency value: 2083998 attr 4: scale value: 0.000000 (...) Line 1662, the code seems to look for the string "cf-ad9361-dds-core-lpc", which exists in the iio_info output, so I don't get it, if anyone has encountered that or has an idea ;-)

Eduardo-F commented 4 years ago

Try -N and Pluto_IP, for example: -N 192.168.2.1

fojac commented 4 years ago

Thanks for your answer, but unfortunately the result is the same. ./pluto-gps-sim -e .... -A -30.0 -l ....,100 -N 192.168.2.10 Using static location mode. Gain: -30.0dB RINEX date = 20200630 13:02: Start time = 2020/06/30,12:00:00 (2112:216000) PRN Az El Range Iono 10 131.7 35.4 22497854.6 2.4 Error opening PLUTOSDR TX device: No such file or directory Segmentation Error

Mictronics commented 4 years ago

@Eduardo-F What libiio version is showing iio_info -s for you? Mine is 0.18 and works.

fojac commented 4 years ago

iio_info -s Library version: 0.21 (git tag: 565bf68) Compiled with backends: local xml ip usb serial Available contexts: 0: ... 1: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=1044735411960006f2ff34xxxxx [usb:1.12.5]

Mictronics commented 4 years ago

@Eduardo-F Was asking for his version.

Eduardo-F commented 4 years ago

I'm sorry, My libiio version is 0.17 (git tag: v0.17)

Mictronics commented 4 years ago

Might be an issue that comes with libiio v0.21. Will test...

Eduardo-F commented 4 years ago

Might be an issue that comes with libiio v0.21. Will test...

This point is for @fojac, right?

Mictronics commented 4 years ago

For myself :)

Mictronics commented 4 years ago

This is how it works for me with libiio 0.21 installed. (also latest libad9361-iio)

:$ iio_info -s
Library version: 0.21 (git tag: 565bf68)
Compiled with backends: local xml ip usb serial
Unable to create Local IIO context : No such file or directory
Available contexts:
    0: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=104400b83991000b0f000400bad8645e1b [usb:3.3.5]

The error seems to raise when no context is given.

:$ iio_info -a
Library version: 0.21 (git tag: 565bf68)
Compiled with backends: local xml ip usb serial
Using auto-detected IIO context at URI "usb:3.3.5"
IIO context created with usb backend.
Backend version: 0.18 (git tag: v0.18  )
Backend description string: Linux (none) 4.14.0-42540-g387d584 #301 SMP PREEMPT Wed Jul 3 15:06:53 CEST 2019 armv7l
IIO context has 9 attributes:
    hw_model: Analog Devices PlutoSDR Rev.B (Z7010-AD9363A)
    hw_model_variant: 1
    hw_serial: 104400b83991000b0f000400bad8645e1b
    fw_version: v0.31
    ad9361-phy,xo_correction: 39999997
    ad9361-phy,model: ad9363a
    local,kernel: 4.14.0-42540-g387d584
    ip,ip-addr: 192.168.2.1
    uri: ip:192.168.2.1

-a doesn't raise an error, while it searches and use a context when found.

:$ ./pluto-gps-sim -e brdc.n -l 43.9,12.4,328 -T now  -N pluto.local -v  -A -20.0
Using static location mode.
     4.657e-09    1.490e-08   -5.960e-08   -1.192e-07
     8.192e+04    8.192e+04   -6.554e+04   -5.243e+05
    -9.31322574615e-10  -1.77635683940e-15     147456      2113
    18
Gain: -20.0dB
RINEX date = 04-JUL-20 05:09
Start time = 2020/07/04,09:13:29 (2112:551609)
PRN   Az    El     Range     Iono
01  194.7  49.7  21135863.5   2.5
07  246.6  45.4  21529675.8   2.6
08   48.5  63.7  20735139.3   2.1
10   54.5  18.0  24031932.3   4.3
11  217.8  83.6  20005003.2   1.9
13  323.2   2.0  25515409.0   4.9
16  122.1  17.0  24232097.0   5.3
20   28.2   2.3  25476505.1   4.8
21   43.2   6.2  25776521.8   5.1
22  155.5  10.5  24488164.1   6.3
27   68.5  31.4  22699583.3   3.4
28  305.6  15.4  24531999.4   3.8

pluto-gsp-sim runs without changes.

So I'm not sure what is the problem for @fojac.

Build commands I use for both libraries (in this order):

git clone -q --branch master --depth 1 --single-branch https://github.com/analogdevicesinc/libiio.git
cd libiio
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
make
make install
ldconfig
...
git clone -q --branch master --depth 1 --single-branch https://github.com/analogdevicesinc/libad9361-iio.git
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
make
make install
ldconfig
fojac commented 4 years ago

Thanks a lot for your tests. I will try with those settings and report. However, the segmentation error is a little weird. I'll let you know.

fojac commented 4 years ago

./pluto-gps-sim -e brdc1880.20n -l 43.9,12.4,328 -T now -N pluto.local -v -A -20.0 Using static location mode. 4.657e-09 1.490e-08 -5.960e-08 -1.192e-07 8.192e+04 8.192e+04 -6.554e+04 -5.243e+05 3.72529029846e-09 9.76996261670e-15 319488 2113 18 Gain: -20.0dB RINEX date = 06-JUL-20 04:53 Start time = 2020/07/06,09:18:45 (2113:119925) PRN Az El Range Iono 01 195.5 56.7 20751424.7 2.3 03 166.9 0.0 25753736.8 8.4 07 239.0 41.6 21739453.6 2.8 08 56.3 58.8 20955605.8 2.2 10 48.9 17.1 24114480.5 4.4 11 91.7 89.7 19934885.8 2.0 13 318.0 1.2 25609257.6 4.9 16 125.5 12.2 24732630.8 6.1 21 43.9 2.6 26151445.7 5.4 22 152.6 15.5 23997863.2 5.5 27 72.5 26.6 23132338.0 3.8 28 307.4 20.3 24081829.1 3.6 Error opening PLUTOSDR TX device: No such file or directory Segmentation error.

I have redownloaded and recompiled the two libs with your settings, without any noticeable error. And I'm still seing the Pluto SDR when doing a iio_info-s (as "available context"). Very weird.

Mictronics commented 4 years ago

Can you provide more details about the OS in use? Did you try running pluto-gps-sim with sudo?

fojac commented 4 years ago

Yes, of course, it's a Debian 10 up to date.

Mictronics commented 4 years ago

Please try the following.

Replace line 1662
tx = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
with
tx = iio_context_get_device(ctx, 3);
Compile and run.
fojac commented 4 years ago
Thanks for your proposal. During the compile process, I have the following warning: make all cc -std=c11 -O2 -g -W -Wall -D_GNU_SOURCE -I/usr/local/include -c plutogpssim.c -o plutogpssim.o plutogpssim.c: In function ‘pluto_tx_thread_ep’: plutogpssim.c:1662:38: warning: passing argument 2 of ‘iio_context_get_device’ makes integer from pointer without a cast [-Wint-conversion] 1662 tx = iio_context_get_device(ctx, "3"); ^~~
char *

In file included from plutogpssim.c:23: /usr/local/include/iio.h:537:46: note: expected ‘unsigned int’ but argument is of type ‘char ’ 537 | api check_ret __pure struct iio_device iio_context_get_device( | ^~~~~~ cc plutogpssim.o -lm -lpthread -lcurl -o pluto-gps-sim -I/usr/local/include -L/usr/local/lib -liio -lad9361 But the compilation terminates fine. The result is the same: sudo ./pluto-gps-sim -e brdc1890.20n -l 43.9,12.4,328 -T now -N pluto.local -v -A -20.0 Using static location mode. 4.657e-09 1.490e-08 -5.960e-08 -1.192e-07 8.192e+04 8.192e+04 -6.554e+04 -5.243e+05 3.72529029846e-09 9.76996261670e-15 319488 2113 18 Gain: -20.0dB RINEX date = 07-JUL-20 01:26 Start time = 2020/07/07,06:31:41 (2113:196301) PRN Az El Range Iono 01 150.4 31.1 22500321.4 2.6 07 220.6 75.2 20332695.6 1.5 08 51.8 55.4 21070084.2 1.8 09 208.1 9.3 24763703.3 4.1 11 124.8 62.8 20619577.4 1.6 13 320.4 13.5 24266432.5 3.8 16 89.8 5.2 25406547.1 5.3 17 227.6 2.9 25352965.0 4.8 21 31.1 4.5 25977057.5 4.6 27 50.6 21.9 23487664.6 3.2 28 283.7 26.4 23383961.3 2.9 30 297.3 54.9 21101850.2 1.8 Error opening PLUTOSDR TX device: No such file or directory Segmentation error As the iio_info returns the Pluto as context number 1, I've also tried with 1 instead of 3, but got no more luck :-(

fojac commented 4 years ago

I think I've narrowed the issue. Seems the former owner has modified the firmware according to https://www.rtl-sdr.com/adalm-pluto-sdr-hack-tune-70-mhz-to-6-ghz-and-gqrx-install/ in order to widen the frequency range. So the Pluto might see itself as an ad9364. iio_info -n pluto.local | grep 9364 hw_model: Analog Devices PlutoSDR Rev.B (Z7010-AD9364) ad9361-phy,model: ad9364 Do you think this could be the issue?

Mictronics commented 4 years ago

Mine is a AD9363A based device. This hack might be the explanation for the error. From what I understood it should be reversible. You may try that.

Your compiler error is because you put 3 as a string instead of a integer number.

fojac commented 4 years ago

After resetting the Pluto with the default values: fw_printenv attr_name Error: "attr_name" not defined fw_printenv attr_val Error: "attr_val" not defined and restarting with a fresh git clone and compilation, the problem unfortunately remains the same (the pluto is seen OK and answers to ping too). I think I'll try with an "older" or different linux distro, just to make sure.

fojac commented 4 years ago

I've managed to make a working setup with an uptodate Ubuntu 18.04.4 LTS, the same Pluto and the same compilation process. Very weird it's not working on a Debian 10, I'll have to figure out why sometimes. Thanks for your time.