vsergeev / luaradio

A lightweight, embeddable software-defined radio framework built on LuaJIT
https://luaradio.io
Other
606 stars 63 forks source link

[Block] Gnuplot issues (likely) #26

Open dtaviation opened 8 years ago

dtaviation commented 8 years ago

I just installed Lua, LuaRadio, Volk, and the others. Tried the examples. The graph windows freeze immediately, then the example crashes, is there any common mistake that we noobs make?

$ uname -a Linux macmini 4.5.7-202.fc23.x86_64+debug #1 SMP Tue Jun 28 18:10:08 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ luaradio -v ./rtlsdr_am_envelope.lua 640e3 [CompositeBlock] Connected output FrequencyTranslatorBlock.out to input LowpassFilterBlock.in [CompositeBlock] Connected output LowpassFilterBlock.out to input DownsamplerBlock.in [CompositeBlock] Aliased input TunerBlock.in to input FrequencyTranslatorBlock.in [CompositeBlock] Aliased output TunerBlock.out to output DownsamplerBlock.out [CompositeBlock] Connected output RtlSdrSource.out to input TunerBlock.in [CompositeBlock] Connected output TunerBlock.out to input ComplexMagnitudeBlock.in [CompositeBlock] Connected output ComplexMagnitudeBlock.out to input SinglepoleHighpassFilterBlock.in [CompositeBlock] Connected output SinglepoleHighpassFilterBlock.out to input LowpassFilterBlock.in [CompositeBlock] Connected output LowpassFilterBlock.out to input MultiplyConstantBlock.in [CompositeBlock] Connected output MultiplyConstantBlock.out to input PulseAudioSink.in [CompositeBlock] Connected output TunerBlock.out to input GnuplotSpectrumSink.in [CompositeBlock] Connected output MultiplyConstantBlock.out to input GnuplotSpectrumSink.in [CompositeBlock] Dependency order: [CompositeBlock] RtlSdrSource [CompositeBlock] .out -> {FrequencyTranslatorBlock.in} [CompositeBlock] FrequencyTranslatorBlock [CompositeBlock] .in <- {RtlSdrSource.out} [CompositeBlock] .out -> {LowpassFilterBlock.in} [CompositeBlock] LowpassFilterBlock [CompositeBlock] .in <- {FrequencyTranslatorBlock.out} [CompositeBlock] .out -> {DownsamplerBlock.in} [CompositeBlock] DownsamplerBlock [CompositeBlock] .in <- {LowpassFilterBlock.out} [CompositeBlock] .out -> {ComplexMagnitudeBlock.in, GnuplotSpectrumSink.in} [CompositeBlock] ComplexMagnitudeBlock [CompositeBlock] .in <- {DownsamplerBlock.out} [CompositeBlock] .out -> {SinglepoleHighpassFilterBlock.in} [CompositeBlock] GnuplotSpectrumSink [CompositeBlock] .in <- {DownsamplerBlock.out} [CompositeBlock] SinglepoleHighpassFilterBlock [CompositeBlock] .in <- {ComplexMagnitudeBlock.out} [CompositeBlock] .out -> {LowpassFilterBlock.in} [CompositeBlock] LowpassFilterBlock [CompositeBlock] .in <- {SinglepoleHighpassFilterBlock.out} [CompositeBlock] .out -> {MultiplyConstantBlock.in} [CompositeBlock] MultiplyConstantBlock [CompositeBlock] .in <- {LowpassFilterBlock.out} [CompositeBlock] .out -> {PulseAudioSink.in, GnuplotSpectrumSink.in} [CompositeBlock] PulseAudioSink [CompositeBlock] .in <- {MultiplyConstantBlock.out} [CompositeBlock] GnuplotSpectrumSink [CompositeBlock] .in <- {MultiplyConstantBlock.out} [CompositeBlock] Parent pid 19237 [CompositeBlock] Block RtlSdrSource pid 19242 [CompositeBlock] Block FrequencyTranslatorBlock pid 19243 [CompositeBlock] Block LowpassFilterBlock pid 19244 [CompositeBlock] Block DownsamplerBlock pid 19246 [CompositeBlock] Block ComplexMagnitudeBlock pid 19247 [CompositeBlock] Block GnuplotSpectrumSink pid 19248 [CompositeBlock] Block SinglepoleHighpassFilterBlock pid 19249 [CompositeBlock] Block LowpassFilterBlock pid 19250 [CompositeBlock] Block MultiplyConstantBlock pid 19251 [CompositeBlock] Block PulseAudioSink pid 19252 [CompositeBlock] Block GnuplotSpectrumSink pid 19253 Found Rafael Micro R820T tuner [R82XX] PLL not locked! Exact sample rate is: 1102500.002464 Hz [R82XX] PLL not locked! Using Volk machine: avx2_64_mmx_orc Using Volk machine: avx2_64_mmx_orc Using Volk machine: avx2_64_mmx_orc Using Volk machine: avx2_64_mmx_orc Using Volk machine: avx2_64_mmx_orc [CompositeBlock] Child exited. Shutting down...

vsergeev commented 8 years ago

The gnuplot plotting sinks are admittedly finicky. I've heard reports ranging from them running fine, to plots stacking on top of one another (see #14), to crashes like this. Needless to say, they're a temporary solution to plotting for the time being, until a dedicated and more reliable program or library is found.

One thing that might help is trying different gnuplot "terminals", which are basically the front-ends / rendering engines. The three primary interactive ones on *nix systems seem to be x11 (often the default), wxt, and qt. The wxt one works well for me, and I've made it the default by adding the following line to a .gnuplot configuration file in my home directory:

set terminal wxt enhanced font 'Verdana,10'

Everything else you're doing looks totally fine, with the exception of the tuning frequency for the AM example. 640 kHz is outside of the tuning range of the RTL-SDR (whose tuning range is about ~25 MHz to ~1750 MHz). You'll likely need an upconverter to run the AM and SSB examples. With an upconverter, you would pick a tuning frequency like 125.640e6, in other words, 125 MHz from the upconverter + 640 kHz for the desired frequency. I would try one of the FM demos first, which the RTL-SDR can readily receive.

You can also temporarily disable plotting for these demos by unsetting the DISPLAY variable in the terminal (the examples check for this environment variable to decide whether or not to connect the plotting sinks). That will let you at least run the examples to record to a WAV file or decode something to the terminal. For example:

$ unset DISPLAY
$ luaradio rtlsdr_wbfm_stereo.lua 91.1e6
...
$ vlc wbfm_stereo.wav

Let me know if your situation improves.