[USRP-users] uhd python transmition

Marcus Müller marcus.mueller at ettus.com
Thu Oct 5 07:49:41 EDT 2017


Dear Ivan,

please understand that both my insight on what goes wrong as well as my
capability to make your application work through emails is limited.

Anyway, you already got a few hints that you did not respect.

  * Don't use multiprocessing.Process
  * Don't try to constantly reset the metadata in the critical loop
  * 50 MS/s is very much, it's simply possible that your computer isn't
    fast enough, or its USB3 xhci fails.

Best regards,

Marcus


On 10/05/2017 01:26 AM, Ivan Zahartchuk via USRP-users wrote:
> Hi, Marcus
>
> I'm working on the data transmission using USRP B200 and UHD Python
> driver.
> When transmitting the data for two usrp, the error U appears. I want
> to start the transmission as another process.
> Here is my code:
> from PyQt4 import QtCore,QtGui,uic
> import sys
> import libpyuhd as lib
> import numpy as np
> from multiprocessing import Process,Lock,Pool
> import time
>
>
> class MainWindows(QtGui.QWidget):
>     def __init__(self):
>         QtGui.QWidget.__init__(self)
>         uic.loadUi("wind.ui",self)
>         self.connect(self.pushButton,QtCore.SIGNAL("clicked()"),self.start_on)
>     def transmitter400(self):
>         data = np.array(np.fft.fft(np.random.uniform(0, 1, 726)), dtype=np.complex64)
>         freq = 450e6 print (freq)
>         band = 50e6 usrp = lib.usrp.multi_usrp("addr=192.168.10.2")
>         st_args = lib.usrp.stream_args("fc32", "sc8")
>         streamer = usrp.get_tx_stream(st_args)
>         usrp.set_tx_rate(band, 0)
>         usrp.set_tx_freq(lib.types.tune_request(freq), 0)
>         usrp.set_tx_gain(40, 0)
>         st_args.channels = [0]
>
>         #data = np.array(np.random.uniform(0, 1, 4096), dtype=np.complex64) usrp.set_time_now(lib.types.time_spec(0))
>
>         metadata = lib.types.tx_metadata()
>         metadata.start_of_burst = True metadata.end_of_burst=False metadata.has_time_spec=True metadata.time_spec = lib.types.time_spec(0.1)
>         metadata.time_spec+=usrp.get_time_now()
>
>         # QtCore.QObject.connect(window.gener) while True:
>             #QtCore.QThread.msleep(1) streamer.send(data, metadata)
>             metadata.start_of_burst=False metadata.end_of_burst  = False metadata.has_time_spec = False def transmitter800(self):
>         #lock = Lock() #lock.acquire() data1 = np.array(np.fft.fft(np.random.uniform(0, 1, 726)), dtype=np.complex64)
>         freq = 850e6 print (freq)
>         band = 50e6 usrp1 = lib.usrp.multi_usrp("addr=192.168.10.3")
>         st_args1 = lib.usrp.stream_args("fc32", "sc8")
>         streamer1 = usrp1.get_tx_stream(st_args1)
>         usrp1.set_tx_rate(band, 0)
>         usrp1.set_tx_freq(lib.types.tune_request(freq), 0)
>         usrp1.set_tx_gain(40, 0)
>         st_args1.channels = [0]
>         # data = np.array(np.random.uniform(0, 1, 4096), dtype=np.complex64) usrp1.set_time_now(lib.types.time_spec(0))
>
>         metadata1 = lib.types.tx_metadata()
>         metadata1.start_of_burst = True metadata1.end_of_burst = False metadata1.has_time_spec = True metadata1.time_spec = lib.types.time_spec(0.1)
>         metadata1.time_spec += usrp1.get_time_now()
>
>         # QtCore.QObject.connect(window.gener) while True:
> # QtCore.QThread.msleep(1) streamer1.send(data1, metadata1)
>               metadata1.start_of_burst = False metadata1.end_of_burst = False metadata1.has_time_spec = False #print metadata #metadata.has_time_spec=False #if
> window.gener.isChecked() == True: def start_on(self):
>
>             p = Process(target=self.transmitter400)
>             p1 = Process(target=self.transmitter800)
>             p.daemon=True p1.daemon=True p.start()
>             p1.start()
>             p.join()
>             p1.join()
> if __name__=="__main__":
>     app=QtGui.QApplication(sys.argv)
>     window=MainWindows()
>     window.show()
>     sys.exit(app.exec_())
>     if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
>         QtGui.QApplication.instance().exec_()
> Tell me please, what seems to be a problem?
> Thank you in advance.
>
>
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20171005/b58888fd/attachment-0002.html>


More information about the USRP-users mailing list