# USRP in TDD mode

**URL:** <https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953>\
**Category:** GNU Radio\
**Created:** [September 23, 2009, 4:02am UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953 "2009-09-23T04:02:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 23, 2009, 4:02am UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/1 "2009-09-23T04:02:32Z")

</div>

Hello.  
I’m trying to build a two-way TDD system with two USRP1 boxes in pure  
C++  
using libusrp and inband\_2rxhb\_2tx.rbf firmware.

Now I have working system where one USRP1 box transmits data and other  
box  
receives.  
I try to make the second box transmit data after it received certain  
frames.  
The issue is that when I try to enable transmitter on the second box the  
receive signal level significantly decreases. Typically received samples  
are  
in range [-15000; 15000], after enabling transmitter they are in range  
[-1000; 1000].

Does anyone have a clue of what I’m doing wrong?

Thanks.

The code I’m using:

```
    std::string rbf_fname = "inband_2rxhb_2tx.rbf";

    m_uTx = usrp_standard_tx::make(m_usrpNumber,
                   (unsigned int)m_interpolationRate,
                   1,
                   -1,
                   4096,
                   4096,
                   rbf_fname);

    if (!m_uTx.get())
    throw std::runtime_error("Couldn't create TX");

    usrp_subdev_spec tx_spec(0, 0);
    unsigned int tx_mux = m_uTx->determine_tx_mux_value(tx_spec);
    m_uTx->set_mux(tx_mux);

    db_base_sptr tx_subdev = m_uTx->selected_subdev(tx_spec);

    m_txGain = tx_subdev->gain_max();
    tx_subdev->set_gain(m_txGain);

    if (!m_uTx->tune(tx_subdev->which(), tx_subdev, g_tuneFrequency,

```

&m\_txTuneResult))  
throw std::runtime\_error(“TX tune failed\n”);

```
    tx_subdev->set_enable(true);

    // Enable RX
    m_uRx = usrp_standard_rx::make(m_usrpNumber,
                   (unsigned int)m_decimationRate,
                   1,
                   -1,
                   usrp_standard_rx::FPGA_MODE_NORMAL,
                   4096,
                   4096,
                   rbf_fname);

    if (!m_uRx.get())
    throw std::runtime_error("Couldn't create RX");

    // Select dautherboard
    usrp_subdev_spec rx_spec(0, 0);

    unsigned int rx_mux = m_uRx->determine_rx_mux_value(rx_spec);
    m_uRx->set_mux(rx_mux);
    m_rxGain = 60.0;

    db_base_sptr rx_subdev = m_uRx->selected_subdev(rx_spec);

    rx_subdev->set_gain(m_rxGain);

    if(!m_uRx->tune(rx_subdev->which(), rx_subdev, g_tuneFrequency,

```

&m\_rxTuneResult))  
throw std::runtime\_error(“RX tune failed\n”);

```
    rx_subdev->set_enable(true);
```

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 23, 2009, 4:08am UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/2 "2009-09-23T04:08:59Z")

</div>

On Tuesday 22 September 2009 19:47:10 Andrey A wrote:

> Hello.  
> I’m trying to build a two-way TDD system with two USRP1 boxes in pure C++  
> using libusrp and inband\_2rxhb\_2tx.rbf firmware.

IIRC the ib firmware has a bug not switching the antennaes correctly.  
Workaround: set RX antennae to RX2 and connect an antenna to each port.

Stefan

–  
Stefan BrÃ¼ns / BergstraÃŸe 21 / 52062 Aachen  
phone: +49 241 53809034 mobile: +49 151 50412019

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 23, 2009, 6:34pm UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/3 "2009-09-23T18:34:22Z")

</div>

Hello.  
I tried connecting antenna to RX2 and signal strength increased.  
I use std\_2rxhb\_2tx.rbf with RFX2400 DB.  
Am I correct assuming that if only RX is enabled then RX/TX antenna is  
used  
and if with TX and RX are both enabled TX samples go to TX/RX antenna,  
and  
RX samples go thru RX2 ?

If previous assumption is right, how to make TX and RX samples to thru  
the  
same antenna?

Thanks.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 23, 2009, 4:57pm UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/4 "2009-09-23T16:57:44Z")

</div>

Stefan,  
Thanks for reply. I tried std\_2rxhb\_2tx.rbf firmware from gnuradio 3.2.2  
and  
results are the same. Without enabling transmitter at the receiver the  
received signal range is [-15e3; +15e3], and after enabling transmitter  
it  
became [-2400; +2400].  
The workaround you mentioned is not applicable in my situation, since I  
need  
to receive and transmit from the same antenna.

I’m not sure if I enable receiver and transmitter simultaneously in the  
right way.

Thanks.

On Tue, Sep 22, 2009 at 9:55 PM, Stefan BrÃ¼ns

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 25, 2009, 1:30pm UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/5 "2009-09-25T13:30:54Z")

</div>

Hi.  
I finally figured it out.  
To automatically switch between TX and RX paths it’s needed to call

subdev-\>select\_rx\_antenna(“TX/RX”);  
subdev-\>set\_auto\_tr(true);

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 21, 2014, 9:25am UTC](https://www.ruby-forum.com/t/usrp-in-tdd-mode/175953/6 "2014-11-21T09:25:10Z")

</div>

Hello Andrea,

It would be great if you can share a little more information. Which code  
you have used and how you resolved the issue.

Thanks
