This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR1642BOOST: Collecting Raw ADC Data using MATLAB

Part Number: AWR1642BOOST

Hi,

My goal is to understand the exact way to control mmwave stdio via external matlab script (to configure the chirp configurations and automate raw data capture and user customized post processing with DCA1000/IWRxxx environment).

I`m working through this e2e, and I eventually have reached the following log on output console of mmwave studio:

[12:20:43] [RadarAPI]: Starting Matlab Engine..
[12:21:04] [RadarAPI]: Matlab Engine Started!
[12:21:12] [RadarAPI]: ar1.LoadSettings('C:\Users\139432\AppData\Roaming\RSTD\ar1gui.ini')
[12:21:12] TESTING = false
[12:21:12]
[12:21:12] ***Script completed successfully.***
[12:22:06] RstdNet: Port 2777: Listening..

The config file installation and *.m script deployment to C:\ti\mmwave_studio_01_00_00_00\mmWaveStudio\Clients\RtttNetClientController suggested on the shared e2e post seems ok.

So, what should i do for next ? Could you please kindly suggest ? Please note i`m new for mmwave and matlab scripting.

Best Regards,

NK

EDIT--
The post has been tagged with AWR1642BOOST, but my target device is not AWR, but IWR.

  • Hi,

    Additional comments:
    Please note I don`t have matlab installed on my machine because of commercial software. Only matlab runtime has been installed for mmwave studio evaluation. Please take care about this condition when you answers to my question.

    It would be nice if we can use free Matlab-like software (for example, octave) to realize this... Can you also comment on this ?

    Best Regards,
    NK
  • Hi Naoki,
    You can refer this thread discussing about same query-
    e2e.ti.com/.../713352

    Octave and Matlab commands are more or less same, these procedure shoudl work with Octave as well.

    Regards,
    Jitendra
  • Hi Jitendra,

    Thanks for your reply.

    I just invoked the following command on octave command line after RSTD.NetStart() has been executed on mmwave studio lua shell and saw the following error:

    octave:3> RSTD_Interface_Example
    Adding RSTD Assembly
    error: 'NET' undefined near line 9 column 21
    error: called from
       Init_RSTD_Connection at line 9 column 19
       RSTD_Interface_Example at line 6 column 11
    octave:3>

    It seems like i have encountered the error at NET in the script. RSTD_Interface_Example.m looks like this:

    function ErrStatus = Init_RSTD_Connection(RSTD_DLL_Path)
    %This script establishes the connection with Radarstudio software
    %   Pre-requisites:
    %   Type RSTD.NetStart() in Radarstudio Luashell before running the script. This would open port 2777
    %   Returns 30000 if no error.
    
    if (strcmp(which('RtttNetClientAPI.RtttNetClient.IsConnected'),'')) %First time the code is run after opening MATLAB
        disp('Adding RSTD Assembly');
        RSTD_Assembly = NET.addAssembly(RSTD_DLL_Path);
        if ~strcmp(RSTD_Assembly.Classes{1},'RtttNetClientAPI.RtttClient')
            disp('RSTD Assembly not loaded correctly. Check DLL path');
            ErrStatus = -10;
            return
        end
        Init_RSTD_Connection = 1;
    elseif ~RtttNetClientAPI.RtttNetClient.IsConnected() %Not the first time but port is diconnected
        % Reason:
        % Init will reset the value of Isconnected. Hence Isconnected should be checked before Init
        % However, Isconnected returns null for the 1st time after opening MATLAB (since init was never called before)
        Init_RSTD_Connection = 1;
    else
        Init_RSTD_Connection = 0;
    end
    if Init_RSTD_Connection
        disp('Initializing RSTD client');
        ErrStatus = RtttNetClientAPI.RtttNetClient.Init();
        if (ErrStatus ~= 0)
            disp('Unable to initialize NetClient DLL');
            return;
        end
        disp('Connecting to RSTD client');
        ErrStatus = RtttNetClientAPI.RtttNetClient.Connect('127.0.0.1',2777);
        if (ErrStatus ~= 0)
            disp('Unable to connect to Radarstudio');
            disp('Reopen port in Radarstudio. Type RSTD.NetClose() followed by RSTD.NetStart()')
            return;
        end
        pause(1);%Wait for 1sec. NOT a MUST have.
    end
    disp('Sending test message to RSTD');
    Lua_String = 'WriteToLog("Running script from MATLAB\n", "green")';
    ErrStatus = RtttNetClientAPI.RtttNetClient.SendCommand(Lua_String);
    if (ErrStatus ~= 30000)
        disp('Radarstudio Connection Failed');
    end
    disp('Test message success');
    end
    

    Can you suggest ? Please note windows 10 (64bit) is running on my PC and it supports .NET Framework 4.7.2.

    Best Regards,
    NK

  • Jitendra,

    Could you please give me your comments on this ? I need to visit the customer to discuss this topic tomorrow.

    As i mentioned, our goal is to know the exact way to control mmwave stdio via external matlab script (to configure the chirp configurations and automate raw data capture and user customized post processing with DCA1000/IWRxxx environment). I would be nice to have:
    - support on other matlab like tools (octave, freemat, and etc..)
    - have more detailed and comprehensive example script to realize this, assuming some kind of exact use case, for example; initially setup chirps and setup configuration for capturing, trigger frame and dump some amount of incoming raw data, do post processing, and then loop some over the capturing and processing part.
    The user guide mentioned that the controlling mmwave lua script via external matlab would be supported , but that's it -- not so clear to understand the exact way)

    Best Regards,
    NK
  • Hi,

    I`m still getting stuck at the following error on octave :

    octave:3> RSTD_Interface_Example
    Adding RSTD Assembly
    error: 'NET' undefined near line 9 column 21
    error: called from
       Init_RSTD_Connection at line 9 column 19
       RSTD_Interface_Example at line 6 column 11
    octave:3>

    Could you please suggest ?

    Best Regards,
    NK

  • Hello Naoki,
    Apologies for delayed response.
    As Octave doesn't contain any Windows or .NET specific functions which is causing this issue. Better to search on internet for possible solution of .Net usage with Octave.

    This thread has been assigned to IWR team for further communication.


    Regards,
    Jitendra
  • Hi Jitendra,

    Thank you for your reply. I`ve installed trial version of matlab and now the problem has been disappeared. As you say, this seems no .NET function in octave. But please note, my license will be expired in a month. . . I`m waiting for your further information.

    Best Regards,
    NK
  • NK,

    Here is a small example script that you can run in mmWave studio, we will also run the same commands in MatLab, just make sure that you are able to run these in mmWave studio.

    1. Create a text file.
    2. Copy and paste the lua code below.
    3. Modify your location for the BSS and MSS firmware files.
    4. save it with a “.lua” extension
    5. Run the script from mmwave studio according to the instruction on “Automation/Scripting” in the "mmwave_studio_user_guide.pdf"

    -- ************** Lua Code Begins*******************

    -- Reset control
    ar1.SOPControl(2)

    --RS232 connection
    ar1.Connect(6,921600,1000)

     

    -- Files
    ar1.DownloadBSSFw("C:\\ti\\mmwave_studio_<version>\\rf_eval_firmware\\radarss\\xwr16xx_radarss.bin")
    ar1.DownloadMSSFw("C:\\ti\\mmwave_studio_<version>\\rf_eval_firmware\\masterss\\xwr16xx_masterss.bin")

     

    -- SPI operations
    ar1.PowerOn(0, 1000, 0, 0)
    ar1.RfEnable()


    -- ******************** end Lua code ********************

    Following the instruction and sample code in the "mmwave_studio_user_guide.pdf" , in the chapter named "Controlling mmWaveStudio from Matlab"
    create the scripts "RSTD_Interface_Example.m" and "Init_RSTD_Connection.m".

    After you have ran the scripts "RSTD_Interface_Example.m" and "Init_RSTD_Connection.m", then you can begin passing all the above commands as MatLab strings, examples below.

    % Matlab Code begins


    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.SOPControl(2)");

    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.Connect(6,921600,1000)");

    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.DownloadBSSFw("C:\\ti\\mmwave_studio_<version>\\rf_eval_firmware\\radarss\\xwr16xx_radarss.bin")");

    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.DownloadMSSFw("C:\\ti\\mmwave_studio_<version>\\rf_eval_firmware\\masterss\\xwr16xx_masterss.bin")");

    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.PowerOn(0, 1000, 0, 0)");

    RtttNetClientAPI.RtttNetClient.SendCommand("ar1.RfEnable()");

    % MatLab code ends

     

    Hope this was helpful.

    Alex

     

  • Hi Alex,

    Thank you for your help. Last Week, I had been able to capture raw data in matlab by initiating lua scripts from there. But still, the above example you provided would be helpful for other users.

    OK, another problem is still pending. Please note i`m using free evaluation version of matlab and it would be expired in 1 month. So If you have any trick to use .NET from free matlab-like tool, say octave, please let me know.

    Best Regards,
    NK

  • NK,

    Unfortunately at this time there is only support for MatLab. That being said, if you are able to control mmWave studio through MatLab, I will consider the issue resolved.

    Alex

  • Hi Alex,

    Ok, you do only support matlab for now. Understood.

    Best Regards,
    NK