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: Advanced frame configuration in cascade mode showing invalid data between frames in captures

Part Number: AWR2243

Hello,

The following question is related to programming an advanced frame config in cascade mode on the AWR2243 radar devices.

My advanced frame has only 2 subframes (out of a maximum of 4). The first subframe has 12 chirps per loop, 64 loops per burst, 1 burst, and 1 burst loop. The second subframe has 1 chirp per loop, 64 loops per burst, 1 burst and 1 burst loop.

I am running LUA scripts using the shell in mmWave Studio, and calling ar1.AdvanceFrameConfig_mult() to setup the advanced frame. I believe this function programs appropriate values in AWR_ADVANCED_FRAME_CONF_SB (page 95 of Radar Inferface Control Document).

My question --
When I take captures and inspect the ADC data from master/slave .bin files, I get invalid (= +/- 7710) between consecutive frames, as shown below.

Any ideas what could be causing this? Please see the attached code I am using (.lua saved as a .txt because I am unable to upload lua files for some reason).

--[[
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_02_01\\firmware\\xwr22xx_metaImage.bin" 
metaImagePath =					"C:\\Users\\perceptive\\Desktop\\Advanced_Chirping_Debug\\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                     =   20     -- MHz/us
local idle_time                 =   4      -- us
local adc_start_time            =   5      -- us
local adc_samples               =   280	    -- Number of samples per chirp
local sample_freq               =   20000  -- ksps
local ramp_end_time             =   20     -- 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              =   64     	-- Number of chirps per frame
--local nframes_master            =   4    		-- Number of Frames for Master
--local nframes_slave             =   4    		-- 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, 0, 0, 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, 0, 1, 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, 1, 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
			
			-- Chirp 12 (Burst chirp of SF2 is ON)
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 0, 0, 0, 0, 0, 1, 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

    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, 0, 0, 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, 0, 1, 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, 1, 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
			
			-- Chirp 12 (Burst chirp of SF2 is OFF)
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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
			
			

    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, 0, 0, 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, 0, 1, 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, 1, 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
			
			-- Chirp 12 (Burst chirp of SF2 is OFF)
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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

    elseif (i == 4) then

            -- Chirp 0
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 1, 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, 1, 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, 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
			
			-- Chirp 12 (Burst chirp of SF2 is OFF)
            if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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

    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

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

-- Advanced Frame Configuration for MRR
-- TDM subframe duration = 18.432ms
-- Burst subframe duration = 1.536ms
-- inter-burst time >= 50us, inter-subframe time >= 100us,
-- Since we have 1 burst in each subframe, we just use 100us (the min upper bound)
-- for calculating burst and subframe periodicity.

-- SF1 (TDM) periodicity calculation:
-- 18.432ms + 100us = 18532us = 18532000ns,
-- dividing by 5ns (each LSB - refer to RCD/ICD page 98), we get
-- SF1 burst periodicity = SF1 subframe periodicity > 3706400.
-- Rounding up to 3796500 = 18.9825ms

-- Similarly, SF2 (Burst) periodicity calculation:
-- 1.536ms + 100us = 1636us = 1636000ns,
-- dividing by 5ns, we get
-- SF2 burst periodicity = SF2 subframe periodicity > 327200.
-- Rounding up to 400000 = 2ms

local num_frames 					= 10
local num_subframes					= 2
local force_profile 				= 0 				-- ??

local SF1_force_profile_idx 		= 0
local SF1_chirp_start_idx			= 0
local SF1_num_of_chirps				= 12				-- chirps 0-11
local SF1_num_of_loops				= 64
local SF1_burst_periodicity			= 3796500 			-- each LSB = 5ns
local SF1_num_of_burst				= 1
local SF1_num_of_burst_loops		= 1
local SF1_subframe_periodicity		= 3796500 			-- each LSB = 5ns
local SF1_chirp_start_idx_offset	= 0 			


local SF2_force_profile_idx 		= 0
local SF2_chirp_start_idx			= 12
local SF2_num_of_chirps				= 1					-- chirp 12
local SF2_num_of_loops				= 64
local SF2_burst_periodicity			= 400000 			-- each LSB = 5ns
local SF2_num_of_burst				= 1
local SF2_num_of_burst_loops		= 1
local SF2_subframe_periodicity		= 400000 			-- each LSB = 5ns
local SF2_chirp_start_idx_offset	= 0 			

local SF3_force_profile_idx 		= 0
local SF3_chirp_start_idx			= 0
local SF3_num_of_chirps				= 1
local SF3_num_of_loops				= 1
local SF3_burst_periodicity			= 11000 			-- min 55us, each LSB = 5ns
local SF3_num_of_burst				= 1
local SF3_num_of_burst_loops		= 1
local SF3_subframe_periodicity		= 60000 			-- min 300us, each LSB = 5ns
local SF3_chirp_start_idx_offset	= 0 		

local SF4_force_profile_idx 		= 0
local SF4_chirp_start_idx			= 0
local SF4_num_of_chirps				= 1
local SF4_num_of_loops				= 1
local SF4_burst_periodicity			= 11000 			-- each LSB = 5ns
local SF4_num_of_burst				= 1
local SF4_num_of_burst_loops		= 1
local SF4_subframe_periodicity		= 60000 			-- each LSB = 5ns
local SF4_chirp_start_idx_offset	= 0 		

local trigger_select 				= {1, 2, 2, 2} 		-- 1: software trigger, 2: hardware trigger
local frame_trig_delay				= 0 				-- ??
local num_of_clone_subframes 		= 0 				-- ??

local SF1_total_chirps				= 768 				-- 12 chirps/loop * 64 loops/burst * 1 bursts/burstloop * 1 burstloops
local SF1_num_of_adc_samples		= adc_samples
local SF1_num_of_chirps_datapacket	= 1

local SF2_total_chirps				= 64				-- 1 chirp/loop * 64 loops/burst * 1 bursts/burstloop * 1 burstloops
local SF2_num_of_adc_samples		= adc_samples
local SF2_num_of_chirps_datapacket	= 1

local SF3_total_chirps				= 0
local SF3_num_of_adc_samples		= 0
local SF3_num_of_chirps_datapacket	= 0

local SF4_total_chirps				= 0
local SF4_num_of_adc_samples		= 0
local SF4_num_of_chirps_datapacket	= 0

for i=1,table.getn(RadarDevice) do
    if ((RadarDevice[1]==1) and (RadarDevice[i]==1)) then
        res = ar1.AdvanceFrameConfig_mult(dev_list[i], num_subframes, force_profile,
					SF1_force_profile_idx, SF1_chirp_start_idx, SF1_num_of_chirps, SF1_num_of_loops, SF1_burst_periodicity, SF1_chirp_start_idx_offset, SF1_num_of_burst, SF1_num_of_burst_loops, SF1_subframe_periodicity,
					SF2_force_profile_idx, SF2_chirp_start_idx, SF2_num_of_chirps, SF2_num_of_loops, SF2_burst_periodicity, SF2_chirp_start_idx_offset, SF2_num_of_burst, SF2_num_of_burst_loops, SF2_subframe_periodicity,
					SF3_force_profile_idx, SF3_chirp_start_idx, SF3_num_of_chirps, SF3_num_of_loops, SF3_burst_periodicity, SF3_chirp_start_idx_offset, SF3_num_of_burst, SF3_num_of_burst_loops, SF3_subframe_periodicity,
					SF4_force_profile_idx, SF4_chirp_start_idx, SF4_num_of_chirps, SF4_num_of_loops, SF4_burst_periodicity, SF4_chirp_start_idx_offset, SF4_num_of_burst, SF4_num_of_burst_loops, SF4_subframe_periodicity,
					num_frames, trigger_select[i], frame_trig_delay, num_of_clone_subframes, 
					SF1_total_chirps, SF1_num_of_adc_samples, SF1_num_of_chirps_datapacket,
					SF2_total_chirps, SF2_num_of_adc_samples, SF2_num_of_chirps_datapacket,
					SF3_total_chirps, SF3_num_of_adc_samples, SF3_num_of_chirps_datapacket,
					SF4_total_chirps, SF4_num_of_adc_samples, SF4_num_of_chirps_datapacket)
		if (0 == res) then
			WriteToLog("Device "..i.." : Adv Frame cfg successful\n", "green")
		else
			WriteToLog("Device "..i.." : Adv Frame cfg failed\n", "red")
			return -5
		end
    end
end




Best regards,
Karthik

  • Sorry, I attached the wrong LUA script. Here is the correct one:

    --[[
    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_02_01\\firmware\\xwr22xx_metaImage.bin" 
    metaImagePath =					"C:\\Users\\perceptive\\Desktop\\Advanced_Chirping_Debug\\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                     =   20     -- MHz/us
    local idle_time                 =   4      -- us
    local adc_start_time            =   5      -- us
    local adc_samples               =   280	    -- Number of samples per chirp
    local sample_freq               =   20000  -- ksps
    local ramp_end_time             =   20     -- 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              =   64     	-- Number of chirps per frame
    --local nframes_master            =   4    		-- Number of Frames for Master
    --local nframes_slave             =   4    		-- 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, 0, 0, 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, 0, 1, 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, 1, 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
    			
    			-- Chirp 12 (Burst chirp of SF2 is ON)
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 0, 0, 0, 0, 0, 1, 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
    
        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, 0, 0, 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, 0, 1, 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, 1, 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
    			
    			-- Chirp 12 (Burst chirp of SF2 is OFF)
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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
    			
    			
    
        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, 0, 0, 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, 0, 1, 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, 1, 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
    			
    			-- Chirp 12 (Burst chirp of SF2 is OFF)
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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
    
        elseif (i == 4) then
    
                -- Chirp 0
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 1, 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, 1, 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, 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
    			
    			-- Chirp 12 (Burst chirp of SF2 is OFF)
                if (0 == ar1.ChirpConfig_mult(dev_list[i], 12, 12, 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
    
        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
    
    ---------------------------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
    
    -- Advanced Frame Configuration for MRR
    -- TDM subframe duration = 18.432ms
    -- Burst subframe duration = 1.536ms
    -- inter-burst time >= 50us, inter-subframe time >= 100us,
    -- Since we have 1 burst in each subframe, we just use 100us (the min upper bound)
    -- for calculating burst and subframe periodicity.
    
    -- SF1 (TDM) periodicity calculation:
    -- 18.432ms + 100us = 18532us = 18532000ns,
    -- dividing by 5ns (each LSB - refer to RCD/ICD page 98), we get
    -- SF1 burst periodicity = SF1 subframe periodicity > 3706400.
    -- Rounding up to 3796500 = 18.9825ms
    
    -- Similarly, SF2 (Burst) periodicity calculation:
    -- 1.536ms + 100us = 1636us = 1636000ns,
    -- dividing by 5ns, we get
    -- SF2 burst periodicity = SF2 subframe periodicity > 327200.
    -- Rounding up to 400000 = 2ms
    
    local num_frames 					= 10
    local num_subframes					= 2
    local force_profile 				= 0 				
    
    local SF1_force_profile_idx 		= 0
    local SF1_chirp_start_idx			= 0
    local SF1_num_of_chirps				= 12				-- chirps 0-11
    local SF1_num_of_loops				= 64
    local SF1_burst_periodicity			= 3726401 			-- each LSB = 5ns
    local SF1_num_of_burst				= 1
    local SF1_num_of_burst_loops		= 1
    local SF1_subframe_periodicity		= 3826401 			-- each LSB = 5ns
    local SF1_chirp_start_idx_offset	= 0 			
    
    
    local SF2_force_profile_idx 		= 0
    local SF2_chirp_start_idx			= 12
    local SF2_num_of_chirps				= 1					-- chirp 12
    local SF2_num_of_loops				= 64
    local SF2_burst_periodicity			= 347201 			-- each LSB = 5ns
    local SF2_num_of_burst				= 1
    local SF2_num_of_burst_loops		= 1
    local SF2_subframe_periodicity		= 447201 			-- each LSB = 5ns
    local SF2_chirp_start_idx_offset	= 0 			
    
    local SF3_force_profile_idx 		= 0
    local SF3_chirp_start_idx			= 0
    local SF3_num_of_chirps				= 1
    local SF3_num_of_loops				= 1
    local SF3_burst_periodicity			= 11000 			-- min 55us, each LSB = 5ns
    local SF3_num_of_burst				= 1
    local SF3_num_of_burst_loops		= 1
    local SF3_subframe_periodicity		= 60000 			-- min 300us, each LSB = 5ns
    local SF3_chirp_start_idx_offset	= 0 		
    
    local SF4_force_profile_idx 		= 0
    local SF4_chirp_start_idx			= 0
    local SF4_num_of_chirps				= 1
    local SF4_num_of_loops				= 1
    local SF4_burst_periodicity			= 11000 			-- each LSB = 5ns
    local SF4_num_of_burst				= 1
    local SF4_num_of_burst_loops		= 1
    local SF4_subframe_periodicity		= 60000 			-- each LSB = 5ns
    local SF4_chirp_start_idx_offset	= 0 		
    
    local trigger_select_master 		= 1 				-- 1: software trigger, 2: hardware trigger
    local trigger_select_slaves 		= 2					-- 1: software trigger, 2: hardware trigger	
    local frame_trig_delay				= 0 				
    local num_of_clone_subframes 		= 0 				-- ??
    
    local SF1_total_chirps				= 768 				-- 12 chirps/loop * 64 loops/burst * 1 bursts/burstloop * 1 burstloops
    local SF1_num_of_adc_samples		= adc_samples
    local SF1_num_of_chirps_datapacket	= 1
    
    local SF2_total_chirps				= 64				-- 1 chirp/loop * 64 loops/burst * 1 bursts/burstloop * 1 burstloops
    local SF2_num_of_adc_samples		= adc_samples
    local SF2_num_of_chirps_datapacket	= 1
    
    local SF3_total_chirps				= 0
    local SF3_num_of_adc_samples		= 0
    local SF3_num_of_chirps_datapacket	= 0
    
    local SF4_total_chirps				= 0
    local SF4_num_of_adc_samples		= 0
    local SF4_num_of_chirps_datapacket	= 0
    
    
    -- Configure Master
    res = ar1.AdvanceFrameConfig_mult(1, num_subframes, force_profile,
    					SF1_force_profile_idx, SF1_chirp_start_idx, SF1_num_of_chirps, SF1_num_of_loops, SF1_burst_periodicity, SF1_chirp_start_idx_offset, SF1_num_of_burst, SF1_num_of_burst_loops, SF1_subframe_periodicity,
    					SF2_force_profile_idx, SF2_chirp_start_idx, SF2_num_of_chirps, SF2_num_of_loops, SF2_burst_periodicity, SF2_chirp_start_idx_offset, SF2_num_of_burst, SF2_num_of_burst_loops, SF2_subframe_periodicity,
    					SF3_force_profile_idx, SF3_chirp_start_idx, SF3_num_of_chirps, SF3_num_of_loops, SF3_burst_periodicity, SF3_chirp_start_idx_offset, SF3_num_of_burst, SF3_num_of_burst_loops, SF3_subframe_periodicity,
    					SF4_force_profile_idx, SF4_chirp_start_idx, SF4_num_of_chirps, SF4_num_of_loops, SF4_burst_periodicity, SF4_chirp_start_idx_offset, SF4_num_of_burst, SF4_num_of_burst_loops, SF4_subframe_periodicity,
    					num_frames, trigger_select_master, frame_trig_delay, num_of_clone_subframes, 
    					SF1_total_chirps, SF1_num_of_adc_samples, SF1_num_of_chirps_datapacket,
    					SF2_total_chirps, SF2_num_of_adc_samples, SF2_num_of_chirps_datapacket,
    					SF3_total_chirps, SF3_num_of_adc_samples, SF3_num_of_chirps_datapacket,
    					SF4_total_chirps, SF4_num_of_adc_samples, SF4_num_of_chirps_datapacket)
    if (0 == res) then
    	WriteToLog("Adv Frame master cfg successful\n", "green")
    else
    	WriteToLog("Adv Frame master cfg failed\n", "red")
    	return -5
    end
    
    -- Configure Slaves
    res = ar1.AdvanceFrameConfig_mult(deviceMapSlaves, num_subframes, force_profile,
    			SF1_force_profile_idx, SF1_chirp_start_idx, SF1_num_of_chirps, SF1_num_of_loops, SF1_burst_periodicity, SF1_chirp_start_idx_offset, SF1_num_of_burst, SF1_num_of_burst_loops, SF1_subframe_periodicity,
    			SF2_force_profile_idx, SF2_chirp_start_idx, SF2_num_of_chirps, SF2_num_of_loops, SF2_burst_periodicity, SF2_chirp_start_idx_offset, SF2_num_of_burst, SF2_num_of_burst_loops, SF2_subframe_periodicity,
    			SF3_force_profile_idx, SF3_chirp_start_idx, SF3_num_of_chirps, SF3_num_of_loops, SF3_burst_periodicity, SF3_chirp_start_idx_offset, SF3_num_of_burst, SF3_num_of_burst_loops, SF3_subframe_periodicity,
    			SF4_force_profile_idx, SF4_chirp_start_idx, SF4_num_of_chirps, SF4_num_of_loops, SF4_burst_periodicity, SF4_chirp_start_idx_offset, SF4_num_of_burst, SF4_num_of_burst_loops, SF4_subframe_periodicity,
    			num_frames, trigger_select_slaves, frame_trig_delay, num_of_clone_subframes, 
    			SF1_total_chirps, SF1_num_of_adc_samples, SF1_num_of_chirps_datapacket,
    			SF2_total_chirps, SF2_num_of_adc_samples, SF2_num_of_chirps_datapacket,
    			SF3_total_chirps, SF3_num_of_adc_samples, SF3_num_of_chirps_datapacket,
    			SF4_total_chirps, SF4_num_of_adc_samples, SF4_num_of_chirps_datapacket)
    if (0 == res) then
    	WriteToLog("Adv Frame slaves cfg successful\n", "green")
    else
    	WriteToLog("Adv Frame slaves cfg failed\n", "red")
    	return -5
    end
    
    
    

  • Hi Karthik,

    Could you confirm if default LUA script (in the Studio installation) works fine in terms of capture and plot?

    Regards,

    Jitendra

  • Hi Jitendra,

    Yes, the default Cascade_Configuration_MIMO LUA script provided in the Studio installation works fine in terms of capture and plot. Please see the below ADC data -- we don't see any gaps between frames.

    I've modified this default script to transmit advanced frames but I see gaps between frames, so I am not sure if I am missing any steps. For reference, this is the MIMO advanced frame scheme I am trying to achieve:

    There are also a bunch of parameters in ar1.AdvanceFrameConfig_mult that I don't know what they mean. Typing "help ar1.AdvanceFrameConfig_mult" into the LUA shell does not provide much clarity. For example, what are "Clone SubFrames" and "Num Of Chirps in DataPacket" ?

    Your help is greatly appreciated! Thank you.

    Best,

    Karthik

  • Hi Karthik,

    Would it be possible to process your ADC data partially (whatever is valid) and see if one particular subframe is causing the issue? You can also check your data sizes per subframe and compare it with what is supposed to be. If a particular sequence of chirps is found to be problematic, you can try to debug the same by varying small parameters in that particular subframe and seeing what could've caused this. This will also validate your steps.

    Regards,

    Kaushik