[USRP-users] uhd python transmition

Ivan Zahartchuk adray0001 at gmail.com
Mon Oct 2 15:46:54 EDT 2017


Hi, Marcus

I'm working on the data transmission using USRP B200 and UHD Python driver.
When transmitting the data, the error U appears. I think that the problem
is in the USRP B200 initialisation. 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
from time import sleep

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 transmitter(self):
        freq = 450e6
        print (freq)
        band = 30e6
        usrp = lib.usrp.multi_usrp(" ")
        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]
        metadata = lib.types.tx_metadata()
        metadata.start_of_burst = True
        metadata.end_of_burst=False
        metadata.time_spec = lib.types.time_spec(1)
        data = np.array(np.random.uniform(0, 1, 4096), dtype=np.complex64)
        # QtCore.QObject.connect(window.gener)
        while True:
            streamer.send(data, metadata)
            metadata.time_spec = lib.types.time_spec(0)
            #metadata.has_time_spec=False
            #if window.gener.isChecked() == True:
    def start_on(self):
            p = Process(target=self.transmitter)
            p.start()
            p.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.

PS sorry for my English
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20171002/1558df4a/attachment-0002.html>


More information about the USRP-users mailing list