Part Number:IWR1642BOOST
在MATLAB上跑完TI给的例程(RSTD_Interface_Example)之后,mmwavesudio中Output界面已经出现了“Running Man script from MATLAB”。再用MATLAB指令运行mmwave_studio_02_01_01_00\mmWaveStudio\Scripts\Automation.lua.(已将Automation.lua中的串口号改为上位机串口号)mmwave Output界面出现“未将对象引用设置到对象的实例”。
以下为mmwave中output的输出结果和MATLAB代码。第一次在TI论坛交流,有表达不到位的,还望各位前辈指正。
%% RSTD_Interface_Example.m addpath(genpath('.\')) % Initialize mmWaveStudio .NET connection RSTD_DLL_Path = 'C:\ti\mmwave_studio_02_01_01_00\mmWaveStudio\Clients\RtttNetClientController\RtttNetClientAPI.dll'; ErrStatus = Init_RSTD_Connection(RSTD_DLL_Path); if (ErrStatus ~= 30000)disp('Error inside Init_RSTD_Connection');return; end %Example Lua Command strFilename = 'C:\\ti\\mmwave_studio_02_01_01_00\\mmWaveStudio\\Scripts\\Automation_1.lua'; Lua_String = sprintf('dofile("%s")',strFilename); ErrStatus =RtttNetClientAPI.RtttNetClient.SendCommand(Lua_String); %% Init_RSTD_Connection.m function ErrStatus = Init_RSTD_Connection(RSTD_DLL_Path) %This script establishes the connection with mmWaveStudio software % Pre-requisites: % Type RSTD.NetStart() in mmWaveStudio 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 MATLABdisp('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;returnendInit_RSTD_Connection_1 = 1; elseif ~RtttNetClientAPI.RtttNetClient.IsConnected() %Not the first time but port is disconnected % 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 = 1; elseInit_RSTD_Connection_1 = 0; end if Init_RSTD_Connection_1disp('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 mmWaveStudio');disp('Reopen port in mmWaveStudio. 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('mmWaveStudio Connection Failed'); end disp('Test message success'); end
pang guanghui:
直接在mmwave的LuaShell中运行C:\ti\mmwave_studio_02_01_01_00\mmWaveStudio\Scripts\Startup.lua,也会出“未将对象引用设置到对象实例”。
,
Chris Meng:
你好,
你能否下载一下mmwave studio 3.00.00.14?我尝试过下面的代码可以成功运行,你可以参考相关代码。
C:\ti\mmwave_studio_03_00_00_14\mmWaveStudio\MatlabExamples\4chip_cascade_TxBF_example\cascade_TxBF_dataCapture.m
,
pang guanghui:
您这个是针对级联的是吧?您有没有做过,对非级联的板卡呢?
,
Chris Meng:
你好,
我没有尝试过非级联。但是操作流程应该是类似的,可以参考。