For a professional project, I must fully automate a process which involves a GNURadio python flow played on an USRP N210. In order to acess the USRP, I installed a VMWare Debian machine on a Windows Computer (I need windows in order to acess another Electronic Device) However my computer has no ethernet port, so I plugged the ethernet cable coming from the USRP the adapter setup (it is an USRP from Ettus Research), and changed the IP of the Ethernet Interfacethe ipv4the ipv6. I am not an expert at all in this domain, but I did this already on a Debian physical computer and it worked perfectly (same USRP, same cable, same adapter). I then tried to ping the USRP, through the new IP adress (XXX.XXX.XXX.21), it worked fine. I executed my automation to see if it worked, and on the logging, I could see the problem would come from USRP connecion. I pinged it again and it didn't work (Destination Host not reachable).
Here is my python code for my main fonction : Code for main function. Change is nohing to vary about, it is only a text editing script.
Here is the code for sink. py :
from gnuradio import blocks
import pmt
from gnuradio import gr
from gnuradio.filter import firdes
from gnuradio.fft import window
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
from gnuradio import uhd
import time
import journal
class Top(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "Not titled yet", catch_exceptions=True)
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 500000
self.Freq = Freq = 868700000
journal.log('Frequency and sample rate Ok')
##################################################
# Blocks
##################################################
journal.log("trying to reach usrp")
self.uhd_usrp_sink_0 = uhd.usrp_sink(
",".join(("addr=XXX.XXX.XXX.102", "")),
uhd.stream_args(
cpu_format="fc32",
args='',
channels=list(range(0,1)),
),
'',
)
journal.log("connection with usrp successful")
self.uhd_usrp_sink_0.set_clock_source('external', 0)
self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
# No synchronization enforced.
self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(Freq,10*samp_rate), 0)
self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
self.uhd_usrp_sink_0.set_gain(1, 0)
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(10)
journal.log('trying to load file into flow')
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/eutelsat/Bureau/Simu/test2605.bin', False, 0, 0)
journal.log('file loaded successfully')
self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
##################################################
# Connections
##################################################
self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(self.Freq,10*self.samp_rate), 0)
def get_Freq(self):
return self.Freq
def set_Freq(self, Freq):
self.Freq = Freq
self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(self.Freq,10*self.samp_rate), 0)
Then there is this
Since then, when i unplug-plug, i have a short period of time to ping or connect with GNURadio, but after a few seconds/minutes, the USRP is still unreachable from the virtual machine. From my host computer, i can permaping the USRP. So the problem is that I cannot automate with some code a process that requires a frequent unplug. Can anyone help me on that ?