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.

DCA1000EVM: Control via matlab gui

Part Number: DCA1000EVM
Other Parts Discussed in Thread: AWR2243BOOST,

Hi, I'm using the awr2243boost with the dca1000evm, and I'm trying to create a matlab gui to automate the data capture process. I managed to connect to the radar with the TI init_rstd_connection code and configure the chirp parameters, now I'm trying to capture raw data with the dca1000evm through my graphical interface. Is there any code that can help me do so ? 

  • Hi,

    Please give us some time to search internally an example

    thank you
    Cesar

  • To give you an idea of how it can be done here is a sample function in matalb that allows you to capture raw data. You can modify the function and use it accordingly:

    function CLI_OneTimeDataCapture_function(homeDir, testName, COM_PORT_RADAR_CONFIG, CONFIG_FILE_NAME, dataCaptureFlag)

    %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Need to run this automation scrip under
    % C:\ti\mmwave_studio_03_00_00_14\mmWaveStudio\PostProc
    % but need to addpath to this matlab directory
    % and all the recorded data and the configuration files should be saved in homeDir.
    % an example to call this function in matlab (if you can have a matlab
    % license with
    % >>CLI_OneTimeDataCapture_function('C:\DCA1000CLI_dataCapture_git\','AOPES2', 'chirp1_61G_ES2', '1');
    %
    %% Suggest to create matlab execution for this function
    % through the following command
    % >>mcc -m CLI_OneTimeDataCapture_function.m
    % and save the execution function under
    % C:\ti\mmwave_studio_03_00_00_14\mmWaveStudio\PostProc
    % An example to run this function under dos command windows is listed below:
    % >CLI_OneTimeDataCapture_function.exe C:\DCA1000CLI_dataCapture_git\ AOPES2 chirp1_61G_ES2 1
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % INPUT parameter
    %-----------------------------------------------------------------------------------------------
    % HomeDir: is used to access configuration file and json file
    % testName: is used as a part of the file name for collected data
    % CONFIG_FILE_NAME: configuration file to be used to configure the sensor, is also used
    % as part of the file name for collected data
    % dataCaptureFlag: data capture mode or post processing mode
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    %% -----------------------------------------------------------------------
    %% parameter that may need to change
    %-------------------------------------------------------------------------
    % configuration file name
    configFile = strcat(homeDir,'\config\',CONFIG_FILE_NAME);
    sensorRestartFile = strcat(homeDir, '\config\sensor_restart.cfg');
    sensorStopFile = strcat(homeDir,'\config\sensor_stop.cfg');
    datacardConfigJsonFile = strcat(homeDir,'\config\datacard_config.json');

    adcDataFileName = strcat(homeDir, '\Data\',testName,'_',CONFIG_FILE_NAME,'.bin');

    % data capture mode or post processing mode
    dataCaptureFlag = str2num(dataCaptureFlag);
    %-------------------------------------------------------------------------

    % Close all UART
    fclose all;
    scoms = instrfindall;
    while (~isempty(scoms))
    stopasync(scoms);
    fclose(scoms);
    delete(scoms);
    scoms = instrfindall;
    end

    % prepare the capture
    if dataCaptureFlag
    system(['DCA1000EVM_CLI_Control.exe reset_ar_device ', datacardConfigJsonFile])
    pause(3)
    system(['DCA1000EVM_CLI_Control.exe fpga ', datacardConfigJsonFile])
    system(['DCA1000EVM_CLI_Control.exe record ', datacardConfigJsonFile]);
    pause(2);
    sendCfg(COM_PORT_RADAR_CONFIG, strcat(configFile,'.cfg'));
    end


    %% one time data capture
    % data file capture through DCA1000 CLI control interface
    if dataCaptureFlag
    % Need to start capture before sensor start in order for DCA1000 to capture from the start of the frame
    sendCfg(COM_PORT_RADAR_CONFIG, sensorStopFile);
    system(['DCA1000EVM_CLI_Control.exe start_record ', datacardConfigJsonFile]);
    pause(0.5);
    sendCfg(COM_PORT_RADAR_CONFIG, sensorRestartFile);
    pause(3);
    system(['DCA1000EVM_CLI_Control.exe stop_record ', datacardConfigJsonFile]);
    pause(0.5);
    system((['copy C:\myCliSavedData\adc_data_Raw_0.bin ', adcDataFileName]));
    end

  • Hi, thanks for your reply.

    I saved this code in the PostProc repository then created the datacard_config.json and the .cfg file for the awr2243boost but I don't know if I'm supposed to have the sensor_restart.cfg and sensor_stop.cfg files or create them ? For now, when I run the code with my parameters I get the following error: 

    Invalid Command (). error[-4048]
    Unrecognized function or variable 'sendCfg'.

    Error in CLI_OneTimeDataCapture_function (line 60)
    sendCfg(COM_PORT_RADAR_CONFIG, strcat(configFile,'.cfg'));

    I don't know where to find the sendCfg function. Can you help please ?

  • Hi Afaf. The sensor restart cfg and sensor stop cfg can be created such that they contain the start and stop command 

    The code for sendCfg.m is given below:

    function success = sendCfg(COM_PORT,filename)
    %Sends Cfg data over UART to the Radar EVM

    success = 0;
    file = fopen(filename, 'r');
    cfg = cell(0,1);
    tline = fgets(file);
    while ischar(tline)
    cfg{end+1,1} = tline;
    tline = fgets(file);
    end

    SCOM = serial(COM_PORT);
    set(SCOM,'BaudRate',115200,'DataBits',8,'stopbits',1);

    set(SCOM,'InputBufferSize',1024000);
    SCOM.BytesAvailableFcnMode='byte';
    SCOM.BytesAvailableFcnCount=1;
    %SCOM.BytesAvailableFcn=@EveBytesAvailableFcn;
    SCOM.OutputBufferSize = 2048;
    SCOM.InputBufferSize = 2048;
    fopen(SCOM); %initialize the serial port

    %Send CLI configuration to XWR1xxx
    %fprintf('Sending configuration to XWR1xxx %s ...\n', filename);
    for index=1:length(cfg)
    cfg2send = cfg{index};
    if strcmp(cfg{index}(1),'%')
    continue;
    end

    fprintf(SCOM,cfg2send);
    fprintf('%s\n', cfg2send);
    for kk = 1:40
    cc = fgetl(SCOM);
    if ~isempty(strfind(cc,'Done'))
    fprintf('%s\n',cc);
    break;
    elseif ~isempty(strfind(cc, 'not recognized as a CLI command'))
    fprintf('%s\n',cc);
    fclose(SCOM);
    delete(SCOM);
    return;
    elseif ~isempty(strfind(cc, 'Error'))
    fprintf('%s\n',cc);
    fclose(SCOM);
    delete(SCOM);
    return;
    else
    fprintf('%s\n',cc);
    end
    end
    end
    fclose(SCOM);
    delete(SCOM);

    end

  • Thank you for your response,

    Can you please provide me with an example of a configuration file for the awr2243boost or is there a way to generate it instead of creating your own? Also, will i need to download an sdk or will i need to have any additional code or config file to run the program ? 

    When i run the code now i have these warnings/errors : 

    Warning: instrfindall will be removed in a future release. There is no simple replacement for this.

    Reset AR Device command : Success

    ans =

    0


    FPGA Configuration command : Success

    ans =

    0


    Configure Record command : Success
    Warning: serial will be removed in a future release. Use serialport instead.
    If you are using serial with icdevice, continue using serial in this MATLAB release.
    sensorStop

    Warning: A timeout occurred before the Terminator was reached.
    'serial' unable to read any data. For more information on possible reasons, see Serial Read Warnings.

    Warning: A timeout occurred before the Terminator was reached.
    'serial' unable to read any data. For more information on possible reasons, see Serial Read Warnings.

    Warning: A timeout occurred before the Terminator was reached.
    'serial' unable to read any data. For more information on possible reasons, see Serial Read Warnings.

    Operation terminated by user during serial/fgetl


    In sendCfg (line 35)
    cc = fgetl(SCOM);

    In CLI_OneTimeDataCapture_function (line 64)
    sendCfg(COM_PORT_RADAR_CONFIG, strcat(configFile,'.cfg'));

    Is this a problem with the config files or the use of serial for connection ? 

  • In the SDK for 2944 there are many example demos and configurations provided. Please note the code I provided you is just an example to show you how it can be done. You can modify it according to your needs.

  • You can read more about programming chirp configuration parameters. Here is one such resource that might help you 

    www.ti.com/.../swra553a.pdf

  • Thanks for the help. 

    I created the configuration file for the awr2243boost but i still can't read data. I get the following warning on matlab : A timeout occurred before the Terminator was reached. 'serial' unable to read any data.

    I'm trying to set the terminator can you please specify its type or how would i know it ?

    I'm really sorry for my questions, but it's my first time working with TI technology and matlab.

    Thank you. 

  • Please make sure you have entered the correct COM port number in your code. It should match the UART port number when you connect your mmwave device. Double check your code and try to isolate the problem, you can use break points and run the code line by line to see what might be causing the problem