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.

MMWAVE-STUDIO: 利用MMWAVE-DSP-EVM与MMWAVE-RF-EVM级联配置单发单收采集

Part Number: MMWAVE-STUDIO

尊敬的Ti工程师你们好,我现在利用MMWAVE-DSP-EVM与MMWAVE-RF-EVM级联配置单发单收进行数据采集,这是我修改的官方的Cascade_Configuration_MIMO脚本:

--[[
Sequence being followed

A. CONFIGURATION
1. Connecting to TDA
1. Configuring Master from SOP till Channel Config
2. Configuring Slave (i) sequentially from SOP till SPI Connect. i = 1, 2, 3
3. Configuring Slaves together from F/W download till Channel Config
4. Configuring all devices together from LDO Bypass till Frame Config

NOTE:
Update the following in the script accordingly before running
1. metaImage F/W path on line 32
2. TDA Host Board IP Address on line 39
--]]
    
----------------------------------------User Constants--------------------------------------------
       
dev_list          =    {1, 2, 4, 8}       -- Device map
RadarDevice       =    {1, 0, 0, 0}       -- {dev1, dev2, dev3, dev4}, 1: Enable, 0: Disable
cascade_mode_list =    {1, 2, 2, 2}       -- 0: Single chip, 1: Master, 2: Slave

-- F/W Download Path

-- Uncomment the next line if you wish to pop-up a dialog box to select the firmware image file
-- Otherwise, hardcode the path to the firmware metaimage below
-- By default, the firmware filename is: xwr22xx_metaImage.bin

-- metaImagePath  =   RSTD.BrowseForFile(RSTD.GetSettingsPath(), "bin", "Browse to .bin file")
-- For 2243 ES1.1 devices
metaImagePath            =   "C:\\ti\\mmwave_dfp_02_02_04_00\\firmware\\xwr22xx_metaImage.bin"
-- For 2243 ES1.0 devices
-- metaImagePath            =   "C:\\ti\\mmwave_dfp_02_02_04_00\\firmware\\xwr22xx_metaImage.bin"

-- IP Address for the TDA2 Host Board
-- Change this accordingly for your setup

TDA_IPAddress     =   "192.168.33.180"

-- Device map of all the devices to be enabled by TDA
-- 1 - master ; 2- slave1 ; 4 - slave2 ; 8 - slave3

deviceMapOverall  =   RadarDevice[1] + (RadarDevice[2]*2) + (RadarDevice[3]*4) + (RadarDevice[4]*8)
deviceMapSlaves   =   (RadarDevice[2]*2) + (RadarDevice[3]*4) + (RadarDevice[4]*8)

-- Enable/Disable Test Source
-- This is useful during bringup

test_source_enable  =   0      -- 0: Disable, 1: Enable
    
------------------------------------------- Sensor Configuration ------------------------------------------------
--[[
The sensor configuration consists of 3 sections:
1) Profile Configuration (common to all 4 AWR devices)
2) Chirp Configuration (unique for each AWR device - mainly because TXs to use are 
                        different for each chirp)
3) Frame Configuration (common to all 4 AWR devices, except for the trigger mode for the master)
Change the values below as needed. --]]

-- Profile configuration
local profile_indx              =   0
local start_freq                =   77     -- GHz
local slope                     =   79     -- MHz/us
local idle_time                 =   5      -- us
local adc_start_time            =   6      -- us
local adc_samples               =   256    -- Number of samples per chirp
local sample_freq               =   8000   -- ksps
local ramp_end_time             =   40     -- us
local rx_gain                   =   48     -- dB
local tx0OutPowerBackoffCode    =   0
local tx1OutPowerBackoffCode    =   0
local tx2OutPowerBackoffCode    =   0
local tx0PhaseShifter           =   0
local tx1PhaseShifter           =   0
local tx2PhaseShifter           =   0
local txStartTimeUSec           =   0
local hpfCornerFreq1            =   0      -- 0: 175KHz, 1: 235KHz, 2: 350KHz, 3: 700KHz
local hpfCornerFreq2            =   0      -- 0: 350KHz, 1: 700KHz, 2: 1.4MHz, 3: 2.8MHz

-- Frame configuration    
local start_chirp_tx            =   0
local end_chirp_tx              =   1
local nchirp_loops              =   64     -- Number of chirps per frame
local nframes_master            =   10     -- Number of Frames for Master
local nframes_slave             =   10     -- Number of Frames for Slaves
local Inter_Frame_Interval      =   100    -- ms
local trigger_delay             =   0      -- us
local trig_list                 =   {1,2,2,2} -- 1: Software trigger, 2: Hardware trigger    


-- Note: The syntax for this API is:
-- ar1.ChirpConfig_mult(RadarDeviceId, chirpStartIdx, chirpEndIdx, profileId, startFreqVar, 
--                      freqSlopeVar, idleTimeVar, adcStartTimeVar, tx0Enable, tx1Enable, tx2Enable)

function Configure_Chirps(i) 
    
    if (i == 1) then
            
            -- Chirp 0
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 1
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 1, 1, 0, 0, 0, 0, 0, 1, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 1 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 1 Configuration failed\n", "red")
                return -4
            end
	end
end
 
------------------------------ API Configuration ------------------------------------------------
    
-- 1. Connection to TDA. 2. Selecting Cascade/Single Chip.  3. Selecting 2-chip/4-chip

WriteToLog("Setting up Studio for Cascade started..\n", "blue")

if(0 == ar1.ConnectTDA(TDA_IPAddress, 5001, deviceMapOverall)) then
    WriteToLog("ConnectTDA Successful\n", "green")
else
    WriteToLog("ConnectTDA Failed\n", "red")
    return -1
end

if(0 == ar1.selectCascadeMode(1)) then
    WriteToLog("selectCascadeMode Successful\n", "green")
else
    WriteToLog("selectCascadeMode Failed\n", "red")
    return -1
end

WriteToLog("Setting up Studio for Cascade ended..\n", "blue")
         
--Master Initialization

-- SOP Mode Configuration
if (0 == ar1.SOPControl_mult(1, 4)) then
    WriteToLog("Master : SOP Reset Successful\n", "green")
else
    WriteToLog("Master : SOP Reset Failed\n", "red")
    return -1
end

-- SPI Connect
if (0 == ar1.PowerOn_mult(1, 0, 1000, 0, 0)) then
    WriteToLog("Master : SPI Connection Successful\n", "green")
else
    WriteToLog("Master : SPI Connection Failed\n", "red")
    return -1
end

-- Firmware Download. (SOP 4 - MetaImage)
if (0 == ar1.DownloadBssFwOvSPI_mult(1, metaImagePath)) then
    WriteToLog("Master : FW Download Successful\n", "green")
else
    WriteToLog("Master : FW Download Failed\n", "red")
    return -1
end

-- RF Power Up
if (0 == ar1.RfEnable_mult(1)) then
    WriteToLog("Master : RF Power Up Successful\n", "green")
else
    WriteToLog("Master : RF Power Up Failed\n", "red")
    return -1
end            
         
-- Channel & ADC Configuration
if (0 == ar1.ChanNAdcConfig_mult(1,1,0,0,1,0,0,0,2,1,0,1)) then
    WriteToLog("Master : Channel & ADC Configuration Successful\n", "green")
else
    WriteToLog("Master : Channel & ADC Configuration Failed\n", "red")
    return -2
end
    
-- Slaves Initialization
   
for i=2,table.getn(RadarDevice) do 
    local status    =    0                
    if ((RadarDevice[1]==1) and (RadarDevice[i]==1)) then
      
        -- SOP Mode Configuration
        if (0 == ar1.SOPControl_mult(dev_list[i], 4)) then
            WriteToLog("Device "..i.." : SOP Reset Successful\n", "green")
        else
            WriteToLog("Device "..i.." : SOP Reset Failed\n", "red")
            return -1
        end
                
        -- SPI Connect    
        if (0 == ar1.AddDevice(dev_list[i])) then
            WriteToLog("Device "..i.." : SPI Connection Successful\n", "green")
        else
            WriteToLog("Device "..i.." : SPI Connection Failed\n", "red")
            return -1
        end
           
    end
end  
   
if (deviceMapSlaves ~= 0) then

	-- Firmware Download. (SOP 4 - MetaImage)
	if (0 == ar1.DownloadBssFwOvSPI_mult(deviceMapSlaves, metaImagePath)) then
		WriteToLog("Slaves : FW Download Successful\n", "green")
	else
		WriteToLog("Slaves : FW Download Failed\n", "red")
		return -1
	end
			 
	-- RF Power Up
	if (0 == ar1.RfEnable_mult(deviceMapSlaves)) then
		WriteToLog("Slaves : RF Power Up Successful\n", "green")
	else
		WriteToLog("Slaves : RF Power Up Failed\n", "red")
		return -1
	end    

	-- Channel & ADC Configuration
	if (0 == ar1.ChanNAdcConfig_mult(deviceMapSlaves,1,1,1,1,1,1,1,2,1,0,2)) then
		WriteToLog("Slaves : Channel & ADC Configuration Successful\n", "green")
	else
		WriteToLog("Slaves : Channel & ADC Configuration Failed\n", "red")
		return -2
	end

end
            
-- All devices together        
          
-- Including this depends on the type of board being used.
-- LDO configuration
if (0 == ar1.RfLdoBypassConfig_mult(deviceMapOverall, 3)) then
    WriteToLog("LDO Bypass Successful\n", "green")
else
    WriteToLog("LDO Bypass failed\n", "red")
    return -2
end

-- Low Power Mode Configuration
if (0 == ar1.LPModConfig_mult(deviceMapOverall,0, 0)) then
    WriteToLog("Low Power Mode Configuration Successful\n", "green")
else
    WriteToLog("Low Power Mode Configuration failed\n", "red")
    return -2
end

-- Miscellaneous Control Configuration
if (0 == ar1.SetMiscConfig_mult(deviceMapOverall, 1, 0, 0, 0)) then
    WriteToLog("Misc Control Configuration Successful\n", "green")
else
    WriteToLog("Misc Control Configuration failed\n", "red")
    return -2
end

-- Edit this API to enable/disable the boot time calibration. Enabled by default.
-- RF Init Calibration Configuration
if (0 == ar1.RfInitCalibConfig_mult(deviceMapOverall, 1, 1, 1, 1, 1, 1, 1, 65537)) then
    WriteToLog("RF Init Calibration Successful\n", "green")
else
    WriteToLog("RF Init Calibration failed\n", "red")
    return -2
end
         
-- RF Init
if (0 == ar1.RfInit_mult(deviceMapOverall)) then
    WriteToLog("RF Init Successful\n", "green")
else
    WriteToLog("RF Init failed\n", "red")
    return -2
end

---------------------------Data Configuration----------------------------------
        
-- Data path Configuration
if (0 == ar1.DataPathConfig_mult(deviceMapOverall, 0, 1, 0)) then
    WriteToLog("Data Path Configuration Successful\n", "green")
else
    WriteToLog("Data Path Configuration failed\n", "red")
    return -3
end

-- Clock Configuration
if (0 == ar1.LvdsClkConfig_mult(deviceMapOverall, 1, 1)) then
    WriteToLog("Clock Configuration Successful\n", "green")
else
    WriteToLog("Clock Configuration failed\n", "red")
    return -3
end

-- CSI2 Configuration
if (0 == ar1.CSI2LaneConfig_mult(deviceMapOverall, 1, 0, 2, 0, 4, 0, 5, 0, 3, 0, 0)) then
    WriteToLog("CSI2 Configuration Successful\n", "green")
else
    WriteToLog("CSI2 Configuration failed\n", "red")
    return -3
end

----------------------------Test Source Configuration------------------------------
-- This is useful for initial bringup.
-- Each device is configured with a test object at a different location.
    
--delete     

---------------------------Sensor Configuration-------------------------

-- Profile Configuration
if (0 == ar1.ProfileConfig_mult(deviceMapOverall, 0, start_freq, idle_time, adc_start_time, ramp_end_time, 
                                0, 0, 0, 0, 0, 0, slope, 0, adc_samples, sample_freq, 0, 0, rx_gain)) then
    WriteToLog("Profile Configuration successful\n", "green")
else
    WriteToLog("Profile Configuration failed\n", "red")
    return -4
end

-- Chirp Configuration 
for i=1,table.getn(RadarDevice) do    
    if ((RadarDevice[1]==1) and (RadarDevice[i]==1)) then
        Configure_Chirps(i)                
    end
end

-- Enabling/ Disabling Test Source
if(test_source_enable == 1) then
    ar1.EnableTestSource_mult(deviceMapOverall, 1)
    WriteToLog("Enabling Test Source Configuration successful\n", "green")
end

-- Frame Configuration
-- Master
if (0 == ar1.FrameConfig_mult(1,start_chirp_tx,end_chirp_tx,nframes_master, nchirp_loops, 
                              Inter_Frame_Interval, 0, 1)) then
    WriteToLog("Master : Frame Configuration successful\n", "green")
else
    WriteToLog("Master : Frame Configuration failed\n", "red")
end
-- Slaves 
if (deviceMapSlaves ~= 0) then
	if (0 == ar1.FrameConfig_mult(deviceMapSlaves,start_chirp_tx,end_chirp_tx,nframes_slave, nchirp_loops, 
								  Inter_Frame_Interval, 0, 2)) then
		WriteToLog("Slaves : Frame Configuration successful\n", "green")
	else
		WriteToLog("Slaves : Frame Configuration failed\n", "red")
	end
end
在这份为了配置单发单收而修改后的脚本里,我做的主要改动是:
RadarDevice       =    {1, 0, 0, 0}       -- {dev1, dev2, dev3, dev4}, 1: Enable, 0: Disable

function Configure_Chirps(i) 
    
    if (i == 1) then
            
            -- Chirp 0
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 1
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 1, 1, 0, 0, 0, 0, 0, 1, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 1 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 1 Configuration failed\n", "red")
                return -4
            end
	end
end

-- Channel & ADC Configuration
if (0 == ar1.ChanNAdcConfig_mult(1,1,0,0,1,0,0,0,2,1,0,1)) then
    WriteToLog("Master : Channel & ADC Configuration Successful\n", "green")
else
    WriteToLog("Master : Channel & ADC Configuration Failed\n", "red")
    return -2
end

if (deviceMapSlaves ~= 0) then

	-- Firmware Download. (SOP 4 - MetaImage)
	if (0 == ar1.DownloadBssFwOvSPI_mult(deviceMapSlaves, metaImagePath)) then
		WriteToLog("Slaves : FW Download Successful\n", "green")
	else
		WriteToLog("Slaves : FW Download Failed\n", "red")
		return -1
	end
			 
	-- RF Power Up
	if (0 == ar1.RfEnable_mult(deviceMapSlaves)) then
		WriteToLog("Slaves : RF Power Up Successful\n", "green")
	else
		WriteToLog("Slaves : RF Power Up Failed\n", "red")
		return -1
	end    

	-- Channel & ADC Configuration
	if (0 == ar1.ChanNAdcConfig_mult(deviceMapSlaves,1,1,1,1,1,1,1,2,1,0,2)) then
		WriteToLog("Slaves : Channel & ADC Configuration Successful\n", "green")
	else
		WriteToLog("Slaves : Channel & ADC Configuration Failed\n", "red")
		return -2
	end

end

----------------------------Test Source Configuration------------------------------
-- This is useful for initial bringup.
-- Each device is configured with a test object at a different location.
    
--delete   

-- Slaves 
if (deviceMapSlaves ~= 0) then
	if (0 == ar1.FrameConfig_mult(deviceMapSlaves,start_chirp_tx,end_chirp_tx,nframes_slave, nchirp_loops, 
								  Inter_Frame_Interval, 0, 2)) then
		WriteToLog("Slaves : Frame Configuration successful\n", "green")
	else
		WriteToLog("Slaves : Frame Configuration failed\n", "red")
	end
end
然后我利用官方提供的capture脚本采集数据,但是mmwavestudio日志信息会报错:[15:31:01] Create Application Response from Capture Card timed out!!
[15:31:01] TDA ARM Failed

我想请问一下是我的配置脚本有地方没有修改正确还是说capture脚本里面也需要作一定的修改呢?

  • 您好,

    已经收到了您的案例,调查需要些时间,感谢您的耐心等待。

  • Hi

    建议不要修改Device使能和Channel 使能的API与参数,

    通过仅修改chirp API  ar1.ChanNAdcConfig_mult 以实现你需要的射频配置。

    Ken

  • 尊敬的工程师您好,我按照您的意见,仅修改了Profile configuration相关参数、chirpAPI以及ar1.ChanNAdcConfig_mult,这几个部分来设置单发单收,修改后的部分如下:

    change1:
    
    
    function Configure_Chirps(i) 
        
        if (i == 1) then
                
                -- Chirp 0
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)) then
                    WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
                else
                    WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                    return -4
                end
    			
        end
    	
    	if (i == 2) then
                
                -- Chirp 0
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) then
                    WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
                else
                    WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                    return -4
                end
    			
        end
    	
    	if (i == 3) then
                
                -- Chirp 0
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) then
                    WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
                else
                    WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                    return -4
                end
    			
        end
    	
    	if (i == 4) then
                
                -- Chirp 0
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) then
                    WriteToLog("Device "..i.." : Chirp 0 Configuration successful\n", "green")
                else
                    WriteToLog("Device "..i.." : Chirp 0 Configuration failed\n", "red")
                    return -4
                end
    			
        end
    end
    
    
    change2:
    -- Channel & ADC Configuration
    if (0 == ar1.ChanNAdcConfig_mult(1,1,0,0,1,0,0,0,2,1,0,1)) then
        WriteToLog("Master : Channel & ADC Configuration Successful\n", "green")
    else
        WriteToLog("Master : Channel & ADC Configuration Failed\n", "red")
        return -2
    end
    
    
    change3:
    -- Channel & ADC Configuration
    if (0 == ar1.ChanNAdcConfig_mult(deviceMapSlaves,0,0,0,0,0,0,0,2,1,0,2)) then
        WriteToLog("Slaves : Channel & ADC Configuration Successful\n", "green")
    else
        WriteToLog("Slaves : Channel & ADC Configuration Failed\n", "red")
        return -2
    end
    然而我发现一个问题,就是在capture的时候总是会报如下错误:[22:23:09] Create Application Response from Capture Card timed out!!         [22:23:09] TDA ARM Failed;后面我尝试把slave的设置更改成:
    -- Channel & ADC Configuration
    if (0 == ar1.ChanNAdcConfig_mult(deviceMapSlaves,0,0,0,1,0,0,0,2,1,0,2)) then
        WriteToLog("Slaves : Channel & ADC Configuration Successful\n", "green")
    else
        WriteToLog("Slaves : Channel & ADC Configuration Failed\n", "red")
        return -2
    end
    之后(即开启一个slave的channel后)可以完成采集流程,但是在mmwavestudio中点击PostProc之后出来是空图: 而此时利用cascade_MIMO_signalProcessing.m可以得到处理后图像,但是跑到一定帧数会报错:
    错误使用 reshape
    元素数不能更改。请使用 [] 作为大小输入之一,以自动计算该维度的适当大小。
    
    出错 read_ADC_bin_TDA2_separateFiles>readBinFile (第 69 行)
    adcData1Complex = reshape(adcData1, numRXPerDevice, numSamplePerChirp, numChirpPerLoop, numLoops);
    
    出错 read_ADC_bin_TDA2_separateFiles (第 44 行)
     [radar_data_Rxchain_master] = readBinFile(fileFullPath_master, frameIdx,numSamplePerChirp,numChirpPerLoop,numLoops, numRXPerDevice, numDevices);
    
    出错 calibrationCascade/datapath (第 89 行)
            [radar_data_Rxchain] = read_ADC_bin_TDA2_separateFiles(fileName,frameIdx,numSamplePerChirp,numChirpPerLoop,numLoops, numRXPerDevice, 1);
    
    出错 cascade_MIMO_signalProcessing (第 133 行)
                adcData = datapath(calibrationObj);        %读取校准后的 ADC 数据
    于是乎我尝试将master和slave均开启channel1和channel2:ar1.ChanNAdcConfig_mult(1,1,0,0,1,1,0,0,2,1,0,1)以及ar1.ChanNAdcConfig_mult(deviceMapSlaves,0,0,0,1,1,0,0,2,1,0,2);此时在mmwavestudio之中点击了PostProc之后,能够看到4个device以及开启的2个channel设置的20帧全部结果图,但是利用cascade_MIMO_signalProcessing.m运行时依然会在第10帧的时候报与之前同样的错误,请问这是为什么?我必须要开启4个device的4个channel才行吗?

    渴望您的回复,谢谢!

  • 仅修改chirp API  ar1.ChanNAdcConfig_mult

    另外想请问一下Channel使能部分不就是ar1.ChanNAdcConfig_mult,不知道您说的不要修改channel使能API与参数与后面说的仅修改chirp API  ar1.ChanNAdcConfig_mult是否是冲突的?

  • Hi 

    抱歉这里的笔误给你带来的困扰

    建议不要修改Device使能和Channel 使能 ar1.ChanNAdcConfig_mult  (这里的channel  是指是否对芯片射频通道上电)

    通过仅修改chirp API  ar1.ChirpConfig_mult以实现你需要的射频配置(这个API中的channel是指使用哪些通道进行发射 )。

    这样修改可以最小化修改的工作量,且可以复用之前的处理代码。

    Ken

  • 好的,我再尝试处理一下,非常感谢