[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Considerations when running a flowgraph manually from
From: |
Anderson, Douglas J. |
Subject: |
[Discuss-gnuradio] Considerations when running a flowgraph manually from a loop |
Date: |
Fri, 9 Jan 2015 18:41:19 +0000 |
Hi all,
I've written a small program to capture and plot fft data from the USRP.
Because it can also sweep and I have a limited knowledge (for now!) of writing
GNURadio blocks, I decided to use a separate main loop to run the flowgraph and
then handle the data. The flowgraph uses the head block to exit automatically
when it has captured the necessary amount of samples. This setup really
simplified handling retuning and plotting the data for me.
When sweeping, I expect there to be some junk samples acquired in the buffer
while the LO retunes and I can handle that with the skip block, but when I set
my program to only tune the USRP once and then plot the FFT constantly
(basically emulating uhd_fft), I'm still getting junk data. I've double checked
that the LO remains locked after the initial tune, so I think this extra junk
data is a result of running the flowgraph, letting it exit, processing the
data, and then running it again. uhd_fft, which is implemented as a block, does
not have the same issues.
I've included 3 screenshots. 1 is uhd_fft running on my USRP N210, the other
two are data from from my program plotted in matplotlib. In 1, you can see
noise plotted as you'd expect, except that the LO is MUCH more visible than in
uhd_fft. I confirmed that uhd_fft is not offsetting the LO so I'm not sure if
this is another side effect of how I'm handing the flowgraph. Another
screenshot shows the junk data that occasionally pops in and ruins my day.
My basic flowgraph setup is:
self.connect(self.usrp, self.skip) # USRP attached to skip block
(modified to be resetable like head)
self.connect(self.skip, s2v, self.head) # skip -> stream_to_vector ->
head
self.connect(self.head, fft) # head -> fft_vcc
self.connect(fft, c2mag_sq)
self.connect(c2mag_sq, stats, W2dBm, self.final_vsink)
In the last line, stats is just a block that can handle averaging, W2dBm
translates to dBm, and then all samples are dumped into a float vector sink
My program was set to skip 0 samples for these tests.
The main loop in pseudocode:
topblock.set_usrp_freq()
while True:
topblock.run()
data = topblock.final_vsink.data()
process and plot data
topblock.skip.reset()
topblock.head.reset()
* Is there anything tricky I should know about running a flowgraph from a
separate loop like I'm doing?
* What could cause the LO to be so much more pronounced in my plots as compared
to uhd_fft? For the screenshots I went to great lengths to ensure I was using
the same tuning and plotting parameters. Also, although I can control the
"junk" data by skipping samples with the "skip" block, it does not reduce the
LO throughput.
* Any leads on what could be causing the junk data even when the USRP is not
being retuned?
I'm at wits end, thanks in advance for any hints whatsoever.
-Doug
uhd_fft.png
Description: uhd_fft.png
usrp_lo.png
Description: usrp_lo.png
usrp_anomaly.png
Description: usrp_anomaly.png
- [Discuss-gnuradio] Considerations when running a flowgraph manually from a loop,
Anderson, Douglas J. <=