RadioReference on Facebook   RadioReference on Twitter   RadioReference Blog
 

Go Back   The RadioReference.com Forums > Computer Aided Monitoring and Programming > Software Defined Radio


Software Defined Radio - A forum for general discussion of software defined radio (SDR) receiver equipment.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1101 (permalink)  
Old 05-16-2017, 12:11 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Aug 2008
Posts: 383
Default

two quick things

1) when using rx.py there should be no need to worry about forecast() at all, as the block is a sink only block. The reason for having forecast() is to tell GR how many input samples the block needs in order to produce X output samples. In the sink-only case, X is always zero; accordingly any "ratio" computed is meaningless. Someday we may remove forecast() entirely, but it's still needed in some cases.

2) the "t" key is almost as good as setting up a trunking TSV file with the -T parameter, but not quite. When using the "t" key a lot of defaults get used - one being that no talkgroup alpha tags are used...

Max
Reply With Quote
Sponsored links
  #1102 (permalink)  
Old 05-16-2017, 7:37 PM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Amen, how do you get alpha tags?
Reply With Quote
  #1103 (permalink)  
Old 05-17-2017, 4:46 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 463
Default

Quote:
Originally Posted by adcockfred View Post
Amen, how do you get alpha tags?
The way I did it was to copy/paste them from the RR DB into a tab separated file called trunk.tsv. This is the file referred to by the -T 'trunk.tsv' command line option.
Reply With Quote
  #1104 (permalink)  
Old 05-17-2017, 9:19 PM
Member
   
Join Date: Sep 2013
Posts: 48
Default

Quote:
Originally Posted by PiccoIntegra View Post
I did some testing a few months back which added message ports to the gardner costas loop and the p25_frame_assembler blocks to dynamically change the multiplier based on the samples per symbol from the costas loop. The app would change the sample rate of the costas loop for TDMA, and then the costas loop would emit a message to the frame assembler to change the multiplier whenever there was a change in rate. It worked fine, but I did not notice a huge improvement in performance or decode quality. so I never mentioned it.

If you're interested, I can post the message code here, it's a fairly small change.
If you are able to post the code or link to it, that would be awesome! I am running a C++ program, so it would be easy for me to piece the blocks together.
Reply With Quote
  #1105 (permalink)  
Old 05-17-2017, 9:22 PM
Member
   
Join Date: Sep 2013
Posts: 48
Default

So I maybe crazy, but I think that uncommenting the lines 917 - 919 of software_imbe_decoder.cc seems to really improve the audio. Without that change it sounds like they are talking through a kazoo a little bit. Any idea why those lines were commented out or what they do?
Reply With Quote
Sponsored links
  #1106 (permalink)  
Old 05-17-2017, 9:52 PM
PiccoIntegra's Avatar
Member
   
Join Date: Dec 2002
Location: North Texas
Posts: 487
Default

Quote:
Originally Posted by lukekb View Post
If you are able to post the code or link to it, that would be awesome! I am running a C++ program, so it would be easy for me to piece the blocks together.
Once you make the changes, you simply connect the message ports, python in this case:
self.msg_connect((self.clock, 'sps'), (self.p25_frame_assembler, 'input_rate'))


gardner_costas_cc_impl.h:
Code:
diff --git a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h
index 7fc8eb7..4790835 100644
--- a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h
+++ b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h
@@ -99,6 +99,7 @@ protected:
   float				d_max_freq;
 
   uint64_t			nid_accum;
+  pmt::pmt_t d_sps_port;
 
   float phase_error_detector_qpsk(gr_complex sample);
   void phase_error_tracking(gr_complex sample);
gardner_costas_cc_impl.cc:
Code:
diff --git a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc
index ed3018c..e9270d6 100644
--- a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc
+++ b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc
@@ -119,9 +119,12 @@ uint8_t gardner_costas_cc_impl::slicer(float sym) {
     d_theta(M_PI / 4.0), d_phase(0), d_freq(0), d_max_freq(max_freq),
     nid_accum(0)
     {
-  set_omega(samples_per_symbol);
-  set_relative_rate (1.0 / d_omega);
-  set_history(d_twice_sps);			// ensure extra input is available
+        d_sps_port = pmt::mp("sps");
+        message_port_register_out(d_sps_port);
+
+        set_omega(samples_per_symbol);
+        set_relative_rate (1.0 / d_omega);
+        set_history(d_twice_sps);			// ensure extra input is available
     }
 
     /*
@@ -133,8 +136,16 @@ uint8_t gardner_costas_cc_impl::slicer(float sym) {
   delete d_interp;
     }
 
+
 void gardner_costas_cc_impl::set_omega (float omega) {
     assert (omega >= 2.0);
+    message_port_pub(d_sps_port, pmt::mp((int)omega));
+
     d_omega = omega;
     d_min_omega = omega*(1.0 - d_omega_rel);
     d_max_omega = omega*(1.0 + d_omega_rel);
p25_frame_assembler_impl.h:
Code:
diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h
index 9763e79..832efb0 100644
--- a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h
+++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h
@@ -50,6 +50,9 @@ namespace gr {
 	bool d_do_msgq;
 	gr::msg_queue::sptr d_msg_queue;
 
+	int d_input_rate;
+	pmt::pmt_t d_sps_port;
+
   // internal functions
 
     void p25p2_queue_msg(int duid);
@@ -72,6 +75,7 @@ namespace gr {
 		       gr_vector_int &ninput_items,
 		       gr_vector_const_void_star &input_items,
 		       gr_vector_void_star &output_items);
+      void set_input_rate(pmt::pmt_t msg);
     };
 
   } // namespace op25_repeater
p25_frame_assembler_impl.cc:
Code:
diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc
index 7f64f39..7e5a00d 100644
--- a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc
+++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <vector>
 #include <sys/time.h>
+#include <cmath>
 
 namespace gr {
   namespace op25_repeater {
@@ -92,7 +93,8 @@ static const int MAX_IN = 1;	// maximum number of input streams
 	d_do_phase2_tdma(do_phase2_tdma),
 	p2tdma(0, debug, output_queue),
 	d_do_msgq(do_msgq),
-	d_msg_queue(queue)
+	d_msg_queue(queue),
+	d_input_rate(4800)
 {
 	if (d_do_audio_output && !d_do_output)
 		fprintf(stderr, "p25_frame_assembler: error: do_output must be enabled if do_audio_output is enabled\n");
@@ -100,6 +102,26 @@ static const int MAX_IN = 1;	// maximum number of input streams
 		fprintf(stderr, "p25_frame_assembler: error: do_imbe must be enabled if do_audio_output is enabled\n");
 	if (d_do_phase2_tdma && !d_do_audio_output)
 		fprintf(stderr, "p25_frame_assembler: error: do_audio_output must be enabled if do_phase2_tdma is enabled\n");
+
+        d_sps_port = pmt::mp("input_rate");
+        message_port_register_in(d_sps_port);
+        set_msg_handler(pmt::mp("input_rate"), boost::bind(&p25_frame_assembler_impl::set_input_rate, this, _1));
+}
+
+void
+p25_frame_assembler_impl::set_input_rate(pmt::pmt_t msg)
+{
+   //sps_multiplier
+   if (pmt::is_integer(msg)) {
+     //fprintf(stderr, "set_input_rate received: %d\n", pmt::to_long(msg));
+     if( pmt::to_long(msg) == 8 ) {
+       d_input_rate = 6000;
+       set_output_multiple(640);
+     } else {
+       d_input_rate = 4800;
+       set_output_multiple(864);
+     }
+   }
 }
 
 void
@@ -108,6 +130,8 @@ p25_frame_assembler_impl::forecast(int nof_output_items, gr_vector_int &nof_inpu
    // for do_imbe=false: we output packed bytes (4:1 ratio)
    // for do_imbe=true: input rate= 4800, output rate= 1600 = 32 * 50 (3:1)
    // for do_audio_output: output rate=8000 (ratio 0.6:1)
-   const size_t nof_inputs = nof_input_items_reqd.size();
-   int nof_samples_reqd = 4.0 * nof_output_items;
-   if (d_do_imbe)
-     nof_samples_reqd = 3.0 * nof_output_items;
-   nof_samples_reqd = nof_output_items;
-   if (d_do_audio_output)
-     nof_samples_reqd = 0.6 * nof_output_items;
-   std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
+   const size_t nof_inputs = nof_input_items_reqd.size();
+   int nof_samples_reqd = (int)std::ceil(4.0 * float(nof_output_items));
+   if (d_do_output) {
+      if (!d_do_audio_output)
+        nof_samples_reqd = (int)std::ceil(3.0 * float(nof_output_items));
+      else {
+        //fprintf(stderr, "d_input_rate: %f\n", (double)(d_input_rate / 8000.f));
+        nof_samples_reqd = (int)std::ceil(float(d_input_rate / 8000) * float(nof_output_items));
+      }
+   }
+   std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
 }
Reply With Quote
  #1107 (permalink)  
Old 05-18-2017, 6:52 AM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Yeah I did but still only gettin id's from first colum. No Alfa tags from second collum. So if it only showing numbers from first collum should I try combining the two. Or would it be a build problem ? Believe me I built many a machine with that clone command of op25 and no scope ran till I built one with use guys direction.
Reply With Quote
  #1108 (permalink)  
Old 05-18-2017, 5:05 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 463
Default

Quote:
Originally Posted by adcockfred View Post
Yeah I did but still only gettin id's from first colum. No Alfa tags from second collum. So if it only showing numbers from first collum should I try combining the two. Or would it be a build problem ? Believe me I built many a machine with that clone command of op25 and no scope ran till I built one with use guys direction.
My rx.py command line:
Code:
./rx.py --args "rtl=0" -P fft --gains 'lna:36' -D cqpsk -f 773.84375e6 -S 1440000 -d -50 -q 0 -T trunk.tsv -q 1 -2 -w 2> stderr.2
Here is my trunk.tsv file:
Code:
"Sysname"	"Control Channel List"	"Offset"	"NAC"	"Modulation"	"TGID Tags File"	"Whitelist"	"Blacklist"	"Center Frequency"
"FiRST-TALB"	"773.84375"	"0"	"0x4a6"	"CQPSK"	"first.tsv"	"talbot.wlist"	"first.blist"
And here is part of my first.tsv file:
Code:
7101	MdTAP FM/Hrb
7102	MdTAP Pt/Key
7103	MdTAP BWI
7104	MdTAP ICC
7105	MdTAP Hatem
7106	MdTAP BayBr
7107	MdTAP NiceBr
7109	MdTAP SOD T1
7110	MdTAP SOD T2
There is exactly one tab character between the id and the alpha tag for each entry.
Reply With Quote
  #1109 (permalink)  
Old 05-18-2017, 8:57 PM
Member
   
Join Date: Sep 2013
Posts: 48
Default

[QUOTE=PiccoIntegra;2765968]Once you make the changes, you simply connect the message ports, python in this case:
self.msg_connect((self.clock, 'sps'), (self.p25_frame_assembler, 'input_rate'))

Awesome! It actually turns out I was doing something similar. I added a function to p25_frame_assembler, that lets you dynamically switch it into Phase 2 mode, which adjust the output_multiple and forecast. It is good to see you had the same numbers!
Reply With Quote
  #1110 (permalink)  
Old 05-19-2017, 11:55 AM
Member
   
Join Date: Sep 2013
Posts: 48
Default

Quote:
Originally Posted by lukekb View Post
So I maybe crazy, but I think that uncommenting the lines 917 - 919 of software_imbe_decoder.cc seems to really improve the audio. Without that change it sounds like they are talking through a kazoo a little bit. Any idea why those lines were commented out or what they do?
I was crazy - the code never touches this block... I was just receiving some Phase 1 traffic.

Does anyone know why there are 2 separate vocoder implementations?

By default Phase 1 uses the Pavel Yazev vocoder, while Phase 2 goes through the "software_vocoder".

You can route the Phase 1 audio through the "software_vocoder" by running `export IMBE=soft`

When you do that, the audio sounds a lot worse.

Is there anyway to run Phase 2 through the Pavel vocoder or copy over whatever he did to the "software_vocoder"?
Reply With Quote
  #1111 (permalink)  
Old 05-19-2017, 7:09 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 463
Default

Quote:
Originally Posted by lukekb View Post
I was crazy - the code never touches this block... I was just receiving some Phase 1 traffic.

Does anyone know why there are 2 separate vocoder implementations?

By default Phase 1 uses the Pavel Yazev vocoder, while Phase 2 goes through the "software_vocoder".

You can route the Phase 1 audio through the "software_vocoder" by running `export IMBE=soft`

When you do that, the audio sounds a lot worse.

Is there anyway to run Phase 2 through the Pavel vocoder or copy over whatever he did to the "software_vocoder"?
They are encoded differently. Phase 1 is IBME whereas Phase 2 is AMBE.

I cannot answer why there are two IMBE decoders - that's some history which Max may care to comment on.
Reply With Quote
  #1112 (permalink)  
Old 05-20-2017, 9:44 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 463
Default

Max,

I have some changes that integrate a python based socket audio player into rx.py so you don't need to run a separate terminal for nc and aplay. To make it work properly requires the the installation of an extra python library (pyalsaaudio) which wrappers the libasound system calls. Let me know if you're interested and I'll post it.

Graham
Reply With Quote
  #1113 (permalink)  
Old 05-21-2017, 3:55 PM
Member
   
Join Date: May 2017
Location: Coatesville,PA
Posts: 8
Default

I know I'm a little late to the party but I'm am very interested in this project. I recently purchased a 436 it seems to handle my local Harris P25 phase 2 quite well. However there are times where it seems it's missing transmissions. I already have a RTL-SDR v3 right now I'm contemplating diving right in with Linux Mint and wiping my 40gb SSD drive. I was researching alternatives to this unfortunately my only option would be wiping my current machine or getting an external hard drive or go with a 3.0 high speed drive. Times have changed since 2014 am I correct in my research that a 3.0 USB drive like a lexar p20 could handle the tax. I am starting this project tommorow so any input would be greatly appreciated. The P25 system I intend to monitor is the PA Chester county Harris P25 phase 2 system.
Reply With Quote
  #1114 (permalink)  
Old 05-21-2017, 9:20 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 463
Default

Quote:
Originally Posted by Falcon4 View Post
I know I'm a little late to the party but I'm am very interested in this project. I recently purchased a 436 it seems to handle my local Harris P25 phase 2 quite well. However there are times where it seems it's missing transmissions. I already have a RTL-SDR v3 right now I'm contemplating diving right in with Linux Mint and wiping my 40gb SSD drive. I was researching alternatives to this unfortunately my only option would be wiping my current machine or getting an external hard drive or go with a 3.0 high speed drive. Times have changed since 2014 am I correct in my research that a 3.0 USB drive like a lexar p20 could handle the tax. I am starting this project tommorow so any input would be greatly appreciated. The P25 system I intend to monitor is the PA Chester county Harris P25 phase 2 system.
If it helps any, I ditched Windoze as my primary OS years ago and switched to Lint Mint (17.1 back then, currently 18.1). For the rare occasions where I absolutely must run something in the Win environment, I have Win10 installed in a virtualbox session under Mint.

Depending which version of Mint (or straight Ubuntu) you install will steer you towards either of the scope.py or rx.py variant of OP25. The earlier scope.py version only really runs under ubuntu 14.04 derivatives (i.e. Mint 17.3) whereas the newer rx.py runs under either but is still being tweaked/improved. Another consideration is if you have up-to-the-minute pc hardware, in which case you may be forced to go with the latest version of Mint so that you have driver support for things like wireless cards etc. (I didn't initially and it was a glorious PITA to get the machine installed properly).
Reply With Quote
  #1115 (permalink)  
Old 05-26-2017, 5:24 AM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Thanks, boatbod that worked. Now on to that ph ll voice, maybe I will get some desk time over the holiday.
Reply With Quote
  #1116 (permalink)  
Old 05-26-2017, 6:43 AM
Newbie
   
Join Date: Sep 2014
Posts: 2
Post Need some help getting OP25 running

Hi Folks,

Our county recently went to a phase II system. While my 436 does a decent job, it's not terribly useful for ferreting out things like new talkgroups. I've been wading through this thread all night trying to get OP25 up and running. Here's what I have managed so far:

Got virtualbox running with ubuntu 14.04

Did "sudo apt-get update" and "sudo apt-get upgrade" as per the instructions.

Tried "sudo apt-get build-dep gnuradio", at which point I got the error: "E: you must put some source uris in your sources.list".

I surfed around and tried putting every repository I could find into my sources.list file.

When trying it again (after re-running the update and upgrade commands) I now get the following error:

"E: Build-Depends dependency for gnuradio cannot be satisfied because the package libuhd-dev cannot be found".

Couldn't find that specific package *anywhere* in any of the repositories that I found.

So, I'm at kind of a dead end here. I'm sure it's something simple that I'm doing (or not), but not being a linux power user, I'm not sure how to solve this one.

I miss cp/m.....

Any help would be greatly appreciated.

Thanks for reading.
Reply With Quote
  #1117 (permalink)  
Old 05-26-2017, 10:09 AM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Use 2-5 updated clone command
Reply With Quote
  #1118 (permalink)  
Old 05-26-2017, 10:44 AM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Page 47 this thread
Reply With Quote
  #1119 (permalink)  
Old 05-27-2017, 4:40 AM
Newbie
   
Join Date: Sep 2014
Posts: 2
Default Thanks for the reply

Hi Adcockfred,

Thanks for replying. I don't quite understand your post. I looked at the page you specified with the corrected git url, but the primary problem I'm having is getting the gnuradio dependencies to install. For some reason, I'm unable to get it to function.

Thanks for your help!
Reply With Quote
  #1120 (permalink)  
Old 05-27-2017, 7:17 AM
adcockfred's Avatar
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Apr 2010
Location: houston tx.
Posts: 276
Default

Piccointegra has addressed uhd and pcap build in this thread. I never got anywhere until I changed that clone command. Also I build in viritual, that way I can compare my mistakes.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:07 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
All information here is Copyright 2012 by RadioReference.com LLC and Lindsay C. Blanton III.Ad Management by RedTyger
Copyright 2015 by RadioReference.com LLC Privacy Policy  |  Terms and Conditions