[USRP-users] spectrum analyzer USRP N210

Ivan Zahartchuk adray0001 at gmail.com
Wed Nov 15 08:26:26 EST 2017


Hello. I'm trying to make a broadband spectrum analyzer. I encountered some
difficulties with the USRP N210 board. At certain frequencies, I get such a
picture. And there are problems with the presence of central
frequencies. Advise
me how to remove these shortcomings.
My code:

n = int(math.ceil((config.stop_freq - config.start_freq) / config.band))
fft1 = np.array([], dtype=np.complex64)
for i in range(0, n):
    usrp.set_rx_freq(lib.types.tune_request(config.start_freq +
config.band / 2 + config.band * i), 0)
    streamer.recv(recv_buff, config.metadata)
    if config.metadata.error_code == lib.types.rx_metadata_error_code.timeout:
        print ("ERRROR")
    elif config.metadata.error_code == lib.types.rx_metadata_error_code.late:
        print ("ERR1")
    elif config.metadata.error_code ==
lib.types.rx_metadata_error_code.broken_chain:
        print ("ERR2")
    elif config.metadata.error_code ==
lib.types.rx_metadata_error_code.overflow:
        print ("ERR3")
    elif config.metadata.error_code ==
lib.types.rx_metadata_error_code.alignment:
        print ("ERR4")
    elif config.metadata.error_code ==
lib.types.rx_metadata_error_code.bad_packet:
        print ("ERR5")

    prom1 = np.fft.fft(recv_buff)
    prom1[0:5] = 0
    prom1[num_samps-5:num_samps] = 0
    prom1= np.fft.fftshift(prom1)*w
    fft1 = np.hstack((fft1,prom1))

    stream_cmd.time_spec = lib.types.time_spec(0)
    streamer.issue_stream_cmd(stream_cmd)

dbm = np.array(10 * np.log10(np.abs(fft1))  - 60)

return dbm,config.start_freq+(config.band/num_samps)*np.arange(dbm.size)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20171115/1c3f2a3e/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ?????? ?????? ?? 2017-11-15 15:17:55.png
Type: image/png
Size: 66137 bytes
Desc: not available
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20171115/1c3f2a3e/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ?????? ?????? ?? 2017-11-15 15:18:07.png
Type: image/png
Size: 66628 bytes
Desc: not available
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20171115/1c3f2a3e/attachment-0001.png>


More information about the USRP-users mailing list