mirror of
				https://github.com/brmlab/osmo-tetra.git
				synced 2025-10-30 23:14:00 +01:00 
			
		
		
		
	demod: use current uhd arguments scheme in uhd-tetra_demod.py
also introduces --spec argument useful with usrp1
This commit is contained in:
		
							parent
							
								
									7226098a9c
								
							
						
					
					
						commit
						617dacf7b9
					
				
					 1 changed files with 31 additions and 20 deletions
				
			
		
							
								
								
									
										41
									
								
								src/demod/python/uhd-tetra_demod.py
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										41
									
								
								src/demod/python/uhd-tetra_demod.py
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -22,18 +22,26 @@ class my_top_block(gr.top_block): | ||||||
| 
 | 
 | ||||||
|         # Create a UHD source |         # Create a UHD source | ||||||
|         self._u = uhd.usrp_source( |         self._u = uhd.usrp_source( | ||||||
|                device_addr=options.device_addr, |                device_addr=options.args, | ||||||
|                io_type=uhd.io_type.COMPLEX_FLOAT32, |                io_type=uhd.io_type.COMPLEX_FLOAT32, | ||||||
|                num_channels=1) |                num_channels=1) | ||||||
| 
 | 
 | ||||||
|         sample_rate = 100e6/512 |         # Set the subdevice spec | ||||||
|  |         if(options.spec): | ||||||
|  |             self._u.set_subdev_spec(options.spec, 0) | ||||||
|  | 
 | ||||||
|  |         # Set the antenna | ||||||
|  |         if(options.antenna): | ||||||
|  |             self._u.set_antenna(options.antenna, 0) | ||||||
|  | 
 | ||||||
|  |         # Pick the lowest possible value for the input rate | ||||||
|  |         supported_rates = self._u.get_samp_rates() | ||||||
|  |         self._u.set_samp_rate(supported_rates.start()) | ||||||
|  | 
 | ||||||
|  |         sample_rate = self._u.get_samp_rate() | ||||||
|         symbol_rate = 18000 |         symbol_rate = 18000 | ||||||
|         sps = 2 |         sps = 2 | ||||||
| 
 | 
 | ||||||
|         # set sampling rate and antenna port |  | ||||||
|         self._u.set_samp_rate(sample_rate) |  | ||||||
|         self._u.set_antenna(options.antenna, 0) |  | ||||||
|          |  | ||||||
|         # output rate will be 36,000 |         # output rate will be 36,000 | ||||||
|         ntaps = 11 * sps |         ntaps = 11 * sps | ||||||
|         new_sample_rate = symbol_rate * sps |         new_sample_rate = symbol_rate * sps | ||||||
|  | @ -45,11 +53,12 @@ class my_top_block(gr.top_block): | ||||||
|             print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" |             print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" | ||||||
|         self._u.set_gain(options.gain) |         self._u.set_gain(options.gain) | ||||||
| 
 | 
 | ||||||
|         # Set receive frequency |         # Set frequency (tune request takes lo_offset) | ||||||
|         if options.lo_offset is not None: |         if(options.lo_offset is not None): | ||||||
|             self._u.set_lo_offset(options.lo_offset) |             treq = uhd.tune_request(options.freq, options.lo_offset) | ||||||
| 
 |         else: | ||||||
|         tr = self._u.set_center_freq(options.freq) |             treq = uhd.tune_request(options.freq) | ||||||
|  |         tr = self._u.set_center_freq(treq) | ||||||
|         if tr == None: |         if tr == None: | ||||||
|             sys.stderr.write('Failed to set center frequency\n') |             sys.stderr.write('Failed to set center frequency\n') | ||||||
|             raise SystemExit, 1 |             raise SystemExit, 1 | ||||||
|  | @ -80,10 +89,12 @@ class my_top_block(gr.top_block): | ||||||
| def get_options(): | def get_options(): | ||||||
|     parser = OptionParser(option_class=eng_option) |     parser = OptionParser(option_class=eng_option) | ||||||
|     # usrp related settings |     # usrp related settings | ||||||
|     parser.add_option("-d", "--device_addr", type="string", default="", |     parser.add_option("-a", "--args", type="string", default="", | ||||||
|                       help="UHD device address [default=%default]") |                       help="UHD device address args, [default=%default]") | ||||||
|     parser.add_option("-a", "--antenna", type="string", default="TX/RX", |     parser.add_option("", "--spec", type="string", default=None, | ||||||
|                       help="daughterboard antenna [default=%default]") |                       help="Subdevice of UHD device where appropriate") | ||||||
|  |     parser.add_option("-A", "--antenna", type="string", default=None, | ||||||
|  |                       help="select Rx Antenna where appropriate") | ||||||
|     parser.add_option("-f", "--freq", type="eng_float", default=None, |     parser.add_option("-f", "--freq", type="eng_float", default=None, | ||||||
|                       help="set frequency to FREQ", metavar="FREQ") |                       help="set frequency to FREQ", metavar="FREQ") | ||||||
|     parser.add_option("-g", "--gain", type="eng_float", default=None, |     parser.add_option("-g", "--gain", type="eng_float", default=None, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dimitri Stolnikov
						Dimitri Stolnikov