ad9371-iiostream : Concept Clarification

Hi All,

I am working on ad9371-iiostream and i am not able to understand below API args:

ASSERT(cfg_ad9371_streaming_ch(ctx, &rxcfg, RX, 0) && "RX port 0 not found");  

ASSERT(cfg_ad9371_streaming_ch(ctx, &txcfg, TX, 0) && "TX port 0 not found");

    a) Does it mean that there are two ports i.e Rx/Rx Port 0 and Rx/Tx Port 1 ?

    b) Can i specify last param as "1" for Rx/Tx Port 1 ?

 

ASSERT(get_ad9371_stream_ch(ctx, RX, rx, 0, 'i', &rx0_i) && "RX chan i not found");

ASSERT(get_ad9371_stream_ch(ctx, RX, rx, 0, 'q', &rx0_q) && "RX chan q not found");

    a) For Channel 0 , i am specifying 0 as 4th arg so do i need to put "1" for Channel 1 ?

ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 0, 0, &tx0_i) && "TX chan i not found");

ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 1, 0, &tx0_q) && "TX chan q not found");

   a)  Why did i specify 4th arg as "1" for q channel ? I had expected "0"

Kindly put some light on this as i have to capture on Rx Channel -1 also.

Regards,

Manish

Top Replies

    •  Analog Employees 
    Jan 9, 2020 +1 verified

    ASSERT(cfg_ad9371_streaming_ch(ctx, &rxcfg, RX, 0) && "RX port 0 not found");  

    ASSERT(cfg_ad9371_streaming_ch(ctx, &txcfg, TX, 0) && "TX port 0 not…

  • +1
    •  Analog Employees 
    on Jan 9, 2020 8:01 AM 9 months ago

    ASSERT(cfg_ad9371_streaming_ch(ctx, &rxcfg, RX, 0) && "RX port 0 not found");  

    ASSERT(cfg_ad9371_streaming_ch(ctx, &txcfg, TX, 0) && "TX port 0 not found");

        a) Does it mean that there are two ports i.e Rx/Rx Port 0 and Rx/Tx Port 1 ?

        b) Can i specify last param as "1" for Rx/Tx Port 1 ?

    Please see here: 

    https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9371#driver_testingapi

    General attribute naming convention:

    in_voltage0_[…] RX1
    in_voltage1_[…] RX2
    in_voltage2_[…] Observation RX
    out_voltage0_[…] TX1
    out_voltage1_[…] TX2
    out_altvoltage0_[…] RX LO
    out_altvoltage1_[…] TX LO
    out_altvoltage1_[…] SNIFFER LO

    a) There are two RX channels RX1, RX2  and two TX channels TX1, TX2

    The first line configures RX1 LO frequency, the second TX1 LO frequency.

    b) If you set chid to 1 you'll address RX2 and TX2 instead.

    ASSERT(get_ad9371_stream_ch(ctx, RX, rx, 0, 'i', &rx0_i) && "RX chan i not found");

    ASSERT(get_ad9371_stream_ch(ctx, RX, rx, 0, 'q', &rx0_q) && "RX chan q not found");

        a) For Channel 0 , i am specifying 0 as 4th arg so do i need to put "1" for Channel 1 ?

    On the RX side channels are being modified by _i and _q. In this case for RX1

    in_voltage0_i and in_volatge0_q are one pair and represent RX1.

    For RX2 you need to use 1, which will result in in_voltage1_i and in_voltage1_q

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 0, 0, &tx0_i) && "TX chan i not found");

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 1, 0, &tx0_q) && "TX chan q not found");

       a)  Why did i specify 4th arg as "1" for q channel ? I had expected "0"

    On the TX side channels are not being modified. That's kind of an historical thing. When we first created the 

    cf_axi_dds driver for ad9361 the IQ modifiers didn't exist. So we decided to increase the index instead.

    And two successive channels represent I and Q.

    That's why

    out_voltage0 is RX1_i

    out_volatge1 is RX1_q

    -Michael

  • Thanks Michael for addressing each APIs. 

     As per understanding from your reply, I did pass "1" to get data on RX2. However, it gets failed with below error:

    "Error -13 writing to channel "RX_LO_frequency"

    When i dig into it, I found that i modified the below highlighted API:


    static bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn)
    {
            switch (d) {
             // LO chan is always output, i.e. true
            case RX: *chn = iio_device_find_channel(get_ad9371_phy(ctx), get_ch_name("altvoltage", 1), true); return *chn != NULL;
            case TX: *chn = iio_device_find_channel(get_ad9371_phy(ctx), get_ch_name("altvoltage", 1), true); return *chn != NULL;
            default: ASSERT(0); return false;
            }
    }

    Instead of passing "0" into get_ch_name() , I passed "1" which is the reason of failing. 

    As per my understanding while passing "0", it finds "out_altvoltage0_RX_LO_frequency" which does exist but while passing "1" as second arg into get_ch_name, it doesn't see "out_altvoltage1_RX_LO_frequency" as this doesn't exist.

    So my question is that shouldn't we change

    get_ch_name("altvoltage", 0 )  ---------- > get_ch_name("altvoltage", 1)

    Regards,

    Manish

  • 0
    •  Analog Employees 
    on Jan 9, 2020 1:33 PM 9 months ago in reply to manish3134

    Hi,

    Both RX share the same LO. Same applies for the TXs.

    out_altvoltage0_[…] RX LO
    out_altvoltage1_[…] TX LO
    out_altvoltage1_[…] SNIFFER LO

    The unmodified code should work as is.

    -Michael

  • Thanks so much Michael for addressing the complete issue.

    Regards,

    Manish

  • One query to clarify my doubt here.

    As you specified that Tx side channels are not being modified and based on mutual decision , index are increased. It means to me like for TX0 , below is the snippet:

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 0, 0, &tx0_i) && "TX chan i not found");

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 1, 0, &tx0_q) && "TX chan q not found");

    And For TX1,  below is the snippet:

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 2, 0, &tx0_i) && "TX chan i not found");

    ASSERT(get_ad9371_stream_ch(ctx, TX, tx, 3, 0, &tx0_q) && "TX chan q not found");

    Regards,

    Manish