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.

IWR1443BOOST: I want to make a consecutive mmwave sensing system using mmWave studio and lua script But, did not work well

Part Number: IWR1443BOOST
Other Parts Discussed in Thread: TEST2

Hi , I'm Kim

As you can see title, I want to I want to make a consecutive mmwave sensing system using mmWave studio and lua script.

When I operate mmwave sensing using mmwave studio only, I can get adc_data.bin(4,096KB)

but when i operate mmwave sensing using custom lua script and matlab, I can get adc_data.bin(4,094KB)

I guess that the difference of 2byte means my lua code is wrong.

If you notice that the part needed to revise in my lua script, please tell me

I attached my lua script file. 

--TestFile
WriteToLog("It is just Test2\n","green")
WriteToLog("It is just Test3\n","green")
WriteToLog("It is just Test3\n","green")
RSTD.Sleep(2000)

-- Full Reset
ar1.FullReset()
RSTD.Sleep(1000)
ar1.SOPControl(2)
RSTD.Sleep(1000)

-- RS232 Connection
ar1.Connect(4,921600,1000)
RSTD.Sleep(1000)


--BSS and MSS firmware download
info = debug.getinfo(1,'S');

file_path = (info.source);

file_path = string.gsub(file_path, "@","");

file_path = string.gsub(file_path, "Test3.lua","");
fw_path = file_path.."..\\..\\rf_eval_firmware"

--Export bit operation file
bitopfile = file_path.."\\".."bitoperations.lua"
dofile(bitopfile)

--Read part ID

res, efuserow9 = ar1.ReadRegister(0xffffe210, 0, 31)
if (bit_and(efuserow9, 3) == 0) then
partId = 1243
elseif (bit_and(efuserow9, 3) == 1) then
partId = 1443
else
partId = 1642
end

--ES version

res, ESVersion = ar1.ReadRegister(0xFFFFE218, 0, 31)
ESVersion = bit_and(ESVersion, 15)

--ADC_Data file and Raw file and PacketReorder utitlity log file path

data_path = file_path.."..\\PostProc"
adc_data_path = data_path.."\\adc_data.bin"
--adc_data_patha = data_path.."\\adc_data2.bin"
Raw_data_path = data_path.."\\adc_data_Raw_0.bin"
pkt_log_path = data_path.."\\pktlogfile.txt"
-- 여러번 센싱할 수 있도록 경로 설정

a = {}
b = {}
c = {}
for i = 1, 5 do
--a [i] = string.format("%s%d%s", "data_path..\"\\adc_data", i, ".bin\"")
a[i]=string.format("%s%d%s", "C:\\ti\\mmwave_studio_01_00_00_00\\mmWaveStudio\\Scripts\\..\\PostProc\\adc_data",i, ".bin")
b[i]=string.format("%s%d%s", "C:\\ti\\mmwave_studio_01_00_00_00\\mmWaveStudio\\Scripts\\..\\PostProc\\adc_data",i,"_Raw_0.bin")
c[i]=string.format("%s%d%s", "C:\\ti\\mmwave_studio_01_00_00_00\\mmWaveStudio\\Scripts\\..\\PostProc\\pktlogfile",i,".txt")
end


-- Download BSS Firmware(AR16xx)

if((partId == 1642) and (ESVersion == 1)) then
BSS_FW = fw_path.."\\radarss\\xwr16xx_radarss_rprc_ES1.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr16xx_masterss_rprc_ES1.0.bin"
elseif((partId == 1642) and (ESVersion == 2)) then
BSS_FW = fw_path.."\\radarss\\xwr16xx_radarss_rprc_ES2.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr16xx_masterss_rprc_ES2.0.bin"
elseif((partId == 1243) and (ESVersion == 2)) then
BSS_FW = fw_path.."\\radarss\\xwr12xx_xwr14xx_radarss_ES2.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr12xx_xwr14xx_masterss_ES2.0.bin"
elseif((partId == 1243) and (ESVersion == 3)) then
BSS_FW = fw_path.."\\radarss\\xwr12xx_xwr14xx_radarss_ES3.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr12xx_xwr14xx_masterss_ES3.0.bin"
elseif((partId == 1443) and (ESVersion == 2)) then
BSS_FW = fw_path.."\\radarss\\xwr12xx_xwr14xx_radarss_ES2.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr12xx_xwr14xx_masterss_ES2.0.bin"
elseif((partId == 1443) and (ESVersion == 3))then
BSS_FW = fw_path.."\\radarss\\xwr12xx_xwr14xx_radarss_ES3.0.bin"
MSS_FW = fw_path.."\\masterss\\xwr12xx_xwr14xx_masterss_ES3.0.bin"
else
WriteToLog("Inavlid Device partId FW\n" ..partId)
WriteToLog("Inavlid Device ESVersion\n" ..ESVersion)
end

-- Download BSS Firmware(AR16xx)

if (ar1.DownloadBSSFw(BSS_FW) == 0) then
WriteToLog("BSS FW Download Success\n", "green")
else
WriteToLog("BSS FW Download failure\n", "red")
end
RSTD.Sleep(2000)

-- Download MSS Firmware
if (ar1.DownloadMSSFw(MSS_FW) == 0) then
WriteToLog("MSS FW Download Success\n", "green")
else
WriteToLog("MSS FW Download failure\n", "red")
end
RSTD.Sleep(2000)

-- SPI Connect
if (ar1.PowerOn(1, 1000, 0, 0) == 0) then
WriteToLog("Power On Success\n", "green")
else
WriteToLog("Power On failure\n", "red")
end
RSTD.Sleep(1000)

-- RF Power UP
if (ar1.RfEnable() == 0) then
WriteToLog("RF Enable Success\n", "green")
else
WriteToLog("RF Enable failure\n", "red")
end
RSTD.Sleep(1000)


--
if (ar1.ChanNAdcConfig(1, 1, 0, 1, 1, 1, 1, 2, 1, 0) == 0) then
WriteToLog("ChanNAdcConfig Success\n", "green")
else
WriteToLog("ChanNAdcConfig failure\n", "red")
end
RSTD.Sleep(1000)

if (partId == 1642) then
if (ar1.LPModConfig(0, 1) == 0) then
WriteToLog("LPModConfig Success\n", "green")
else
WriteToLog("LPModConfig failure\n", "red")
end
else
if (ar1.LPModConfig(0, 0) == 0) then
WriteToLog("Regualar mode Cfg Success\n", "green")
else
WriteToLog("Regualar mode Cfg failure\n", "red")
end
end
RSTD.Sleep(2000)

if (ar1.RfInit() == 0) then
WriteToLog("RfInit Success\n", "green")
else
WriteToLog("RfInit failure\n", "red")
end
RSTD.Sleep(1000)

if (ar1.DataPathConfig(1, 1, 0) == 0) then
WriteToLog("DataPathConfig Success\n", "green")
else
WriteToLog("DataPathConfig failure\n", "red")
end
RSTD.Sleep(1000)

if (ar1.LvdsClkConfig(1, 1) == 0) then
WriteToLog("LvdsClkConfig Success\n", "green")
else
WriteToLog("LvdsClkConfig failure\n", "red")
end
RSTD.Sleep(1000)

if(partId == 1642) then
if (ar1.LVDSLaneConfig(0, 1, 1, 0, 0, 1, 0, 0) == 0) then
WriteToLog("LVDSLaneConfig Success\n", "green")
else
WriteToLog("LVDSLaneConfig failure\n", "red")
end
elseif ((partId == 1243) or (partId == 1443)) then
if (ar1.LVDSLaneConfig(0, 1, 1, 1, 1, 1, 0, 0) == 0) then
WriteToLog("LVDSLaneConfig Success\n", "green")
else
WriteToLog("LVDSLaneConfig failure\n", "red")
end
end
RSTD.Sleep(1000)

if(partId == 1642) then
if(ar1.ProfileConfig(0, 77, 100, 6, 60, 0, 0, 0, 0, 0, 0, 29.982, 0, 256, 5000, 0, 0, 30) == 0) then
WriteToLog("ProfileConfig Success\n", "green")
else
WriteToLog("ProfileConfig failure\n", "red")
end
elseif((partId == 1243) or (partId == 1443)) then
if(ar1.ProfileConfig(0, 77, 100, 6, 60, 0, 0, 0, 0, 0, 0, 29.982, 0, 256, 10000, 0, 0, 30) == 0) then
WriteToLog("ProfileConfig Success\n", "green")
else
WriteToLog("ProfileConfig failure\n", "red")
end
end
RSTD.Sleep(1000)

if (ar1.ChirpConfig(0, 0, 0, 0, 0, 0, 0, 1, 1, 0) == 0) then
WriteToLog("ChirpConfig Success\n", "green")
else
WriteToLog("ChirpConfig failure\n", "red")
end
RSTD.Sleep(1000)

if (ar1.FrameConfig(0, 0, 8, 128, 40, 0, 1) == 0) then
WriteToLog("FrameConfig Success\n", "green")
else
WriteToLog("FrameConfig failure\n", "red")
end
RSTD.Sleep(1000)

-- select Device type
if (ar1.SelectCaptureDevice("DCA1000") == 0) then
WriteToLog("SelectCaptureDevice Success\n", "green")
else
WriteToLog("SelectCaptureDevice failure\n", "red")
end
RSTD.Sleep(1000)

--DATA CAPTURE CARD API
if (ar1.CaptureCardConfig_EthInit("192.168.33.30", "192.168.33.180", "12:34:56:78:90:12", 4096, 4098) == 0) then
WriteToLog("CaptureCardConfig_EthInit Success\n", "green")
else
WriteToLog("CaptureCardConfig_EthInit failure\n", "red")
end
RSTD.Sleep(1000)

--AR12xx or AR14xx-1, AR16xx- 2 (second parameter indicates the device type)
if (partId == 1642) then
if (ar1.CaptureCardConfig_Mode(1, 2, 1, 2, 3, 30) == 0) then
WriteToLog("CaptureCardConfig_Mode Success\n", "green")
else
WriteToLog("CaptureCardConfig_Mode failure\n", "red")
end
elseif ((partId == 1243) or (partId == 1443)) then
if (ar1.CaptureCardConfig_Mode(1, 1, 1, 2, 3, 30) == 0) then
WriteToLog("CaptureCardConfig_Mode Success\n", "green")
else
WriteToLog("CaptureCardConfig_Mode failure\n", "red")
end
end
RSTD.Sleep(1000)


if (ar1.CaptureCardConfig_PacketDelay(50) == 0) then
WriteToLog("CaptureCardConfig_PacketDelay Success\n", "green")
else
WriteToLog("CaptureCardConfig_PacketDelay failure\n", "red")
end
RSTD.Sleep(1000)
-- PacketDelay를 50으로 해줘야 PostProcessing에서 MWMCR::관련 빨간글씨 error가 안나옴

------------------------

--Start Record ADC data
ar1.CaptureCardConfig_StartRecord(adc_data_path, 1)
RSTD.Sleep(1000)

--Trigger frame
ar1.StartFrame()
RSTD.Sleep(2000)

--Packet reorder utility processing the Raw_ADC_data
WriteToLog("Please wait for a few seconds for Packet reorder utility processing .....!!!! \n", "green")
ar1.PacketReorderZeroFill(Raw_data_path, adc_data_path, pkt_log_path)
RSTD.Sleep(10000)
WriteToLog("Packet reorder utility processing done.....!!!! \n", "green")

--Post process the Capture RAW ADC data
--ar1.StartMatlabPostProc(adc_data_path)
--WriteToLog("Please wait for a few seconds for matlab post processing .....!!!! \n", "green")
--RSTD.Sleep(10000)

for i = 1,3 do
--temp_adc_data_path= a[i]
ar1.CaptureCardConfig_StartRecord(a[i], 1)
RSTD.Sleep(1000)

--Trigger frame
ar1.StartFrame()
RSTD.Sleep(2000)

--ar1.CaptureCardConfig_StopRecord()
--Packet reorder utility processing the Raw_ADC_data
WriteToLog("Please wait for a few seconds for Packet reorder utility processing .....!!!! \n", "green")
ar1.PacketReorderZeroFill(b[i], a[i], c[i])
RSTD.Sleep(10000)
--WriteToLog("Packet reorder utility processing done.....!!!! \n", "green")
RSTD.Sleep(4000)
end

  • HI, there:

    Which version of mmwave studio you are using?   If you are using latest one 02.01.01.00, then please get rid of the last several lines. and check the size of adc_data_Raw_0.bin.   

    --ar1.CaptureCardConfig_StopRecord()
    --Packet reorder utility processing the Raw_ADC_data
    WriteToLog("Please wait for a few seconds for Packet reorder utility processing .....!!!! \n", "green")
    ar1.PacketReorderZeroFill(b[i], a[i], c[i])
    RSTD.Sleep(10000)
    --WriteToLog("Packet reorder utility processing done.....!!!! \n", "green")
    RSTD.Sleep(4000)

    And since you have a for loop, maybe you can increase the sleep time after startFrame

    --Trigger frame
    ar1.StartFrame()
    RSTD.Sleep(3000)

    Best,

    Zigang

  • First of all, I'm so sorry to reply of your opinion late.

    I apply your opinion (add delay time after ar1.StartFrame()) and I could get uniform data size.

    Soon, I curious several point in your reply.
    1. you mentioned the version of mmWave studio.
    I heard that almost of manager recommend latest version of mmwave studio(2.1.0.0).
    however, I use the mmwave studio as 1.0.0.0 version.
    At this point, is there a critical error in old version?
    (I think that there is a no difference of sensing result in any version.)

    2. I found that the difference of sensing result in custom code(lua) and mmwave studio(gui).

    Use both sesning method to obtain bin file, and interpret the bin file using the readDCA1000(it is from mmWave studio user guide).

    In amplitude, the result of custom code is double of Gui's one.

    If you know cause about this issue, please tell me.

  • HI, Kim:

    1) You need to check the release notes for each version of mmwave studio and see whether the version of device is supported or not.  The release notes can be found for each mmwave studio version at:  C:\ti\mmwave_studio_xx_xx_xx_xx\docs\mmwave_studio_release_notes.pdf

    2) You need to make sure that the configuration of the mmwave studio and LUA script is programming the device exactly the same way.  

    Best,

    Zigang

  • I understand that there is no difference between GUI and LUA script.

    Thanks to your effort.