​Hello. I use B200 to scan the spectrum in a certain band. I have two
problems.
1) the last part of the collection of the spectrum becomes the beginning. Fig.
1
2) the switching time from frequency to frequency is alternated
0.00305509567261
0.0539989471436
0.00493001937866
0.054967880249
0.0047459602356
0.055587053299
I enclose to you my code in python

import numpy as np
from uhd import libpyuhd as lib
import time
list = [400e6, 450e6, 550e6, 600e6]
def initialization_usrp():
    usrp = lib.usrp.multi_usrp(" ")
    global usrp
def preinstall():

    st_args = lib.usrp.stream_args("fc32", "sc16")

    streamer = usrp.get_rx_stream(st_args)
    stream_cmd = lib.types.stream_cmd(lib.types.stream_mode.num_done)
    recv_buff = np.zeros(8192, dtype=np.complex64)
    usrp.set_rx_gain(60, 0)
    usrp.set_rx_rate(56e6)
    usrp.set_rx_bandwidth(56e6)
    metadata_rx = lib.types.rx_metadata()
    stream_cmd.num_samps = 8192
    stream_cmd.stream_now = True
    streamer.issue_stream_cmd(stream_cmd)

    global  streamer, recv_buff, stream_cmd,metadata_rx


def reciever():
    buffs = np.array([])

    for i in list:
        start = time.time()
        usrp.set_rx_freq(lib.types.tune_request(i))
        print(time.time() - start)
        streamer.recv(recv_buff, metadata_rx)
        if metadata_rx.error_code == lib.types.rx_metadata_error_code.timeout:
            print ("ERRROR")
        elif metadata_rx.error_code == lib.types.rx_metadata_error_code.late:
            print ("ERR1")
        elif metadata_rx.error_code ==
lib.types.rx_metadata_error_code.broken_chain:
            print ("ERR2")
        elif metadata_rx.error_code ==
lib.types.rx_metadata_error_code.overflow:
            print ("ERR3")
        elif metadata_rx.error_code ==
lib.types.rx_metadata_error_code.alignment:
            print ("ERR4")
        elif metadata_rx.error_code ==
lib.types.rx_metadata_error_code.bad_packet:
            print ("ERR5")
        stream_cmd.time_spec = lib.types.time_spec(0)
        streamer.issue_stream_cmd(stream_cmd)
        PSD = 10.0 *
np.log10(np.abs(np.fft.fftshift(np.fft.fft(recv_buff, 1024) /
float(1024))) ** 2)
        buffs = np.append(buffs, PSD)

        # if buffs.size == 4 * 8192:
    #        #  global recv_buff
    return buffs
    # else:
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to