On 22/11/2022 16:24, Moses Browne Mwakyanjala wrote:
Hi everyone,
I wrote a simple program for a usrp b210. I would like to change the
RX antenna on the fly. That is, antenna 0 should be RX2 on Subdevice
A:A and antenna 1 RX2 on Subdevice A:B as shown in the piece of code
below. The problem I face is that I can't change the subdevice on the
fly. The usrp->set_rx_subdev_spec(sRxSubDev) call doesn't seem to have
any effect if it is called more than once. How should I proceed?
std::string sRxSubDev;
switch(m_Settings.m_nTMAntenna)
{
case 0:// Using antenna 1
sRxSubDev = std::string("A:A");
break;
case 1:// Using antenna 2
sRxSubDev = std::string("A:B");
break;
}
usrp->set_rx_subdev_spec(sRxSubDev);
usrp->set_rx_antenna("RX2");
Thanks in advance,
Moses.
You would likely have to tear down the streamer and start a new one.
Alternately, you could just stream both channels at the same time, and
simply drop the samples from the part of the stream
you don't care about.