RPi 3 & RTL-SDR/OP25?

Status
Not open for further replies.

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
That would be cool!

Its already there, but not extensively tested.
Code:
Usage: audio.py [options]

Options:
  -h, --help            show this help message and exit
  -O AUDIO_OUTPUT, --audio-output=AUDIO_OUTPUT
                        audio output device name
  -u WIRESHARK_PORT, --wireshark-port=WIRESHARK_PORT
                        Wireshark port
  -2, --two-channel     single or two channel audio

Basically just run a separate terminal screen with "./audio.py -2" in place of netcat | aplay.
First audio stream is picked up from port 23456 (or the -u parameter) and the second audio stream is assumed to be port+2 (i.e. 23458). Make sure you set the ports correctly in multi_rx
 

ve2vag

Member
Feed Provider
Joined
Nov 24, 2011
Messages
35
Location
Quebec Canada
Had to redo the setup, since trying to upgrade from Jessie to Stretch screwed up everything. Using a RPI 3B
Used a fresh Raspbian Stretch image, did update / upgrade / dist-upgrade on it.
I've installed op25 using the instructions, with the ./install.sh script.

As stated in other posts, using multi_rx.py with a json file, since I want to monitor 2 local ham repeaters (one DStar and one Fusion C4FM) which are 2,17 MHz apart.

Content of the json file:

{
"channels": [

{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:23458",
"excess_bw": 0.2,
"filter_type": "gmsk",
"frequency": 144950000,
"if_rate": 24000,
"name": "dstar",
"symbol_rate": 4800
},
{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:23456",
"excess_bw": 0.2,
"filter_type": "rrc",
"frequency": 147120000,
"if_rate": 24000,
"name": "ysf",
"symbol_rate": 4800
}
],
"devices": [
{
"args": "rtl:0",
"frequency": 146035000,
"gains": "lna:48",
"name": "rtl0",
"offset": 0,
"ppm": 62,
"rate": 2400000,
"tunable": false
}
]
}


I know the RTL-SDR dongle is working, tried rtl_tcp on it and I can use SDR# remotely to monitor analog signals.

When I tru to launch multi_rx.py, I keep getting either segmentation fault,or corrupted double-link list errors.

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ python multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown

device: {'gains': 'lna:48', 'args': 'rtl:0', 'tunable': False, 'rate': 2400000, 'frequency': 146035000, 'ppm': 60, 'offset': 0, 'name': 'rtl0'}
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
*** Error in `python': corrupted double-linked list: 0x02837978 ***
Aborted
__________

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ python multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown

device: {'gains': 'lna:48', 'args': 'rtl:0', 'tunable': False, 'rate': 2400000, 'frequency': 146035000, 'ppm': 60, 'offset': 0, 'name': 'rtl0'}
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
Segmentation fault
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ lsusb
Bus 001 Device 005: ID 046d:c52e Logitech, Inc. MK260 Wireless Combo Receiver
Bus 001 Device 004: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
__________

Any ideas, please ?
 

N6ML

Member
Joined
Sep 26, 2008
Messages
1,275
Had to redo the setup, since trying to upgrade from Jessie to Stretch screwed up everything. Using a RPI 3B
Used a fresh Raspbian Stretch image, did update / upgrade / dist-upgrade on it.
I've installed op25 using the instructions, with the ./install.sh script.

As stated in other posts, using multi_rx.py with a json file, since I want to monitor 2 local ham repeaters (one DStar and one Fusion C4FM) which are 2,17 MHz apart.

Content of the json file:

<snip>

"devices": [
{
"args": "rtl:0",
"frequency": 146035000,
"gains": "lna:48",
"name": "rtl0",
"offset": 0,
"ppm": 62,
"rate": 2400000,
"tunable": false
}
]
}


I know the RTL-SDR dongle is working, tried rtl_tcp on it and I can use SDR# remotely to monitor analog signals.

When I tru to launch multi_rx.py, I keep getting either segmentation fault,or corrupted double-link list errors.

I had to search the history of this thread to recall the cause. "rtl:0" in "args" should be "rtl=0" (or possibly just "rtl")

Which op25 codebase are you using? i.e. what git commands did you use?
 

ve2vag

Member
Feed Provider
Joined
Nov 24, 2011
Messages
35
Location
Quebec Canada
I had to search the history of this thread to recall the cause. "rtl:0" in "args" should be "rtl=0" (or possibly just "rtl")

Which op25 codebase are you using? i.e. what git commands did you use?

I'm using Boatbod's code, used git clone https://github.com/boatbod/op25

In the meantime, I remembered that last winter, the ./install.sh script was not working for me, and I had to compile manually to make it work.

So I recompiled op25 manually, still with Boatbod's code, but by doing this:
mkdir build
cd build
cmake ../
make -j4
sudo make install
sudo ldconfig

I've corrected the "args" value in the json file, and results :

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ ./multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown

device: {'gains': 'lna:48', 'args': 'rtl=0', 'tunable': False, 'rate': 2400000, 'frequency': 146035000, 'ppm': 62, 'offset': 0, 'name': 'rtl0'}
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 device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
channel (dev rtl0): {'name': 'dstar', 'demod_type': 'fsk4', 'symbol_rate': 4800, 'destination': 'udp://127.0.0.1:23458', 'excess_bw': 0.2, 'filter_type': 'gmsk', 'frequency': 144950000, 'if_rate': 24000}
Using two-stage decimator for speed=2400000, decim=25/4 if1=96000 if2=24000
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23458), audio(23458)
channel (dev rtl0): {'name': 'ysf', 'demod_type': 'fsk4', 'symbol_rate': 4800, 'destination': 'udp://127.0.0.1:23456', 'excess_bw': 0.2, 'filter_type': 'rrc', 'frequency': 147120000, 'if_rate': 24000}
Using two-stage decimator for speed=2400000, decim=25/4 if1=96000 if2=24000
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23456), audio(23456)

Thanks DSeven ! Seems to be working now.

Next steps: to stream both feeds to Broadcastify / Radioreference, using Boatbod's instructions on the other post.
 

ve2vag

Member
Feed Provider
Joined
Nov 24, 2011
Messages
35
Location
Quebec Canada
Good luck and let me know how it works. It's kinda experimental...

Thanks, I've just done some testing, and I'll continue the discussion about this in the Broadcastify streaming post, since it's on that subject and to not hijack this one.
 

kb9mwr

Member
Joined
Apr 8, 2003
Messages
263
Location
Green Bay, WI
Thanks, I've just done some testing, and I'll continue the discussion about this in the Broadcastify streaming post, since it's on that subject and to not hijack this one.

I encourage you to also test transmit. So far I have only tested p25 transmit via some gm300's (discriminator audio/flat tx audio)
 

marklt1

Member
Feed Provider
Joined
Mar 5, 2005
Messages
53
Location
Streetsboro, OH
haha, just finished a session running OP25 on the RPI - it's a "3" model "B" if that means anything. It works perfectly. I used the new rx.py version in straight CLI mode, with audio piped over UDP to an audio server running on a nearby PC. The speaker output port of the RPI requires a special type of audio connector (4-pole) that I haven't played with yet, but there's no reason it shouldn't work. Load average (keep in mind this is a 4-core unit) was around 1.5 or 1.6, with the RPI GUI running and 'top' running in another window...

Max

What Windows application did you use to stream to from OP25? I have my RPI3Bplus running Boadbod's OP25 and would like to capture the audio directly instead of through the built-in audio jack. I have played around trying to send audio through the wireshark port but haven't had much luck. I have written other Microsoft DOTNET code to capture TGIDs and catalog the transmissions. I would just like to get some better audio through some audio filtering.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
What Windows application did you use to stream to from OP25? I have my RPI3Bplus running Boadbod's OP25 and would like to capture the audio directly instead of through the built-in audio jack. I have played around trying to send audio through the wireshark port but haven't had much luck. I have written other Microsoft DOTNET code to capture TGIDs and catalog the transmissions. I would just like to get some better audio through some audio filtering.

Mark - the main trick for better RPi3 audio is to reduce your sample rate to -S 57600 as that frees up cpu cycles that would otherwise be used for USB data transfer.

If you want to stream raw audio frames out of op25 to another client across the network you change the command line options:

Remove: -U
Add: -V -2 -w -W 192.168.100.100 -u 23456
(Note: you change the IP address to whatever destination host you are using)
 

marklt1

Member
Feed Provider
Joined
Mar 5, 2005
Messages
53
Location
Streetsboro, OH
Mark - the main trick for better RPi3 audio is to reduce your sample rate to -S 57600 as that frees up cpu cycles that would otherwise be used for USB data transfer.

If you want to stream raw audio frames out of op25 to another client across the network you change the command line options:

Remove: -U
Add: -V -2 -w -W 192.168.100.100 -u 23456
(Note: you change the IP address to whatever destination host you are using)

I was missing the -V switch. Sounds great now.
Thank you SO MUCH again.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
I was missing the -V switch. Sounds great now.
Thank you SO MUCH again.

If you're using a linux machine to play the audio, there is a utility that's part of the op25 distro to act as a stand-alone audio player.

Code:
./audio.py

Usage: audio.py [options]

Options:
  -h, --help            show this help message and exit
  -O AUDIO_OUTPUT, --audio-output=AUDIO_OUTPUT
                        audio output device name
  -u WIRESHARK_PORT, --wireshark-port=WIRESHARK_PORT
                        Wireshark port
  -2, --two-channel     single or two channel audio
  -x AUDIO_GAIN, --audio-gain=AUDIO_GAIN
                        audio gain (default = 1.0)

By default you don't need any command line options unless you want to use a different port or audio device.
 

marklt1

Member
Feed Provider
Joined
Mar 5, 2005
Messages
53
Location
Streetsboro, OH
If you're using a linux machine to play the audio, there is a utility that's part of the op25 distro to act as a stand-alone audio player.

Code:
./audio.py

Usage: audio.py [options]

Options:
  -h, --help            show this help message and exit
  -O AUDIO_OUTPUT, --audio-output=AUDIO_OUTPUT
                        audio output device name
  -u WIRESHARK_PORT, --wireshark-port=WIRESHARK_PORT
                        Wireshark port
  -2, --two-channel     single or two channel audio
  -x AUDIO_GAIN, --audio-gain=AUDIO_GAIN
                        audio gain (default = 1.0)

By default you don't need any command line options unless you want to use a different port or audio device.

I am developing a Windows application that will play and archive (catalog) calls.
So far, I had everything working well until one of my listeners notified me that my Broadcastify stream is active although there has been no calls for the past day or so. Now that I have the audio over UDP working, I realized that I stole the audio feed from DarkIce.

Is there a way to have a second audio instance running on my RPi3b+ so that I can feed Broadcastify along with a UDP audio network feed? CPU utilization averages 20% so I have plenty of power.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
I am developing a Windows application that will play and archive (catalog) calls.
So far, I had everything working well until one of my listeners notified me that my Broadcastify stream is active although there has been no calls for the past day or so. Now that I have the audio over UDP working, I realized that I stole the audio feed from DarkIce.

Is there a way to have a second audio instance running on my RPi3b+ so that I can feed Broadcastify along with a UDP audio network feed? CPU utilization averages 20% so I have plenty of power.

Lots of options, but nothing directly off the shelf...
1. You can clone audio streams once they are pcm formatted inside of ALSA, but that's not going to send raw audio frames across UDP.

2. You could modify sockaudio.py to do something different than it does now. i.e. have it receive the UDP frames and proxy them on somewhere else at the same time as sending them to ALSA.

3. You could modify op25_audio.cc/op25_audio.h so that raw audio frames are written to two different destinations at the same time. Actually writing the frames twice would be easy, but the harder part would be making the destinations configurable from the command line because that impacts interfaces from rx.py on downward through swig and into the c/c++ library code.
 

WB0VHB

Member
Joined
Oct 30, 2009
Messages
160
Location
Mt. Union, Iowa
I followed John's great tutorial on installing op25 on a RPi but get a blank screen when sending the start script.

https://www.hagensieker.com/wordpress/2018/07/24/op25-on-a-raspberry-pi-part-3/#comment-1265

After sending the following script (with my local control channel at -f)
./rx.py --args 'rtl' -N 'LNA:47' -S 2400000 -f 857.2625e6 -o 25000 -q -2

I get the cut and paste information below just prior to the screen going blank with only OP25 at the top center and freq, hold skip lock........ at the bottom of the screen. Hitting the letter q will bring me back to a prompt. The line does not appear like in John's tutorial with the NAC, SYSID and zeroes. It appears my SDR is recognized but data is not getting sent to op25?

Any suggestions?

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 device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
gain: name: LNA range: start 0 stop 0 step 0
setting gain LNA to 47
supported sample rates 250000-2560000 step 24000
[R82XX] PLL not locked!
Using two-stage decimator for speed=2400000, decim=25/4 if1=96000 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]
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
You're starting op25 in passive (non-trunked) mode so the terminal isn't going to do a while lot and you won't hear anything because voice decode had not been enabled.

Suggest you add -2 -U to the startup options, then turn on plot #1 (fft) to see if you're close to a signal of any sort.
 
Last edited:

N6ML

Member
Joined
Sep 26, 2008
Messages
1,275
I followed John's great tutorial on installing op25 on a RPi but get a blank screen when sending the start script.

https://www.hagensieker.com/wordpress/2018/07/24/op25-on-a-raspberry-pi-part-3/#comment-1265

After sending the following script (with my local control channel at -f)
./rx.py --args 'rtl' -N 'LNA:47' -S 2400000 -f 857.2625e6 -o 25000 -q -2

Seems you may have missed the part in all caps here -

Now run this command. Bear in mind you MUST KNOW THE FREQUENCY OF THE CONTROL CHANNEL YOU WANT TO FOLLOW AND CHANGE THE -f PART TO THE CORRECT FREQUENCY.

We might be able to help further if we knew what system you're trying to receive (link to the RR database entry would be good).

73!

Edit: I just reread your post, and I guess you did change "857.2625" to the control channel for your local system, but didn't paste that in your post?
 
Last edited:

N6ML

Member
Joined
Sep 26, 2008
Messages
1,275
BTW (devs), whilst experimenting with the command from the recent discussion, I found that it crashes at:

Code:
Traceback (most recent call last):
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 293, in run
    if self.process_q_events():
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 276, in process_q_events
    return self.process_json(msg.to_string())
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 211, in process_json
    s = 'NAC 0x%x' % (int(current_nac))
ValueError: invalid literal for int() with base 10: 'None'

I suggest this small change:

Code:
diff --git a/op25/gr-op25_repeater/apps/terminal.py b/op25/gr-op25_repeater/apps/terminal.py
index 53c6a31..fc6927a 100755
--- a/op25/gr-op25_repeater/apps/terminal.py
+++ b/op25/gr-op25_repeater/apps/terminal.py
@@ -202,7 +202,7 @@ class curses_terminal(threading.Thread):
             nacs = [x for x in msg.keys() if x.isnumeric() ]
             if not nacs:
                 return
-            if 'nac' in msg:
+            if msg.get('nac'):
                 current_nac = str(msg['nac'])
             else:
                 times = {msg[nac]['last_tsbk']:nac for nac in nacs}

(that's against boadbot). The difference here is that the condition will not be met if it has a value, but that value is None.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,338
Location
Talbot Co, MD
BTW (devs), whilst experimenting with the command from the recent discussion, I found that it crashes at:

Code:
Traceback (most recent call last):
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 293, in run
    if self.process_q_events():
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 276, in process_q_events
    return self.process_json(msg.to_string())
  File "/home/rock64/op25/op25/gr-op25_repeater/apps/terminal.py", line 211, in process_json
    s = 'NAC 0x%x' % (int(current_nac))
ValueError: invalid literal for int() with base 10: 'None'

I suggest this small change:

Code:
diff --git a/op25/gr-op25_repeater/apps/terminal.py b/op25/gr-op25_repeater/apps/terminal.py
index 53c6a31..fc6927a 100755
--- a/op25/gr-op25_repeater/apps/terminal.py
+++ b/op25/gr-op25_repeater/apps/terminal.py
@@ -202,7 +202,7 @@ class curses_terminal(threading.Thread):
             nacs = [x for x in msg.keys() if x.isnumeric() ]
             if not nacs:
                 return
-            if 'nac' in msg:
+            if msg.get('nac'):
                 current_nac = str(msg['nac'])
             else:
                 times = {msg[nac]['last_tsbk']:nac for nac in nacs}

(that's against boadbot). The difference here is that the condition will not be met if it has a value, but that value is None.

Thanks! The error checking is indeed rather sparse...
 
Status
Not open for further replies.
Top