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.

AWR2243: The hardware I am using is MMCAS-RF-EVM , how do I configure DDMA mode?

Part Number: AWR2243

I  need to implement DDMA mode data acquisition using AWR2243 cascade board with the following steps:

1, according to the MIMO configuration file to modify the basic parameters of the DDMA configuration file, mainly modified the Configure_Chirps function inside the ChirpConfig_mult, so that the three transmitter antennas of each radar chip at the same time to enable.

The code is as follows:

--[[
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, 1, 1, 1}       -- {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_00_02\\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              =   11
local nchirp_loops              =   32     -- Number of chirps per frame
local nframes_master            =   2     -- Number of Frames for Master
local nframes_slave             =   2     -- 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    

--[[
Function to configure the chirps specific to a device
12 chirps are configured below, individually for each AWR device

|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
|       | Dev 1 | Dev 1 | Dev 1 | Dev 2 | Dev 2 | Dev 2 | Dev 3 | Dev 3 | Dev 3 | Dev 4 | Dev 4 | Dev 4 |
| Chirp |  TX0  |  TX1  |  TX2  |  TX 0 |  TX1  |  TX2  |  TX0  |  TX1  |  TX2  |  TX0  |  TX1  |  TX2  |
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
|     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |
|     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |
|     2 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |
|     3 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |
|     4 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |
|     5 |     0 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |
|     6 |     0 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |
|     7 |     0 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |
|     8 |     0 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |
|     9 |     0 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |
|    10 |     0 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |
|    11 |     1 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
--]] 
-- 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, 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
            
            -- Chirp 1
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 1, 1, 0, 0, 0, 0, 0, 0, 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
            
            -- Chirp 2
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 2, 2, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 2 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 2 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 3
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 3, 3, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 3 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 3 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 4
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 4, 4, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 4 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 4 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 5
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 5, 5, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 5 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 5 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 6
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 6, 6, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 6 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 6 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 7
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 7, 7, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 7 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 7 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 8
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 8, 8, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 8 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 8 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 9
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 9, 9, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 9 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 9 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 10
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 10, 10, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 10 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 10 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 11
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 11, 11, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 11 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 11 Configuration failed\n", "red")
                return -4
            end
        
    elseif (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
            
            -- Chirp 1
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 1, 1, 0, 0, 0, 0, 0, 0, 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
            
            -- Chirp 2
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 2, 2, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 2 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 2 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 3
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 3, 3, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 3 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 3 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 4
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 4, 4, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 4 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 4 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 5
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 5, 5, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 5 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 5 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 6
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 6, 6, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 6 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 6 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 7
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 7, 7, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 7 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 7 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 8
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 8, 8, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 8 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 8 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 9
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 9, 9, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 9 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 9 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 10
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 10, 10, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 10 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 10 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 11
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 11, 11, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 11 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 11 Configuration failed\n", "red")
                return -4
            end
            
    elseif (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
            
            -- Chirp 1
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 1, 1, 0, 0, 0, 0, 0, 0, 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
            
            -- Chirp 2
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 2, 2, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 2 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 2 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 3
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 3, 3, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 3 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 3 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 4
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 4, 4, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 4 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 4 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 5
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 5, 5, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 5 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 5 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 6
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 6, 6, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 6 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 6 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 7
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 7, 7, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 7 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 7 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 8
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 8, 8, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 8 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 8 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 9
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 9, 9, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 9 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 9 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 10
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 10, 10, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 10 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 10 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 11
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 11, 11, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 11 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 11 Configuration failed\n", "red")
                return -4
            end
            
    elseif (i == 4) then
    
            -- Chirp 0
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 1, 1, 1)) 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, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 1 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 1 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 2
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 2, 2, 0, 0, 0, 0, 0, 1, 1, 1)) then
                WriteToLog("Device "..i.." : Chirp 2 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 2 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 3
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 3, 3, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 3 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 3 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 4
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 4, 4, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 4 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 4 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 5
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 5, 5, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 5 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 5 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 6
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 6, 6, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 6 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 6 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 7
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 7, 7, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 7 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 7 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 8
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 8, 8, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 8 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 8 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 9
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 9, 9, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 9 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 9 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 10
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 10, 10, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 10 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 10 Configuration failed\n", "red")
                return -4
            end
            
            -- Chirp 11
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 11, 11, 0, 0, 0, 0, 0, 0, 0, 0)) then
                WriteToLog("Device "..i.." : Chirp 11 Configuration successful\n", "green")
            else
                WriteToLog("Device "..i.." : Chirp 11 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,1,1,1,1,1,1,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  
    
-- 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
            
-- 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.
    
if(test_source_enable == 1) then
    
    if(RadarDevice[1] == 1) then
        -- Object at 5 m with x = 4m and y = 3m
        if (0 == ar1.SetTestSource_mult(1, 4, 3, 0, 0, 0, 0, -327, 0, -327, 327, 327, 327, -2.5, 327, 327, 0, 
                 0, 0, 0, -327, 0, -327, 327, 327, 327, -95, 0, 0, 0.5, 0, 1, 0, 1.5, 0, 0, 0, 0, 0, 0, 0, 0)) then
            WriteToLog("Device 1 : Test Source Configuration Successful\n", "green")
        else
            WriteToLog("Device 1 : Test Source Configuration failed\n", "red")
            return -3
        end
    end
    
    if(RadarDevice[2] == 1) then        
        -- Object at 5 m with x = 3m and y = 4m
        if (0 == ar1.SetTestSource_mult(2, 3, 4, 0, 0, 0, 0, -327, 0, -327, 327, 327, 327, -2.5, 327, 327, 0, 
                 0, 0, 0, -327, 0, -327, 327, 327, 327, -95, 0, 0, 0.5, 0, 1, 0, 1.5, 0, 0, 0, 0, 0, 0, 0, 0)) then
            WriteToLog("Device 2 : Test Source Configuration Successful\n", "green")
        else
            WriteToLog("Device 2 : Test Source Configuration failed\n", "red")
            return -3
        end
    end
    
    if(RadarDevice[3] == 1) then         
        -- Object at 13 m with x = 12m and y = 5m
        if (0 == ar1.SetTestSource_mult(4, 12, 5, 0, 0, 0, 0, -327, 0, -327, 327, 327, 327, -2.5, 327, 327, 0, 
                 0, 0, 0, -327, 0, -327, 327, 327, 327, -95, 0, 0, 0.5, 0, 1, 0, 1.5, 0, 0, 0, 0, 0, 0, 0, 0)) then
            WriteToLog("Device 3 : Test Source Configuration Successful\n", "green")
        else
            WriteToLog("Device 3 : Test Source Configuration failed\n", "red")
            return -3
        end
    end
    
    if(RadarDevice[4] == 1) then        
        -- Object at 13 m with x = 5m and y = 12m
        if (0 == ar1.SetTestSource_mult(8, 5, 12, 0, 0, 0, 0, -327, 0, -327, 327, 327, 327, -2.5, 327, 327, 0, 
                 0, 0, 0, -327, 0, -327, 327, 327, 327, -95, 0, 0, 0.5, 0, 1, 0, 1.5, 0, 0, 0, 0, 0, 0, 0, 0)) then
            WriteToLog("Device 4 : Test Source Configuration Successful\n", "green")
        else
            WriteToLog("Device 4 : Test Source Configuration failed\n", "red")
            return -3
        end
    end
       
end           

---------------------------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 (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

2. Configure the phase shift of each transmitting antenna

First the phase shift value is calculated based on the following matlab code:

PhaseMin      = 5.625;
numTx         = 12;
numChirps     = 256;

numEmptybands = 0;

EmptybandIndex = 1;   


N_all     =  numTx + numEmptybands;
PhaseSetp =  360/N_all;

Idea_Phase = zeros(N_all,numChirps);   
Real_Phase = zeros(N_all,numChirps);    
IndexUse   = zeros(N_all,numChirps);   

for ii = 1:N_all
    PhaseSetp_use = (ii-1)*PhaseSetp;
    for jj = 1:numChirps
       Phasetmp   = rem( (0 + (jj-1)*PhaseSetp_use),360);
       Idea_Phase(ii,jj) = Phasetmp;
       Quatient  = round(Phasetmp/PhaseMin);
       Real_Phase(ii,jj) = Quatient*PhaseMin;
       IndexUse(ii,jj)   = Quatient;
    end
end

The phase shift results are as follows:

IndexUse =

  列 1 至 32

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37
     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21
     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5
     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53
     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27

  列 33 至 64

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16
    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0
    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48
    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32
    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48

  列 65 至 96

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59
    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43
    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27
    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11
    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5

  列 97 至 128

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37
     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21
     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5
     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53
     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27

  列 129 至 160

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16
    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0
    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48
    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32
    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48

  列 161 至 192

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59
    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43
    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27
    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11
    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5

  列 193 至 224

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37
     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21
     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5
     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53
     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27

  列 225 至 256

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16    21    27    32    37    43    48    53    59     0     5    11    16
    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32    43    53     0    11    21    32
     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48     0    16    32    48
    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0    21    43     0
    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16    43     5    32    59    21    48    11    37     0    27    53    16
     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32     0    32
    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48    21    59    32     5    43    16    53    27     0    37    11    48
    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0    43    21     0
     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16     0    48    32    16
    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32    21    11     0    53    43    32
    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48    43    37    32    27    21    16    11     5     0    59    53    48

3. Configure DDMA phase shift in mmwave

The LUA code is:
dev_list          =    {1, 2, 4, 8}       -- Device map

for ii = 0,31 do
    -- chirp 0          0	0	0	0	0	0	0	0	0	0	0	0
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12,ii*12,0,0,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12,ii*12,0,0,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12,ii*12,0,0,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12,ii*12,0,0,0)

    -- chirp 1          0	5	11	16	21	27	32	37	43	48	53	59
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+1,ii*12+1,0,5,11)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+1,ii*12+1,16,21,27)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+1,ii*12+1,32,37,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+1,ii*12+1,48,53,59)

    -- chirp 2          0	11	21	32	43	53	0	11	21	32	43	53
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+2,ii*12+2,0,11,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+2,ii*12+2,32,43,53)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+2,ii*12+2,0,11,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+2,ii*12+2,32,43,53)

    -- chirp 3          0	16	32	48	0	16	32	48	0	16	32	48
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+3,ii*12+3,0,16,32)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+3,ii*12+3,48,0,16)   
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+3,ii*12+3,32,48,0)   
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+3,ii*12+3,16,32,48)

    -- chirp 4          0	21	43	0	21	43	0	21	43	0	21	43
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+4,ii*12+4,0,21,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+4,ii*12+4,0,21,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+4,ii*12+4,0,21,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+4,ii*12+4,0,21,43)

    -- chirp 5          0	27	53	16	43	5	32	59	21	48	11	37
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+5,ii*12+5,0,27,53)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+5,ii*12+5,16,43,5)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+5,ii*12+5,0,27,53)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+5,ii*12+5,16,43,5)

    -- chirp 6          0	32	0	32	0	32	0	32	0	32	0	32
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+6,ii*12+6,0,32,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+6,ii*12+6,0,32,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+6,ii*12+6,0,32,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+6,ii*12+6,0,32,0)

    -- chirp 7          0	37	11	48	21	59	32	5	43	16	53	27
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+7,ii*12+7,0,37,11)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+7,ii*12+7,48,21,59)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+7,ii*12+7,32,5,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+7,ii*12+7,16,53,27)

    -- chirp 8          0	43	21	0	43	21	0	43	21	0	43	21
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+8,ii*12+8,0,43,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+8,ii*12+8,0,43,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+8,ii*12+8,0,43,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+8,ii*12+8,0,43,21)

    -- chirp 9          0	48	32	16	0	48	32	16	0	48	32	16
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+9,ii*12+9,0,48,32)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+9,ii*12+9,16,0,48)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+9,ii*12+9,32,16,0)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+9,ii*12+9,48,32,16)

    -- chirp 10         0	53	43	32	21	11	0	53	43	32	21	11
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+10,ii*12+10,0,53,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+10,ii*12+10,32,21,11)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+10,ii*12+10,0,53,43)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+10,ii*12+10,32,21,11)    

    -- chirp 11         0	59	53	48	43	37	32	27	21	16	11	5
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[4],ii*12+11,ii*12+11,0,59,53)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[3],ii*12+11,ii*12+11,48,43,37)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[2],ii*12+11,ii*12+11,32,27,21)
    ar1.SetPerChirpPhaseShifterConfig_mult(dev_list[1],ii*12+11,ii*12+11,16,11,5)
end
The numloop is set to 32, for a total of 12 transmitter antennas, no emptyband is set, and there are 32 loops.
4. Capture
Capture according to the following lua code
--[[
    A. FRAMING & CAPTURE
    1. Triggering Slave (3, 2, 1) sequentially in a hardware triggered mode.
    2. Triggering Master in a software triggered mode.

    B. TRANSFERRING FILES
    1. The data is stored in file(s) with max cap placed at 2 GB.
    2. The files can be retrieved from the SSD (/mnt/ssd folder) using WinSCP.

Note: Update lines 18 to 49 as needed before using this script.
--

Note: "capture_time"  is a timeout for this script alone to exit - it does not control the 
actual duration of capture. The actual capture duration depends on the configured frame time 
and number of frames.
--]]

capture_time                     =   2000                             -- ms
inter_loop_time                  =   2000                             -- ms
num_loops                        =   1

--[[
Note: Change the following three parameters as desired:
1. n_files_allocation: is the number of files to preallocate on the SSD.
   This improves capture reliability by not having frame drops while switching files.
   The tradeoff is that each file is a fixed 2047 MB even if a smaller number of frames are captured.
   Pre-allocate as many files as needed based on (size_per_frame * number_of_frames) to be captured.
2. data_packaging: select whether to use 16-bit ADC data as is, or drop 4 lsbits and save 4*12-bit numbers in a packed form
   This allows a higher frame rate to be achieved, at the expense of some post-processing to unpack the data later.
   (Matlab should still be able to unpack the data using the '*ubit12' argument to fread instead of 'uint16')
   The default is no-packing, for simplicity
3. capture_directory: is the filename under which captures are stored on the SSD
   and is also the directory to which files will be transferred back to the host
   The captures are copied to the PostProc folder within mmWave Studio

   Note: If this script is called multiple times without changing the directory name, then all 
         captured files will be in the same directory with filename suffixes incremented automatically. 
         It may be hard to know which captured files correspond to which run of the script.
   Note: It is strongly recommended to change this directory name between captures.
--]]

n_files_allocation              =   0
data_packaging                  =   0                       -- 0: 16-bit, 1: 12-bit
capture_directory               =   'DDMAtest'
num_frames_to_capture           =   0                       -- 0: default case; Any positive value - number of frames to capture 

framing_type                    =   1                       -- 0: infinite, 1: finite
stop_frame_mode                 =   0                       -- 0: Frame boundary, 2: Sub-frame boundary, 
                                                            -- 3: Burst boundary, 4: HW/Sub-frame triggered

----------------------------------DATA CAPTURE-------------------------------------------
-- Function to start/stop frame
function Framing_Control(Device_ID, En1_Dis0)
    local status = 0         
        if (En1_Dis0 == 1) then 
            status = ar1.StartFrame_mult(dev_list[Device_ID]) --Start Trigger Frame
            if (status == 0) then
                WriteToLog("Device "..Device_ID.." : Start Frame Successful\n", "green")
            else
                WriteToLog("Device "..Device_ID.." : Start Frame Failed\n", "red")
                return -5
            end
        else
            status = ar1.StopFrame_mult(dev_list[Device_ID], stop_frame_mode) --Stop Trigger Frame
            if (status == 0) then
                WriteToLog("Device "..Device_ID.." : Stop Frame Successful\n", "green")
            else
                WriteToLog("Device "..Device_ID.." : Stop Frame Failed\n", "red")
                return -5
            end
        end
    
    return status
end


while (num_loops > 0)
do

WriteToLog("Loops Remaining : "..num_loops.."\n", "purple")

-- TDA ARM
WriteToLog("Starting TDA ARM...\n", "blue")
status = ar1.TDACaptureCard_StartRecord_mult(1, n_files_allocation, data_packaging, capture_directory, num_frames_to_capture)
if (status == 0) then
    WriteToLog("TDA ARM Successful\n", "green")
else
    WriteToLog("TDA ARM Failed\n", "red")
    return -5
end    

RSTD.Sleep(1000)

-- Triggering the data capture
WriteToLog("Starting Frame Trigger sequence...\n", "blue")

if (RadarDevice[4]==1)then
    Framing_Control(4,1)
end

if (RadarDevice[3]==1)then
    Framing_Control(3,1)
end

if (RadarDevice[2]==1)then
    Framing_Control(2,1)
end

Framing_Control(1,1)

WriteToLog("Capturing AWR device data to the TDA SSD...\n", "blue")
RSTD.Sleep(capture_time)

if (framing_type == 0) then
    
    -- Stop capturing
    WriteToLog("Starting Frame Stop sequence...\n", "blue")
    if (RadarDevice[4]==1)then
        Framing_Control(4,0)
    end

    if (RadarDevice[3]==1)then
        Framing_Control(3,0)
    end

    if (RadarDevice[2]==1)then
        Framing_Control(2,0)
    end
    
    Framing_Control(1,0)
end

WriteToLog("Capture sequence completed...\n", "blue")
    
num_loops = num_loops - 1
RSTD.Sleep(inter_loop_time)

end

-- Enable the below if required
-- WriteToLog("Starting Transfer files using WinSCP..\n", "blue")
-- status = ar1.TransferFilesUsingWinSCP_mult(1)
-- if(status == 0) then
--     WriteToLog("Transferred files! COMPLETE!\n", "green")
-- else
--     WriteToLog("Transferring files FAILED!\n", "red")
--     return -5
-- end

The display is then processed using mmwavestudio's PoetProc, but the RD spectrum in the processed result does not look like the result in DDMA mode.

Can you please ask the engineer to help me to see what are the errors in my configuration process, if I can reproduce the operation based on the complete LUA code I provided, I think it is more likely to solve my problem. Thanks and good luck with the work.

  • Hi Haoming,

    You have shared quite a few scripts here which would take a bit of time to review and verify on our end. 

    To simplify the debug, would it be possible for you to perform the following:

    • Can you capture data with a simplified configuration and check whether your changes on a fundamental level are correct? Reduce number of devices to 1 and maybe just 2 Tx with 2 separate phases. Once this has been completed, can you start increasing the config to match your expected use case?
    • The default Studio post processing does not support DDMA natively. That being said, if just wish to check for different sub bands in the doppler FFT, you could hypothetically do it, but we want to rule out any issues that could come here. Therefore, can you use your own post processing script to read the data and perform 2D FFT?
    • You can use the script from above to validate your changes as debug according to the first bullet.

    Please let me know once you are able to reduce the problem as mentioned allow and if you are still unable to make out what is incorrect. Hopefully, you should be able to resolve the issues on your own with these steps.

    Regards,

    Kaushik