|
From: | Collins, Richard |
Subject: | [Discuss-gnuradio] PDUs in GNU Radio for UHD USRP Sink |
Date: | Thu, 10 Nov 2016 21:07:14 -0500 |
What I've done is make a block that accepts a stream of samples tagged by a previous block (using stream tags), and saves them off to a std::vector between the start and end tags. This part works as expected. Once this vector (or "pkt_buffer") is full, other samples are ignored and the transmission half of the code in this custom block is able to run. It uses usrp->get_time_now() to check to see if some time has elapsed, and if so, carves up the internal "pkt_buffer" vector into PDUs of the desired size (e.g. a max of 512 samples long), and sends them out of the registered message port. Externally, this port is connected to the "command" port of the UHD USRP Sink block.
I know these messages have a max size (I think of 4k samples), and it seems to work best (e.g. without the flowgraph freezing freezing, or uhd_usrp_source block taking up too much CPU of one core) when the size is smaller (e.g. 512 samples).
What happens though, as seen through captured samples from another SDR, is the USRP will output nothing for a while (a little longer than the expected length in time of my whole "packet" or set of PDUs). Then the USRP will output what looks just like a carrier signal for the rest of the time before the next burst of PDUs (I'm assuming from the Null Source feeding into the UHD USRP Sink block's streaming "in" port, which must be connected to something in GNU Radio).
As a small side note, I don't get an error output except for a single U per packet... it seems if I send too many PDUs (i.e. more than the first, second to last, and the last), I'll get a "U" after a whole set of PDUs is sent. I don't think that's a problem though.
I've checked the output of this block with the message debug block, and it seems that the correct samples are sent in the expected order.
An example of what I'm trying to do (in C++) can be found here: http://pastebin.com/uyNTkFmU
[Prev in Thread] | Current Thread | [Next in Thread] |