Post Go back to editing

Access second Tx and Rx of ADALM-PLUTO using MATLAB and ADI Hardware support packages

Category: Hardware
Product Number: Rev C
Software Version: MATLAB R2021b

Could someone please post a step by step instructions how to invoke the second Tx and Rx channels on ADALM-PLUTO Rev C in MATLAB?


Ofcourse, assuming that all the HW preparations and cabling has been performed well and that the ADALM-PLUTO already works well using single channel Pluto objects.


I have realised that the typical Pluto related commands do not work like in Python, so no 2x1 array of tx and rx objects can be enabled.


Does one use adi.9361.Rx and Tx objects instead of 'Pluto' ?

What are all the dependencies required for this additional step that enables 2 Rx and 2 Tx ?  

Thank you so much in advance.

  • Yes you are on the right track. Pluto in 2T2R mode would just require use of the AD9361/3 interfacing objects. You can use Transceiver Toolbox to get these.

    Here is the doc that discusses installation, requirements, and APIs: Analog Devices, Inc. Transceiver Toolbox (analogdevicesinc.github.io)

    Examples: TransceiverToolbox/trx_examples/streaming/ad936x at master · analogdevicesinc/TransceiverToolbox · GitHub

    -Travis

  • Dear Travis, thank yo so much for your quick response. I have installed the TRX ToolBox.
    The examples from GitHub worked, which was encouraging. 
    However, I am still having trouble accessing the second channel. 


    When I enable the 2 channels using MATLAB commands, e.g.

    tx.EnabledChannels = [1 2];

    rx.EnabledChannels = [1 2];

    it seems to accept these properties.

    And when I try to send (or receive) using tx([y y]) syntax, I get the errors below. 

    Is my code faulty? Slight smile

    MATLAB Console Ouptut:

    Error using matlabshared.libiio.base/cstatus
    Channel: voltage1 not found

    Error in adi.common.Attribute/setAttributeDouble (line 34)
    cstatus(obj,status,['Channel: ' id ' not found']);

    Error in adi.AD9361.Tx/setupInit (line 187)
    obj.setAttributeDouble('voltage1','hardwaregain',obj.AttenuationChannel1,true);

    Error in adi.common.RxTx/configureChanBuffers (line 219)
    setupInit(obj);

    Error in matlabshared.libiio.base/setupImpl

    Error in adi.common.RxTx/setupImpl (line 117)
    setupImpl@matlabshared.libiio.base(obj);

    Error in adi.common.Tx/setupImpl (line 23)
    setupImpl@adi.common.RxTx(obj);

    Error in DualCableLoopback_NB_v0_sine (line 42)
    tx([y y]);

  • Thanks again Travis.
    I think I have found the problem. In order to receive anything, one must change the mode in the firmware using SSH. Sorry that I have forgotten this step. I can access the samples now. Yet I still see some funny noise at the Rx end, even though I am sending pure sine (of amplitude = 2^15 as in instructions).
    I have a cable loopback Tx1-Rx1 and Tx2-Rx2 configuration. I will get back with some more questions.

  • In case someone searches for the same answer I am listing steps to achieve this:

    1. Make HW modifications (add holes and attach SMA to MHF adapter with cable)

    2. Update firmware.

    3. In an SSH session to the Pluto board change "attr_name", "attr_val" and "mode" to "compatible", "ad9361" and "2r2t", respectively.

    4. Install ADI's Transceiver toolbox for MATLAB

    5. Get to know and use appropriate syntax from Toolbox examples (different than the MATLAB's support package for Pluto!).


    Tx example:


    tx = adi.Pluto.Tx('uri','ip:Pluto');
    tx.DataSource = 'DMA';
    tx.CenterFrequency = fc;
    tx.EnableCyclicBuffers = true;
    tx.EnabledChannels = [1 2];
    tx.SamplingRate = fs;
    tx.RFBandwidth = BW;
    tx.AttenuationChannel0 = -30;
    tx.AttenuationChannel1 = -30;


  • Great discussion!  And thanks Travis and scaRF for documenting this procedure--it is very helpful.  Also, there is a video (link below) on how to do this Pluto 2T2R modifications (connect u.FL cables and SSH to change board attributes) and then an example of how to setup for Python.

    https://youtu.be/ph0Kv4SgSuI

      

  • Thank you, Jon! Actually, I am a follower of your work and I am trying to make an equivalent of your DBF Python model, but placed in MATLAB environment.

  • Fantastic!  Would you be able to share the results -- either here or on your github/youtube/twitter/etc when you get it working?  

  • Hey  , I am also trying to enable the second Tx and Rx channels on ADALM-Pluto Rev C in MATLAB. I have done the changes to the firmware using SSH, as well as the hardware modifications. I have installed the Transceiver Toolbox as well.

    However, I am unsure of the code to enable the 2nd Rx in MATLAB. I have done up a code for the main Rx to receive my local FM radio broadcast, but now I am trying to use the 2nd Rx to receive it. 

    May I know a step by step process as to how you enabled and used your 2nd receiver please?

  • Dear fish to the moon,

    Can you can try this snippet and adapt it to your needs? The data acquisition runs through typical rx() command.

    rx = adi.Pluto.Rx('uri','ip:Pluto');
    rx.CenterFrequency = fc(1);
    rx.kernelBuffersCount = 1;
    rx.EnabledChannels = [1 2];
    rx.SamplingRate = fs;
    rx.RFBandwidth = BW;
    rx.SamplesPerFrame = Nspf;
    rx.GainControlModeChannel0 = 'manual';
    rx.GainControlModeChannel1 = 'manual';
    rx.GainChannel0 = GainRx;
    rx.GainChannel1 = GainRx;