[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to reset stream to vector block?

From: uncle_ali42
Subject: How to reset stream to vector block?
Date: Mon, 29 Nov 2021 19:39:31 +0000

I'm working on a basic gnuradio flowgraph which is consist of a usrp source and a zmq pub sink.
I am using usrp source with issue_stream_cmd in "STREAM_MODE_NUM_SAMPS_AND_MORE"  mode. My goal is to request N number of samples from usrp source at specific times send data to ZMQ pub sink.
Usrp source gives requested N number of samples in several packets but it is not suitable for my application. I need to send N samples to ZMQ as one pakcet. So, I decided to use a stream to vector block between usrp source and zmq pub sink, but there is a problem.
In my application, I try to make usrp source stop immediately after starting the flowgraph so that it only sends data when I request. However, when flowgraph is started, usrp source starts streaming data  until usrp source is stopped for a short time. So, if I put a stream to vector block between usrp source and zmq pub sink, some data from beginning of the flowgraph will be stored in stream to vector block. Therefore, I need to reset stream to vector block before I send a stream request to get requested data as one packet.
There are two possible solutions:
1- Configuring usrp source such that it does not start streaming when the flowgraph is started. (making it stop has another problems, I will ask help for it in further e-mails.)
2- Resetting/flushing stream to vector block when flowgraph is running.

I couldn't find any functions to reset or at least change vector size of stream to vector block (to make it 0 at the beginning and set to N when required).
I tried setting stream to vector block to a new created stream to vector block while flowgraph is running but it didn't work.
I tried locking the flowgraph, disconnecting stream to vector block and connecting a new stream to vector block and unlocking the flowgraph. When I unlock the flowgraph, usrp source starts streaming again and fills the new stream to vector block, so it didn't solve the problem.
The only way that I can make it work is, (after stopping usrp soruce) disconnecting old block, creating a new block and connecting it while flowgraph is running without locking. It seems it is working this way but I don't think it is a good way to do it, so I am searching for better solutions.

I don't have much experience with gnuradio, any suggestions would be helpful.

I am using gnuradio version with usrp E310


reply via email to

[Prev in Thread] Current Thread [Next in Thread]