Post Go back to editing

ACE RX Capture, Analysis and FFT Export via Matlab

Category: Software
Product Number: ADRV9040
Software Version: 1.30.3290.1451

Hello - I have been using ACE GUI (ver. 1.30.3290.1451 x64) running on ADS10 FPGA + ADRV9040 EVK (ver. 1.2024.28200).  I have been trying to write a Matlab script to capture RX0 samples, run FFT analysis and save the SNR number from the results of ACE.  Created an ACE macro which captures, does analysis and exports results.  The ACE macro runs well.  Therefore, I exported the ACE macro into Matlab using ACE's macro tools.  However, the Matlab script runs only partially.  It fails and reports bad transaction information in "PullAllCaptureDataToStore."  Questions:

- Could you please debug the Matlab script so it successfully exports the FFT data?

- Instead of exporting the full FFT data, is there a function to export the SNR value only?

- In general, is there a documentation available describing the ACE macro functions to make scripting and debugging easier?

Thank you and best regards, Peter.


-- Analog Devices, Inc. evaluation macro file
## Copyright © 2024 by Analog Devices, Inc. All rights reserved. This software is proprietary to Analog Devices, Inc. and its licensors.
## This software is provided on an “as is” basis without any representations, warranties, guarantees or liability of any kind.
## Use of the software is subject to the terms and conditions of the Clear BSD License ( spdx.org/.../BSD-3-Clause-Clear.html ).
UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
@Subsystem_1.ADRV9040 Board.ADRV9040: @AsyncDataCapture("Rx (Capture)DataSet_0");
@Subsystem_1.ADRV9040 Board.ADRV9040: Evaluation.Capture.PullAllCaptureDataToStore(-1, 4000, False, True, "Rx (Capture)DataSet_0", "Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)", None);
UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
@Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture): Evaluation.Data.ExportStoreDataToFile("acesamples", "acesamples", , , Overwrite);
UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
@Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture): Evaluation.Data.ExportStoreDataToFile("acesamples", "acesamples", , , Overwrite);
UI.SelectTab("tool.macrorecorder");


function ADRV9040_capture_export()
NET.addAssembly('C:\Program Files\Analog Devices\ACE\Client\AnalogDevices.Csa.Remoting.Clients.dll');
NET.addAssembly('C:\Program Files\Analog Devices\ACE\Client\AnalogDevices.Csa.Remoting.Contracts.dll');

% Copyright 2024 by Analog Devices, Inc. All rights reserved. This software is proprietary to Analog Devices, Inc. and its licensors.
% This software is provided on an "as is" basis without any representations, warranties, guarantees or liability of any kind.
% Use of the software is subject to the terms and conditions of the Clear BSD License ( spdx.org/.../BSD-3-Clause-Clear.html ).

import AnalogDevices.Csa.Remoting.Clients.*;
import AnalogDevices.Csa.Remoting.Contracts.*;

manager = ClientManager.Create();
client = manager.CreateRequestClient(2357);
client.ConnectionTimeout = 100000000;
client.SendTimeout = 100000000;
client.ReceiveTimeout = 100000000;

execute_macro(client);
% client.CloseSession();
end

function execute_macro(client)
% UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
client.ContextPath = '\System\Subsystem_1\ADRV9040 Board\ADRV9040';
client.SetBoolParameter('virtual-parameter-rx0-runtime-enable', 'True', '-1');
client.Run('@ToggleCaptureChannels');
client.Run('@ApplyTrackingCals');
client.GetBoolParameter('virtual-parameter-rx0-runtime-enable');

% UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
client.ContextPath = '\System\Subsystem_1\ADRV9040 Board\ADRV9040';
client.Run('@AsyncDataCapture(Rx (Capture)DataSet_0)');
client_StorePath = char('Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)');
client.PullAllCaptureDataToStore('-1', '10000', 'True', 'True', 'Rx (Capture)DataSet_0', client_StorePath, 'None');
%client.PullAllCaptureDataToStore('-1', '10000','True', 'True', 'Rx (Capture)DataSet_0', 'Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)', 'None');
%client.PullAllCaptureDataToStore: MaxSamples=-1, WaitTimeout=10000, ReplacePrevious=True, UseWaitOnCapture=True,
%DataSetName=Rx (Capture)DataSet_0, StorePath=Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture), MergeMode=None".

% UI.SelectTab("Root::System.Subsystem_1.ADRV9040 Board.ADRV9040.Rx (Capture)");
client.ContextPath = '\System\Subsystem_1\ADRV9040 Board\ADRV9040\Rx (Capture)';
% The default export directory -->> C:\Users\[current-user]\AppData\Local\Analog Devices\ACE\ExportData\
client.ExportStoreDataToFile('acesamples', 'acesamples', '', '', 'Overwrite');
% UI.SelectTab("tool.macrorecorder");
end

  • Hi Peter,

    Thanks for getting in touch,

    I'll address each of your questions individually:

    - Could you please debug the Matlab script so it successfully exports the FFT data?

    Unfortunately, I don't have the hardware on hand to reproduce the issue you are seeing, so I can only provide some insights from reading through the script. 
    I can see some differences between how the macro would execute versus the matlab script that may be the cause of the issue. 

    Basically, any transaction that has an @ in front of it, for example @AsyncDataCapture, is a context based transaction, which means that where it is executed from is important.

    In your recorded macro, before running the @AsyncDataCapture and PullAllCaptureDataToStore commands, the ADRV9040 Board.ADRV9040.Rx (Capture) tab is selected, making this the context from which the commands will be run, and it will attempt to run the AsyncDataCapture from the Rx Capture node.

    In the matlab script, I can see the tab select is commented out and replaced with the client.ContextPath being set, however, the context that is set is \System\Subsystem_1\ADRV9040 Board\ADRV9040, missing the Rx (Capture) portion of the context from above, meaning the following commands will attempt to run in the context of the ADRV9040 chip rather than the Rx (Capture) node.

    I would suspect this is the issue which is causing the failure, but without more info it is hard to say. Adding the missing context to the client context path, or leaving in the tab select just to debug this might resolve your issue.

    I can also see you are trying to use a local variable to set the storePath for the PullAllCaptureDataToStore transaction, I am unsure whether the matlab command will actually replace this as expected for the ACE client, so I would advise sticking with the raw string until you get this verified as working.

    If the above does not resolve the issue for you, you can help us to debug by providing a log output that will let us see what is happening on the ACE side. If you run the matlab script and observe the issue occurring, then go to ACE and click the menu button in the top left of the screen, there is a "View Log File" option. Select this and then save and attach the file to a reply here, this will let us see the stacktrace of the error and help us to debug given that we do not have hardware to reproduce the issue ourselves.

    - Instead of exporting the full FFT data, is there a function to export the SNR value only?

    Unfortunately not, the Export transactions currently only support exporting the full dataset.

    - In general, is there a documentation available describing the ACE macro functions to make scripting and debugging easier?

    If you open ACE and then click the Help button in the bottom left, a side panel will open. Under Application Resources, select Remote Control Interface Documentation, this will open a CHM file viewer that provides a list of the available transactions and their parameters. Expand the following to see the full list: Namespaces -> AnalogDevices.Csa.Evaluation.Remoting -> EvaluationRequestClient Class -> EvaluationRequestClient Methods

    Hopefully this helps to resolve your issue,

    Thanks,

    EoinM

  • Hello EoinM - Thank you for your detailed reply.  I experimented more with Matlab scripts, ACE macros and ACE GUI clicks while watching what was being recorded in the ACE log file (as you suggested).  Also, I looked up the input parameters of "ACE Remoting Client" functions in the "Remote Control Interface Document" (accessible from ACE Help).  I was not able to pass the input parameters to the "PullAllCaptureDataToStore" function called from Matlab although it works in ACE macro.  However, reducing the number of input parameters and relying on the defaults (i.e., leaving some parameters out from the call), the "PullAllCaptureDataToStore" function called from Matlab finally executes without errors and produces the desired output.  Same is true for the "ExportStoreDataToFile" function called from Matlab.  In conclusion, I am providing below the simple script which captures, analyses and exports the FFT (along with SNR, SNDR, etc., header) of the RX signal applied to ADRV9040 EVK.  Thank you for your help and suggestions!


    function ADRV9040_capture_export() % Matlab function which captures, analyses and exports the FFT (with SNR, SNDR, etc. header) 

    NET.addAssembly('C:\Program Files\Analog Devices\ACE\Client\AnalogDevices.Csa.Remoting.Clients.dll');
    NET.addAssembly('C:\Program Files\Analog Devices\ACE\Client\AnalogDevices.Csa.Remoting.Contracts.dll');

    % Copyright (C) 2024 by Analog Devices, Inc. All rights reserved. This software is proprietary to Analog Devices, Inc. and its licensors.
    % This software is provided on an "as is" basis without any representations, warranties, guarantees or liability of any kind.
    % Use of the software is subject to the terms and conditions of the Clear BSD License ( spdx.org/.../BSD-3-Clause-Clear.html ).

    import AnalogDevices.Csa.Remoting.Clients.*;
    import AnalogDevices.Csa.Remoting.Contracts.*;

    manager = ClientManager.Create();
    client = manager.CreateRequestClient(2357);
    execute_macro(client);
    % client.CloseSession();
    end

    function execute_macro(client)
    client.ContextPath = '\System\Subsystem_1\ADRV9040 Board\ADRV9040';
    client.Run('@AsyncDataCapture(Rx (Capture)DataSet_0)');
    client.PullAllCaptureDataToStore('-1', '4444', 'True', 'True');

    client.ContextPath = '\System\Subsystem_1\ADRV9040 Board\ADRV9040\Rx (Capture)';
    client.ExportStoreDataToFile('acesamples', 'csv', '', 'fft', 'Overwrite');
    end

  • Hi Peter,

    Glad you got this working, and thank you for providing the working script.

    Let me know if you have any further issues,

    Thanks,
    Best regards,

    EoinM