xmikos / simplesoapy

Simple pythonic wrapper for SoapySDR library
MIT License
30 stars 7 forks source link

error on gain range when used by soapy_power for LimeSDR #1

Closed mariocannistra closed 7 years ago

mariocannistra commented 7 years ago

entering the command: soapy_power -r 2.56M -f 88M:98M -B 500k -F soapy_power_bin -O output.txt --even -T 1 --debug

I get the following output:

DEBUG: pyfftw module found (using 4 threads by default) Win32; Microsoft Visual C++ version 14.0; Boost_106300; UHD_003.010.001.001-0-gc705922a

WARNING: Sample rate 2560000.0 Hz is not supported, setting it to 192000.0 Hz! Traceback (most recent call last): File "build\temp.win-amd64-3.6\workpath\soapy_power.py.399ce066-d3a8-43ab-a0ec-ae2654d1d966.py", line 2, in File "soapypower__main.py", line 317, in main File "soapypower\power.py", line 38, in init File "site-packages\simplesoapy.py", line 114, in init__ File "site-packages\simplesoapy.py", line 230, in gain ValueError: Gain out of range (0.0, 0.0)! Failed to execute script soapy_power.py.399ce066-d3a8-43ab-a0ec-ae2654d1d966

Looking at the source, it seems that get_gain_range() returns 0 in both gain_range[0] and gain_range[1]. I think this happens because one or more amp names should be supplied. I can't find those names listed. Could you please supply a soapy_power usage example for LimeSDR using those parameters? I saw "LNA=28,VGA=12,AMP=0" but I think those are for another radio...

Thank you

mariocannistra commented 7 years ago

...also tried with -G "LNA=0,TIA=-3,PGA=0" and the error message is now: "ValueError: Unknown amplification element!"

xmikos commented 7 years ago

It seems that you have not specified right SDR device and default device get used (which is soundcard or something like that on Windows). Use --detect option to find right device.

mariocannistra commented 7 years ago

Thank you Michal. I will certainly retry this evening with --detect and then specifying the device name. Will I get a string that I can copy / paste for the device name? Also, once I will use it with the specific device name, can I then use the -G "LNA=0,TIA=-3,PGA=0" parameter? Thank you, Mario

xmikos commented 7 years ago

Yes, device string should be copy-pasteable, but if you have only one device of same kind, specifiing appropriate driver=NAME is enough.

After you specify right device string, you can then also use --info option to show device-specific settings. You will see which amplification elements (for -G option) are supported by your device. Or you can simply use -g option and specify total gain (which will be automatically distributed to available amplification elements by device driver).

mariocannistra commented 7 years ago

Hello and thank you. This command works: soapy_power -d driver=lime -r 2.56M -f 30M:60M -B 500k -F soapy_power_bin -O output.bin --even -T 5

For the -G "LNA=0,TIA=-3,PGA=0" parameter I get: unrecognized arguments: -G LNA=0,TIA=-3,PGA=0

I could not list device-specific settings because I get error: unrecognized arguments: --info

could you please give me some additional suggestions?

xmikos commented 7 years ago

Are you sure that you have latest version of soapy_power (and simplesoapy) installed? This seems like you have old version which didn't have --info and -G options. You can run soapy_power --help to see all available options and soapy_power --version to see version number.

xmikos commented 7 years ago

How did you installed soapy_power? If you have used pip, then you can upgrade with pip install --upgrade soapy_power. Or you can use MSI installer (or portable zip file) for my QSpectrumAnalyzer app which also bundles soapy_power.

mariocannistra commented 7 years ago

I've used the QSpectrumAnalyzer msi installer, days ago... tomorrow I will check versions and update, not at home now... I've noticed that I could not run the command for frequencies 15M:30M because the range exposed by the device starts from 30MHz. I remember a thread on LimeSDR Discourse forum with the method to tune below 30MHz for HF usage. And I can actually listen from 0 to 30 using SDR console v3. Could you please check if the same vco trick (I think) is feasible in soapy_power ? I would use it for Sun and Jupiter-Io emissions between 15 and 30 MHz...

xmikos commented 7 years ago

If you have used MSI installer, you should have latest version. Didn't you installed soapy_power with pip sometimes before running MSI installer (so that old version of soapy_power could be maybe used instead of new version installed by installer)? Try to run soapy_power.exe directly from Program Files folder where have you installed QSpectrumAnalyzer.

xmikos commented 7 years ago

I will look at low frequency operation. But if you specify big enough sample rate (61,44 MHz), it should cover range from 0 - 30 MHz. Or am I mistaken? I have not tried LimeSDR for HF usage yet...

mariocannistra commented 7 years ago

About previous usage of pip ... could also be, I will check. I'm using Anaconda with python 3.x I will try like you are suggesting and I could also remove everything and try a clean reinstall. About the 60MHz sample rate: will do on the pc and see... If that is the only way to work at HF it could be a game changer for my project because I hoped to be able to run at lower sampling rates on usb 2 / raspberry pi 3 . But that sampling rate is doable only with usb 3 on a more powerful single board computer... I woul run that 24/7 and power consumption would be higher if I have to use a laptop...

xmikos commented 7 years ago

I really don't know if that is the case or if there is some more clever trick how to work with LimeSDR at HF. Like I said I never tried HF. You can try to look at https://discourse.myriadrf.org forums and if you don't find answer just start a new thread.

mariocannistra commented 7 years ago

Hello Michal. I checked versions and reinstalled. Now everything works and options are there. I'm closing the issue.

About the HF coverage: I've used the following command and got output from 14.78 to 76.22 MHz. Actually more than what I need but good to see I can reach down to 15 MHz. Range is visible also in the first row of the text output below.

soapy_power -d driver=lime -r 61.44M -f 43M:48M -b 1024 -F rtl_power -u 1 -G "LNA=0,TIA=-3,PGA=0"

INFO: min_freq (after crop): 14.780 MHz
INFO: max_freq (after crop): 76.220 MHz
[INFO] SoapyLMS7::setFrequency(Rx, 0, RF, 45.5 MHz)
SetFrequency using cache values vco:1, csw:145
←[1m←[33m[WARNING] GetDC_IQ_Interp(45.5 MHz, ch=0, tx=0): no matches between [44.5, 46.5] MHz←[0m
L 1434800
2017-04-21, 16:45:12, 14780000.0, 76220000.0, 60000.0, 1638800, -91.3437, -97.3636, -139.217, -139.53

I will do further test runs just to see the best way to limit the highest frequency to my range of interest. I need to avoid wasting disk space with 24/7 runs :-)

Thank you for suggestion to post at https://discourse.myriadrf.org forums to go deeper on the HF tuning topic. Thank you.

xmikos commented 7 years ago

I have looked at discussions and it seems you should be able to receive on HF even with much lower sample rate. Trick is to use NCO (tunable element BB in SoapySDR terminology) instead of PLL (default tunable element RF in SoapySDR terminology). Unfortunately soapy_power doesn't support this (it always sets default RF frequency, which is min. 30 MHz).

I will add support for it, but it will take some time (and I am afraid I wouldn't be able to test it properly, my LimeSDR doesn't have HF-mod and I don't also have any long antenna).

xmikos commented 7 years ago

Btw. with LimeSDR don't forget to also set filter bandwidth (-w option), setting sample rate is not enough (default filter bandwidth is if I am not mistaken much lower than 60 MHz).

xmikos commented 7 years ago

Just to let you know, latest version of SimpleSoapy / soapy_power does support center frequency < 30 MHz on LimeSDR with any sample rate.

mariocannistra commented 7 years ago

Great! thank you! I will download and test latest version this evening when I'll be back at home...

Il 27 apr 2017 09:56, "Michal Krenek (Mikos)" notifications@github.com ha scritto:

Just to let you know, latest version of SimpleSoapy / soapy_power does support center frequency < 30 MHz on LimeSDR with any sample rate.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/xmikos/simplesoapy/issues/1#issuecomment-297640723, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH5YXa-icQwsYw5ZCLtC5bmYAsefMZpks5r0EokgaJpZM4NBytk .

mariocannistra commented 7 years ago

Thank you for your efforts. On May 1st I've been able to run scans on HF and successfully plotted 15 minutes of data: utc20170501160100-mcrao-hf-15 000m-30 000m-b1024-t0 1-g20 7-e15m