Hi Fabien,
Personally, I use PDUs to control when TX starts. GR 3.10 integrated a
lot more of these.
https://github.com/gnuradio/gnuradio/tree/main/gr-pdu
Besides, the gr-pdu_utils OOT might be a good reference.
https://github.com/sandialabs/gr-pdu_utils
It mentions SOB/EOB in their docs.
EOB is required to signal that a burst ends. I'm not sure if a SOB is
really required or if a USRP would just "wake up" and start transmitting.
I suggested the SOB/EOB mechanism because it sounds like you transmit
long bursts. Short bursts might be handled via tagged streams. The UHD
sink would handle these cases. By short bursts I mean <=4k complex samples.
Generally, the idea is: trigger transmission with a PDU block, use a PDU
to tagged stream block to fead you data into the GR streaming interface.
Then make sure to signal to the UHD sink when a burst ends.
Cheers
Johannes
On 04.03.22 12:50, Fabien PELLET wrote:
Hi Johannes,
Yes this is exactly my problem : after unlocking the flowgraph, I get
some underruns (only, no overrun).
Do you have an example of code using EOB/SOB ? Ok for sending EOB before
locking but is it necessary to send a SOB also and when ?
Your suggestion of idling the TX flowgraph is something I looked for
during several days but I never found how. Indeed, if I do not connect a
source and a sink at each ends, gnuradio will fail to run. How to stop
feeding one branch of a flowgraph ? Do you have examples of codes for
doing that ?
Thanks for your help,
Fabien, F4CTZ.
Le 04/03/2022 à 12:03, Johannes Demel a écrit :
Hi Fabien,
do those underruns occur after you lock/unlock and switch from TX to
RX or vice versa? Do you see overruns as well?
I'd assume the USRP expects a constant sample flow and even a short
interuption, like your lock/unlock task interrupts that flow.
Still assuming this is the root cause, you might fix this by sending
an EOB signal to the USRP before you lock the flowgraph.
Besides, the whole SOB/EOB mechanism might help you with your issue.
You can just stop the TX flowgraph portion while you don't need it. By
stop I mean, the flowgraph is not fed any new samples and just idles.
As an added bonus, you minimize LO leakage which might be an issue for
your RX flowgraph. I know this is a more intrusive change.
Cheers
Johannes
On 04.03.22 10:45, Fabien PELLET wrote:
Hello again,
I build a flowgraph in C++ with an RX chain and a TX chain. I'm using
a USRP N210. When I'm in RX, the TX chain is connected to a constant
zero source and feed a null sink and the RX chain is connected to
USRP source and sink. When I'm in TX, it is the opposite.
I have to keep the two chains running at the same time for switching
speed purpose and do not have to stop the flowgraph and restart it.
So for my switching, I just lock the top block and unlock it after.
If I always stay in RX, I have no underrun. Same thing in TX. My
problem is that when I lock and unlock the flowgraph, I get a lot of
underruns.
As a test, I remove the TX part of my flowgraph and only keep the RX
part and I try do some lock/unlock sometimes : same problem with
underruns.
How to do lock/unlock safely in C++ to avoid underruns ?
Thanks for the help,
Best regards,
Fabien, F4CTZ.