[USRP-users] spectrum analyzer USRP N210

Derek Kozel derek.kozel at ettus.com
Thu Nov 16 04:36:20 EST 2017


I've added back on the mailing list, just include usrp-users at lists.ettus.com
as a to: address. If you use reply-all in the future it will keep the list
up to date.

The "n" value needs to be adjusted now that the step size is 20% smaller.

On Thu, Nov 16, 2017 at 9:34 AM, Ivan Zahartchuk <adray0001 at gmail.com>
wrote:

> Yes, thanks to the spectrum is much better. the only negative is the
> central frequencies they are formed in the USRP itself. This can be seen
> on the graph in the time domain. Unfortunately I do not know how to add
> more people to this discussion. If you can do this I will be very grateful
>
> 2017-11-16 11:26 GMT+02:00 Derek Kozel <derek.kozel at ettus.com>:
>
>> Your spectrum looks far better, good. Are you happy with it?
>>
>> The large noiseless signals between each step look too identical and
>> clean. I recommend taking the samples from a single window and examining
>> the FFT at full bandwidth, at 80% bandwidth, and after your fftshift and
>> seeing if you can identify when that occurs.
>>
>> I recommend adding the usrp-users mailing list back onto this thread and
>> seeing anyone else can give advice on further improvements.
>>
>> On Thu, Nov 16, 2017 at 8:52 AM, Ivan Zahartchuk <adray0001 at gmail.com>
>> wrote:
>>
>>> Hi,
>>> Derek
>>> I did as you said. Here's what I got:
>>>
>>> n = int(math.ceil((config.stop_freq - config.start_freq) / config.band))
>>> fft1 = np.array([], dtype=np.complex64)
>>> fft2 = 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*0.8) * 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")
>>>       # np.array(recv_buff,dtype=np.float16)
>>>     prom1 = np.fft.fft(recv_buff)
>>>     prom1[0:5]=0
>>>     prom1[num_samps-5:num_samps]=0
>>>     prom1=np.fft.fftshift(prom1)
>>>     prom1= prom1[math.ceil(num_samps*0.1):num_samps-math.ceil(num_samps*0.1)]
>>>
>>>     #prom1= np.fft.fftshift(prom1)*w
>>>     fft1 = np.hstack((fft1,prom1))
>>>     #print(fft1.shape)
>>>     stream_cmd.time_spec = lib.types.time_spec(0)
>>>     streamer.issue_stream_cmd(stream_cmd)
>>>
>>>
>>> 2017-11-15 15:56 GMT+02:00 Derek Kozel <derek.kozel at ettus.com>:
>>>
>>>> Hello Ivan,
>>>>
>>>> The rule of thumb is that the digital filters are flat over 80% of the
>>>> passband. A good start would be to exclude the first and last 10% of each
>>>> FFT and reduce your frequency step size to 80% of the sample rate. This
>>>> will flatten your spectrum considerably.
>>>>
>>>> USRPs have a calibration routine for many of the daughterboards, which
>>>> one are you using? Some DC offset spur is usually inevitable, but there are
>>>> correction algorithms built into the USRP's FPGA. The tool will calculate
>>>> values for these APIs but also they can be set manually.
>>>> http://files.ettus.com/manual/page_calibration.html
>>>> http://files.ettus.com/manual/classuhd_1_1usrp_1_1multi__usr
>>>> p.html#a263ab7f0364c03e8a6e330c546769e4f
>>>> http://files.ettus.com/manual/classuhd_1_1usrp_1_1multi__usr
>>>> p.html#a586c52db545664cb2caf830ac90c051e
>>>>
>>>> Regards,
>>>> Derek
>>>>
>>>>
>>>>
>>>> On Wed, Nov 15, 2017 at 1:26 PM, Ivan Zahartchuk via USRP-users <
>>>> usrp-users at lists.ettus.com> wrote:
>>>>
>>>>> 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)
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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/20171116/693836ea/attachment-0002.html>


More information about the USRP-users mailing list