OP25 OP25 on RPi hangs when audio is piped to an local audio device

Status
Not open for further replies.

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
First post here as I just heard about OP25 at Max's presentation to the LARC amateur radio group in November. Thanks Max! I've had OP25 running off and on for the last month on a RPi 3 Model B. I have an issue with OP25 stability when audio output is configured in OP25.

I will use the terms "stable" and "unstable" below.
Stable means OP25 will run without issue for at least 24 hours with constant screen refreshes reflecting active talk groups. "Q" can be used to exit OP25
Unstable means OP25 will only run for 10-20 minutes when the screen refreshes fail, "Q" no longer works and a "CTRL/Z" must be used to exit.

Here are the scenarios:
Test #1 (stable): ./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -o 0 -q 2 -D cqpsk -U
No audio, just decodes as expected

Test #2 (Unstable): ./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -o 0 -q 2 -D cqpsk -U
Same command as Test #1 but use of a "t" within the command window to pass audio to the default audio device.
Audio is heard on the default audio device (RPi headphone port or Bluetooth connected speakers) until OP25 goes unstable

Test #3 (Unstable): ./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -q 2 -U -T onon.tsv
Command suggested by Max with corresponding onon.tsv
Audio is heard on the default audio device (RPi headphone port or Bluetooth connected speakers) until OP25 goes unstable

Test #4 (TBD): ./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -q 2 -O front:Set -T onon.tsv
Given some issues with ALSA audio, I have installed USB Audio Adapter dongle in an attempt to use that in lieu of onboard ALSA.
No audio on the powered speaker. I have tested the speaker successfully with: speaker-test -Dfront:Set -c2
When using the "-U" option in this test I get a "failed to set up pcm stream"

So I guess I have 2 questions:
1) Should the system be stable via the onboard ALSA sound interface?
2) If I wanted to use the USB audio dongle, what is the correct OP25 option to do that as I seemed to have failed at constructing that.

Thanks in advance,
Ron, WB2WGH
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
Which repo did you use to obtain the op25 code and how recently was it pulled? I think you are monitoring a P25 system. Is it phase 1 or 2?

The RPi3 is a curious beast - I used to run one with some success to provide a broadcastify stream, but it just wasn't as stable as other more powerful hardware. These days I run my feeds on amd64 architecture rather than ARM and experience no stability issues.

Some things I found that helped:
- use the http console rather than curses terminal
- don't leave any gnuplots active.
- minimize the sample rate

Is there anything in the log that suggests a crash or other problem, or does the app just "go to sleep"? The latter is typically what would happen to me if I tried to put rx.py into the background while the curses terminal was active.
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
So not a Raspian or Unix expert so will likely need some help to answer questions.

OP25 pulled early December 2018. File stamps are 12/9/2018. Not sure where I pulled it but here are the first 2 lines of the README:
Forked from git://git.osmocom.org/op25 "max" branch on 9/10/2017
Up to date with "max" branch as of 3/3/2018

Think monitoring Phase 1 as new to scanning also (local Syracuse, NY public safety frequency). Max gave presentation on OP25 and I had all the parts so I threw it together. BTW, the RF dongle is a FunCube Pro+ (failed to mention that in original post).


Use http: Not sure how to run via http. Any suggestions?
gnuplots: I did notice that tnuplots does consume resources and in my testing, no plots active
Sample rate: running 57600 at Max's suggestion. CPU load <10%. Runs fine so long a no audio piped.

Log files: Where are they? Don't think app is sleeping. Did not put app in background as run directly from Raspian GUI terminal window (presume that is what you refer to as "curses terminal"?

With respect to last test case (no audio), is the syntax "-O front:Set" correct for use with USB sound dongle. Surprised no audio at all with that: "aplay -L" extract is as follows:

front:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Front speakers


Thanks,
Ron
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
With respect Test Case #3, if i use the same command, change the default audio device to the USB soundcard dongle (C-Media USB Headphone Set) in Raspian, I do not get any OP25 output with the speaker yet "speaker-test -c2" works.

Ron
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
It sounds like you are using my fork (hittps://github.com/boatbod/op25) in which case I'd recommend cd'ing to the build directory and pulling updates as I've been busy making some fixes to the phase 2 code this last couple days.
Code:
cd ~/op25/build
git pull
make
sudo make install

You can activate the http terminal by adding "-l http:127.0.0.1:8080" into the command line options. [Assumed you are running the browser locally, if not, substitute the RPi3's proper ip address]. Then run your browser and point the URL to: http://127.0.0.1:8080 (or whatever ip address you used).

Going back to your original post, it seems you may not be collecting logs. I'd recommend adding "2> stderr.2" to the *end* of the command line parameters. That way, when you start op25 the interesting messages will written to the stderr.2 file for future examination. You can control the verbosity of logging using the "-v n" parameter, where n is an integer from 0 thru 11. "1" works well for general listening whereas "10" is good for detailed debugging.
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Recent updates installed per your suggestion. Your instructions were great! Like I said, not a Unix expert. GOt some "Could not find Doxygen" messages (see below). Not sure if that is of concern.

Have the following running right now with the updated code. Will play with http later on.
./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -q 2 -U -T onon.tsv -v 10 2>stderr.2

Thanks again, Ron

pi@raspberrypi:~/op25/build $ make
-- Build type not specified: defaulting to release.
-- Boost version: 1.62.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Build type not specified: defaulting to release.
-- Boost version: 1.62.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- AMBE Tone Synthesis Enabled
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/op25/build
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Froze after about 30 minutes (+/-). Invoked as follows:
./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -q 2 -U -T onon.tsv -v 10 2>stderr.2

Compressed/renamed stderr.2 attached.

Ron
 

Attachments

  • stderr_compressed.2.bz2.txt
    410.4 KB · Views: 5

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Tried running at http. Think there is an issue related to the waitress server. Command and resulting traceback follow:

./rx.py --args 'fcd' -N 'LNA:47' -S 57600 -f 460.500e6 -q 2 -T onon.tsv -l http:127.0.0.1:8080

Results:
linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown

gr-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya
Using FUNcube Dongle V2.0 (hw:1)
gr::log :INFO: audio source - Audio source arch: alsa
Opened: hw:1
Dongle successfully initialized
Result of Action :+++++
FCDAPP 20.03
Lna gain enabled
Mixer gain enabled
If gain set to: 15
gain: name: LNA range: start 0 stop 1 step 1
gain: name: MIX range: start 0 stop 1 step 1
gain: name: BB range: start 0 stop 59 step 1
setting gain LNA to 47
Lna gain enabled
supported sample rates 192000-192000 step 0
Set frequency correction to: 2
Using two-stage decimator for speed=192000, decim=4/2 if1=48000 if2=24000
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@gmail.com
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
p25_frame_assembler_impl: do_imbe[0], do_output[0], do_audio_output[0], do_phase2_tdma[0], do_nocrypt[0]
Set Frequency to: 4.605e+08 Hz, corrected to: 460500920 Hz
Traceback (most recent call last):
File "./rx.py", line 860, in <module>
rx = rx_main()
File "./rx.py", line 781, in __init__
self.tb = p25_rx_block(self.options)
File "./rx.py", line 199, in __init__
self.terminal = op25_terminal(self.input_q, self.output_q, self.options.terminal_type)
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 391, in op25_terminal
return http_terminal(input_q, output_q, terminal_type.replace('http:', ''))
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 323, in __init__
from http import http_server
File "/home/pi/op25/op25/gr-op25_repeater/apps/http.py", line 31, in <module>
from waitress.server import create_server
ImportError: No module named waitress.server
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Much better with the python-waitress install. Nice web GUI.

Now that the web interface is operational, how does one get audio via the web GUI as that is the crux of my problem, stable OP25 with audio.

I did mention to Max that cmake is not part of the standard Raspbian install and might be worth adding it to the install document along with the python-waitress. The current install document reads:

STEP 1 (prerequisites):
-----------------------
sudo apt-get update
sudo apt-get build-dep gnuradio
sudo apt-get install gnuradio gnuradio-dev gr-osmosdr librtlsdr-dev libuhd-dev libhackrf-dev libitpp-dev libpcap-dev swig gnuplot-x11 git

Thanks,
Ron
 

squirrel

Member
Premium Subscriber
Joined
Jan 4, 2006
Messages
110
I currently have OP25 monitoring a P25 phase 2 system on a Raspberry Pi 3 B+ running Raspbian stretch providing a feed to RR and also doing a loopback to feed the audio out to the 3.5mm jack for local monitoring. In addition I also have icecast running for a personal feed to eliminate the delay inherit to RR (6-7 sec delay compared to up to 2 minutes on RR). It has been running for months with no issues. I did have to cut my sample rate way down to reduce the number of pcm underruns and I have a daily reboot at 3AM to keep the Pi fresh.

Here is my startup command:

./rx.py --args 'rtl' -N 'LNA:47' -S 250000 -f 772.9812e6 -o 25000 -q -0 -T trunk.tsv -V -2 -U 2> stderr.2 -l http:0.0.0.0:8080

When I first got into this I had a lot if issues with OP25 locking up and it turned out to be the SD card I was using. I know it sounds basic but have you tried a different card? I'd also recommend a class 10 card.
 
Last edited:

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Squirrel,

RR??

My sample rate is 57600 and lower than yours. Different SDR (I've got FunCube Dongle Pro+) and no offset. I'm also running 3B and you are 3B+. Both running Raspbian stretch. I've got a SanDisk 32G Class 10 card (no sense cheaping out on cards).

I keep coming back to thinking its an issue with the ALSA and corresponding audio on the RPi. Not an expert in RPi but OP25 is completely stable when running with no audio (basically runs forever (e.g., days)). But no fun listening to a scanner with no audio :). I did find one post OP25 Raspberry Pi Audio Sucks A Big DAC | John’s Tech Blog suggesting alternate sound card.

I do have a USB soundcard per the earlier posts but unable to get OP25 to send output to that card even though "speaker-test" works to it. That would eliminate the onboard audio chipset/ALSA from the mix. Again, unable to get output to it. Maybe operator error on my part but hard to tell.

I do believe I have a 3B+ in stock and will check that later today. Also have several SanDisk 32GB class 10 SD cards. I'll try a build on the 3B+ and see if that helps and post an update.

Thanks, Ron
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
Much better with the python-waitress install. Nice web GUI.

Now that the web interface is operational, how does one get audio via the web GUI as that is the crux of my problem, stable OP25 with audio.
Unfortunately you can't; the only way to do that would be to set up a streaming server. The primary advantage of the web terminal is the ability to access the controls remotely from the machine the app is running on. In the case of the headless streaming servers, I've found the web interface to be more useful for management.

I did mention to Max that cmake is not part of the standard Raspbian install and might be worth adding it to the install document along with the python-waitress. The current install document reads:

The "correct" way to install op25 is through use of the ~/op25/install.sh script. Most of the methods you see written about online are rather dated and relate to the old scope.py version. The current version of install.sh installs both cmake and python-waitress packages for you.

Installation Method (boatbod fork):
Code:
cd ~
git clone https://github.com/boatbod/op25 op25
cd ~/op25
./install.sh

If you prefer the osmocom version, simply substitute the osmocom repo address in the git clone command.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
When I first got into this I had a lot if issues with OP25 locking up and it turned out to be the SD card I was using. I know it sounds basic but have you tried a different card? I'd also recommend a class 10 card.

The other potential issue with RPi3 lockups is quality/power rating of the USB power supply. RTL dongles are known to be quite power hungry, so make sure you have a good strong PSU supplying the RPi, or else connect the dongle to a powered hub.
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
Reinstalling now on RPi 3B+. I had been following what I think is your guidance here: boatbod/op25. Presume your

cd ~ git clone boatbod/op25 op25 cd ~/op25 ./install.sh
simply replaces steps 2 and 3 in the install document. Yes, lots of confusing guidance out there for installation. Also presume gnuradio is still a prerequiste and must be installed first. Will redo install on RPi 3B+ assuming that to be the case as that platform seems to work for squirrel.

The other potential issue with RPi3 lockups is quality/power rating of the USB power supply. RTL dongles are known to be quite power hungry, so make sure you have a good strong PSU supplying the RPi, or else connect the dongle to a powered hub.
With RPi 3B no issue with power. The RPi 3B+ is more of a power pig and I may have to run with powered hub. Thanks for the suggestion.

Unfortunately you can't; the only way to do that would be to set up a streaming server.
So, think you're saying streaming server is the proper way with OP25 to get audio. In which case, what is purpose of "-U" and "-O" options?
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
The install script takes care of all prerequisites such as gnuradio. The only package it doesn't install is gnuplot-x11.

A streaming server is optional and most certainly not required unless you are trying to get the audio to a web browser.

-U tells op25 to take the raw udp audio data and send it to the ALSA pcm subsystem. Without this you wouldn't hear anything unless you set up some remote audio decoding (e.g. nc | aplay).

-O tells op25 audio player (enabled with -U) which ALSA device name to use for output. If left off the command line, the device used will be 'default' which should be fine for most people. For an add-on usb sound card you need to know the corresponding ALSA device name to put in here. e.g. plughw:1,0

Graham
 

WB2WGH

Member
Joined
Dec 30, 2018
Messages
11
Location
Syracuse, NY
RadioReference Feed
squirrel: Thanks!

A streaming server is optional and most certainly not required unless you are trying to get the audio to a web browser.
boatboad: That was my fondest hope. My goal is to have a single device self contained scanner.

The other potential issue with RPi3 lockups is quality/power rating of the USB power supply. RTL dongles are known to be quite power hungry, so make sure you have a good strong PSU supplying the RPi, or else connect the dongle to a powered hub.
boatbod and squirrel: I have this built on a RPi 3B+ which, from one of my other projects, is more of a power pig than the RPi 3B. I suspect my RPi "approved" power supply will not power the RPi 3B+ with the dongle. I have a powered USB hub on order that is not supposed to backpower the RPi. It should be here Friday and I will make another attempt upon arrival.

For an add-on usb sound card you need to know the corresponding ALSA device name to put in here. e.g. plughw:1,0
So I have tried this and I don't get any audio to the C-Media USB soundcard dongle (yet speaker-test works). So given the following output aplay output (-L and -l), what would the correct device name be for the C-Media device to use with the "-O" option?

================================================================
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
================================================================
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
dmix:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample mixing device
dmix:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample snooping device
hw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Hardware device with all software conversions
default:CARD=Set
C-Media USB Headphone Set, USB Audio
Default Audio Device
sysdefault:CARD=Set
C-Media USB Headphone Set, USB Audio
Default Audio Device
front:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Front speakers
surround21:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Direct sample mixing device
dsnoop:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Direct sample snooping device
hw:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Direct hardware device without any conversions
plughw:CARD=Set,DEV=0
C-Media USB Headphone Set, USB Audio
Hardware device with all software conversions
================================================================

Thank you both for your assistance! Ron
 
Status
Not open for further replies.
Top