Other Parts Discussed in Thread: AWR1243
Hi Piyali/Stanley,
I am re-opening this issue which I worked with both of you 4 months ago regarding frame rate seen at Ethernet output. Back then, we got to a point where I am happy with what I've seen and closed the case. I used to have a single profile at that time and am able to get the frame rate very much followed that of the frameperiodicity specified in the rlFrameCfg_t data structure. Today, we now have 4 profiles and allow dynamically switch between them from network control on a Host. Attached is our AWR config c file that defines the 4 chirp configurations.
As you can see, I have 4 rlFrameCfg_t objects for the 4 corresponding profiles. FramePeriodicity is selected for each rlFrameCfg_t object after I thought I completely understood how much time it takes to acquire + processing + Ethernet download time based on experiments. The 4RX RDM size of 128x256 + PkDetect data would require FramePeriodicity = 14ms while 4 128x128 RDMs + PkDetect data would take 12ms. Please see attached Timing Diagram.
However, when running doing performance measurement from a Linux Host PC using the network monitoring tool, I observed that only profile 0 yields the accurate frame rate per the defined FramePerdiocity of 14ms or 71 fr/s. Profile 1-2, I got Ethernet frame rate 43 fr/s, Profile 3, I got 36 fr/s. I expect the Profile 1-2 to do even better at 83 fr/s and Profile 3 should be the same as Profile 0.
I then twiddle with the rampEndTime parameter in rlProfileCfg_t by setting rampEndTime in all Profiles to have the same value as Profile 0 (30.87). To my surprise, all Profile's frame rates are now running based on the defined FramePerdiocity for each profile. What does FramePerdiocity have to do with rampEndTime ? Why does rampEndTime also dictate the output frame rate?
Thanks,
/****************************************************************************** Copyright (c) [2012 - 2018] Texas Instruments Incorporated All rights reserved not granted herein. Limited License. Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive license under copyrights and patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software subject to the terms herein. With respect to the foregoing patent license, such license is granted solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software, other than combinations with devices manufactured by or for TI ("TI Devices"). No hardware patent is licensed hereunder. Redistributions must preserve existing copyright notices and reproduce this license (including the above copyright notice and the disclaimer and (if applicable) source code license limitations below) in the documentation and/or other materials provided with the distribution Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met: * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any software provided in binary form. * Any redistribution and use are licensed by TI for use only with TI Devices. * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code. If software source code is provided to you, modification and redistribution of the source code are permitted provided that the following conditions are met: * Any redistribution and use of the source code, including any resulting derivative works, are licensed by TI for use only with TI Devices. * Any redistribution and use of any object code compiled from the source code and any resulting derivative works, are licensed by TI for use only with TI Devices. Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission. DISCLAIMER. THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ /* Armin Volkel, 11/06/2018 * Config file for LRR application * similar chirp sequence as Infineon board to enable the following radar parameters: * Rmax = 330 m * deltaR = 1.3 m * vmax = 30 m/s * deltaV = 0.5 m/s * * high level chirp parameters (board independent): * Nr = 512 * B = 162 MHz * Tchirp = 28.48 us * fsamp = 25 MHz * NC = 128 * Trepeat = 32.85 us * * TI chirp parameters: * AR1243_PROFILE1_RADAR_WIDTH = 512 [Nr] * AR1243_RADAR_HEIGHT = 128 [NC] * CHAINS_AR1243_NUM_SUBFRAMES = 1 [ 1 chirp in sequence ] * struct rlFrameCfg_t * numAdcSamples = AR1243_PROFILE1_RADAR_WIDTH * 1 [ need to work with real only data ] * struct rlProfileCfg_t * startFreqConst = 77 GHz * idleTimeConst = 2 us * adcStartTimeConst = 2.37 us * rampEndTime = 30.85 us * freqSlopeConst = 5.688 MHz/us [ B / Tchirp ] * digOutSampleRate = 25000 kilo samples / s * Bsp_Ar12xxConfigObj.adcOutCfgArgs * b2AdcOutFmt = RL_ADC_FORMAT_REAL * Bsp_Ar12xxConfigObj.dataFmtCfgArgs * adcFmt = RL_ADC_FORMAT_REAL * Bsp_Ar12xxConfigObj.dataFmtCfgArgs * burstPeriodicity = 66 ms [same time as chirp repeat time since we have only one burst] * */ /******************************************************************************* * INCLUDE FILES ******************************************************************************* */ #include <include/common/chains_radar.h> #include <ti/drv/vps/examples/utility/bsputils_ub960.h> /* ========================================================================== */ /* Macros & Typedefs */ /* ========================================================================== */ #define CHAINS_RADAR_NUM_RX_ANTENNA (4U) #define CHAINS_RADAR_NUM_TX_ANTENNA (1U) /** \brief Number of antennas Rx times tx*/ #define CHAINS_RADAR_NUM_ANTENNA (CHAINS_RADAR_NUM_RX_ANTENNA * \ CHAINS_RADAR_NUM_TX_ANTENNA) /** \brief Radar Sensor Height */ #define AR1243_RADAR_HEIGHT_128 (128U) #define AR1243_RADAR_HEIGHT_64 (64U) /** \brief Radar Sensor width */ #define AR1243_RADAR_WIDTH_256 (256U) #define AR1243_RADAR_WIDTH_128 (128U) // Khai: NOt being used /** \brief Name of the configuration used */ #define CHAINS_AR1243_CONFIG_NAME "CHAINS_CAPT_FFT_DISP" /** \brief CSI Data Rate for data transfer from AR12xx * Valid Values are * 150 (for 150 Mbps) * 300 (for 300 Mbps) * 400 (for 400 Mbps) * 450 (for 450 Mbps) * 600 (for 600 Mbps) */ #define CHAINS_AR1243_CSI_DATA_RATE (300U) #define CHAINS_UB960_CSI_DATA_RATE (800U) #if (CHAINS_AR1243_CSI_DATA_RATE == (150U)) /** \brief CSI Data rate value set in the AR12 parameters */ #define CHAINS_AR1243_CSI_DATA_RATE_VALUE (6) /* 150 Mbps */ /** \brief CSI High speed clock set in the AR12 parameters */ #define CHAINS_AR1243_DDR_HSI_CLK (0xB) /* 150 Mbps */ /** \brief ISS CSI clock paramter set */ #define CHAINS_AR1243_ISS_CSI_CLK (75U) /* 150 Mbps */ #elif (CHAINS_AR1243_CSI_DATA_RATE == (300U)) /** \brief CSI Data rate value set in the AR12 parameters */ #define CHAINS_AR1243_CSI_DATA_RATE_VALUE (4) /* 300 Mbps */ /** \brief CSI High speed clock set in the AR12 parameters */ #define CHAINS_AR1243_DDR_HSI_CLK (0xA) /* 300 Mbps */ /** \brief ISS CSI clock paramter set */ #define CHAINS_AR1243_ISS_CSI_CLK (150U) /* 300 Mbps */ #elif (CHAINS_AR1243_CSI_DATA_RATE == (400U)) /** \brief CSI Data rate value set in the AR12 parameters */ #define CHAINS_AR1243_CSI_DATA_RATE_VALUE (3) /* 400 Mbps */ /** \brief CSI High speed clock set in the AR12 parameters */ #define CHAINS_AR1243_DDR_HSI_CLK (0x1) /* 400 Mbps */ /** \brief ISS CSI clock paramter set */ #define CHAINS_AR1243_ISS_CSI_CLK (200U) /* 400 Mbps */ #elif (CHAINS_AR1243_CSI_DATA_RATE == (450U)) /** \brief CSI Data rate value set in the AR12 parameters */ #define CHAINS_AR1243_CSI_DATA_RATE_VALUE (2) /* 450 Mbps */ /** \brief CSI High speed clock set in the AR12 parameters */ #define CHAINS_AR1243_DDR_HSI_CLK (0x5) /* 450 Mbps */ /** \brief ISS CSI clock paramter set */ #define CHAINS_AR1243_ISS_CSI_CLK (225U) /* 450 Mbps */ #elif (CHAINS_AR1243_CSI_DATA_RATE == (600U)) /** \brief CSI Data rate value set in the AR12 parameters */ #define CHAINS_AR1243_CSI_DATA_RATE_VALUE (1) /* 600 Mbps */ /** \brief CSI High speed clock set in the AR12 parameters */ #define CHAINS_AR1243_DDR_HSI_CLK (0x9) /* 600 Mbps */ /** \brief ISS CSI clock paramter set */ #define CHAINS_AR1243_ISS_CSI_CLK (300U) /* 600 Mbps */ #else #warn "CHAINS_AR1243: No valid data rate specified!!" #endif /** \brief ADC Data Format for AR12 * Valid Values are * 12 (for 12 bit ADC) * 14 (for 14 bit ADC) * 16 (for 16 bit ADC) */ #define CHAINS_AR1243_ADC_DATA_FORMAT (16U) #if (CHAINS_AR1243_ADC_DATA_FORMAT == (12U)) /** \brief AR12 data format value set in the configuration */ #define CHAINS_AR1243_DATA_FORMAT_CONFIG (RL_ADC_DATA_12_BIT) /* 12 bit */ #elif (CHAINS_AR1243_ADC_DATA_FORMAT == (14U)) /** \brief AR12 data format value set in the configuration */ #define CHAINS_AR1243_DATA_FORMAT_CONFIG (RL_ADC_DATA_14_BIT) /* 14 bit */ #elif (CHAINS_AR1243_ADC_DATA_FORMAT == (16U)) /** \brief AR12 data format value set in the configuration */ #define CHAINS_AR1243_DATA_FORMAT_CONFIG (RL_ADC_DATA_16_BIT) /* 16 bit */ #else #warn "CHAINS_AR1243: No valid ADC data format specified!!" #endif /** \brief Advanced Frame Configurations */ #define CHAINS_AR1243_NUM_SUBFRAMES (1U) #define CHAINS_AR1243_NUM_BURSTS (1U) #define CHAINS_AR1243_NUM_BURST_LOOPS (1U) /* ========================================================================== */ /* Globals */ /* ========================================================================== */ static char gChains_numRadarsMenu[] = { "\r\n " "\r\n =======================" "\r\n Select Number of Radars" "\r\n =======================" "\r\n " "\r\n Enter Number of Radars are connected: (1-4)" "\r\n " }; /* When Advanced frame configuration is set this is ignored */ /* Armin: p. 386 in AWR1xx_Radar_Interface_Control.pdf */ rlFrameCfg_t gAr1243FrmArgs_RadarMode1 = { .chirpStartIdx = (rlUInt16_t) 0, .chirpEndIdx = (rlUInt16_t) CHAINS_RADAR_NUM_TX_ANTENNA - (rlUInt16_t)1, // 1 .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT_128, // 128 .numFrames = (rlUInt16_t) 0, .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_256 * (rlUInt16_t)2, // 256 * 2 .framePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(14), // 14 - 4RDM@77 fr/s, 7 - 2RDM@142 fr/s .framePeriod = (rlUInt32_t) 14, // POC: use in AlgorithmFxn_RadarFftDynamicTxPowerBackOff() .triggerSelect = (rlUInt16_t) RL_FRAMESTRT_API_TRIGGER, .reserved = (rlUInt32_t) 0, .frameTriggerDelay = (rlUInt32_t) 0 }; rlFrameCfg_t gAr1243FrmArgs_RadarMode2 = { .chirpStartIdx = (rlUInt16_t) 0, .chirpEndIdx = (rlUInt16_t) CHAINS_RADAR_NUM_TX_ANTENNA - (rlUInt16_t)1, // 1 .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT_128, // 128 .numFrames = (rlUInt16_t) 0, .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_128 * (rlUInt16_t)2, // 128 * 2 .framePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(12), // 12 - 4RDM@83 fr/s, 9 - 2RDM@111 fr/s .framePeriod = (rlUInt32_t) 12, // POC: use in AlgorithmFxn_RadarFftDynamicTxPowerBackOff() .triggerSelect = (rlUInt16_t) RL_FRAMESTRT_API_TRIGGER, .reserved = (rlUInt32_t) 0, .frameTriggerDelay = (rlUInt32_t) 0 }; rlFrameCfg_t gAr1243FrmArgs_RadarMode4 = { .chirpStartIdx = (rlUInt16_t) 0, .chirpEndIdx = (rlUInt16_t) CHAINS_RADAR_NUM_TX_ANTENNA - (rlUInt16_t)1, // 1 .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT_128, // 128 .numFrames = (rlUInt16_t) 0, .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_128 * (rlUInt16_t)2, // 128 * 2 .framePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(12), // 12 - 4RDM@83 fr/s, 9 - 2RDM@111 fr/s .framePeriod = (rlUInt32_t) 12, // POC: use in AlgorithmFxn_RadarFftDynamicTxPowerBackOff() .triggerSelect = (rlUInt16_t) RL_FRAMESTRT_API_TRIGGER, .reserved = (rlUInt32_t) 0, .frameTriggerDelay = (rlUInt32_t) 0 }; rlFrameCfg_t gAr1243FrmArgs_RadarMode5 = { .chirpStartIdx = (rlUInt16_t) 0, .chirpEndIdx = (rlUInt16_t) CHAINS_RADAR_NUM_TX_ANTENNA - (rlUInt16_t)1, // 1 .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT_128, // 128 .numFrames = (rlUInt16_t) 0, .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_256 * (rlUInt16_t)2, // 256 * 2 .framePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(14), // 14 - 4RDM@77 fr/s, 7 - 2RDM@142 fr/s .framePeriod = (rlUInt32_t) 14, // POC: use in AlgorithmFxn_RadarFftDynamicTxPowerBackOff() .triggerSelect = (rlUInt16_t) RL_FRAMESTRT_API_TRIGGER, .reserved = (rlUInt32_t) 0, .frameTriggerDelay = (rlUInt32_t) 0 }; /* Armin: p. 383 in AWR1xx_Radar_Interface_Control.pdf */ static rlProfileCfg_t gAr1243ProfileArgs_RadarMode1[] = { // POC: radar mode 1 - Vmax = 37, Vres = .58, Rmax = 330, Rres = 1.29 { .profileId = (rlUInt16_t) 0, .pfVcoSelect = (rlUInt8_t) 0, .pfCalLutUpdate = (rlUInt8_t) 0, .frequency = 765, .startFreqConst = (rlUInt32_t) CHAINS_AR1243_FREQ_GHZ_CONV(76.5), .idleTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(2), .adcStartTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(6), .rampEndTime = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(30.87), .txOutPowerBackoffCode = (rlUInt32_t) 0, .txPhaseShifter = (rlUInt32_t) 0, .freqSlopeConst = (rlInt16_t) CHAINS_AR1243_FREQ_MHZ_PER_MICRO_S_SLOPE_CONV(8.52), .txStartTime = (rlInt16_t) CHAINS_AR1243_TIME_US_TO_10NS(1U), .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_256, .digOutSampleRate = (rlUInt16_t) 18750, // Kilo Samples per second .hpfCornerFreq1 = (rlUInt8_t) RL_RX_HPF1_175_KHz, // Khai: change this to eliminate the range wrap around .hpfCornerFreq2 = (rlUInt8_t) RL_RX_HPF2_350_KHz, // Khai: change this to eliminate the range wrap around .rxGain = (rlUInt16_t) 38 // Khai: This is same as 9dB VGA gain }, // POC: radar mode 2 - Vmax = 60, Vres = .94, Rmax = 330, Rres = 2.58 { .profileId = (rlUInt16_t) 1, .pfVcoSelect = (rlUInt8_t) 0, .pfCalLutUpdate = (rlUInt8_t) 0, // POC: center frequency for beam steer initialization .frequency = 770, .startFreqConst = (rlUInt32_t) CHAINS_AR1243_FREQ_GHZ_CONV(77), .idleTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(2), .adcStartTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(4), .rampEndTime = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(14.22), .txOutPowerBackoffCode = (rlUInt32_t) 0, .txPhaseShifter = (rlUInt32_t) 0, .freqSlopeConst = (rlInt16_t) CHAINS_AR1243_FREQ_MHZ_PER_MICRO_S_SLOPE_CONV(8.52), .txStartTime = (rlInt16_t) CHAINS_AR1243_TIME_US_TO_10NS(1U), .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_128, .digOutSampleRate = (rlUInt16_t) 18750, // Kilo Samples per second .hpfCornerFreq1 = (rlUInt8_t) RL_RX_HPF1_175_KHz, // Khai: change this to eliminate the range wrap around .hpfCornerFreq2 = (rlUInt8_t) RL_RX_HPF2_350_KHz, // Khai: change this to eliminate the range wrap around .rxGain = (rlUInt16_t) 38, // Khai: This is same as 9dB VGA gain }, // POC: radar mode 4 - Vmax = 60, Vres = .94, Rmax = 250, Rres = 1.95 { .profileId = (rlUInt16_t) 2, .pfVcoSelect = (rlUInt8_t) 0, .pfCalLutUpdate = (rlUInt8_t) 0, .frequency = 765, .startFreqConst = (rlUInt32_t) CHAINS_AR1243_FREQ_GHZ_CONV(77), .idleTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(2), .adcStartTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(4), .rampEndTime = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(14.22), .txOutPowerBackoffCode = (rlUInt32_t) 0, .txPhaseShifter = (rlUInt32_t) 0, .freqSlopeConst = (rlInt16_t) CHAINS_AR1243_FREQ_MHZ_PER_MICRO_S_SLOPE_CONV(11.27), .txStartTime = (rlInt16_t) CHAINS_AR1243_TIME_US_TO_10NS(1U), .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_128, .digOutSampleRate = (rlUInt16_t) 18750, // Kilo Samples per second .hpfCornerFreq1 = (rlUInt8_t) RL_RX_HPF1_175_KHz, // Khai: change this to eliminate the range wrap around .hpfCornerFreq2 = (rlUInt8_t) RL_RX_HPF2_350_KHz, // Khai: change this to eliminate the range wrap around .rxGain = (rlUInt16_t) 38 // Khai: This is same as 9dB VGA gain }, // POC: radar mode 5 - Vmax = 37 m/s, Vres = .6 m/s, Rmax = 100, Rres = .8 m { .profileId = (rlUInt16_t) 3, .pfVcoSelect = (rlUInt8_t) 0, .pfCalLutUpdate = (rlUInt8_t) 0, .frequency = 765, .startFreqConst = (rlUInt32_t) CHAINS_AR1243_FREQ_GHZ_CONV(77), .idleTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(2), .adcStartTimeConst = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(4), .rampEndTime = (rlUInt32_t) CHAINS_AR1243_TIME_US_TO_10NS(24.22), .txOutPowerBackoffCode = (rlUInt32_t) 0, .txPhaseShifter = (rlUInt32_t) 0, .freqSlopeConst = (rlInt16_t) CHAINS_AR1243_FREQ_MHZ_PER_MICRO_S_SLOPE_CONV(28.16), .txStartTime = (rlInt16_t) CHAINS_AR1243_TIME_US_TO_10NS(1U), .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_256, .digOutSampleRate = (rlUInt16_t) 18750, // Kilo Samples per second .hpfCornerFreq1 = (rlUInt8_t) RL_RX_HPF1_175_KHz, // Khai: change this to eliminate the range wrap around .hpfCornerFreq2 = (rlUInt8_t) RL_RX_HPF2_350_KHz, // Khai: change this to eliminate the range wrap around .rxGain = (rlUInt16_t) 38 // Khai: This is same as 9dB VGA gain } }; static rlChirpCfg_t gAr1243ChirpCfgArgs_RadarMode1[] = { { .chirpStartIdx = (rlUInt16_t) 0x0, .chirpEndIdx = (rlUInt16_t) 0x0, .profileId = (rlUInt16_t) 0x0, /* Mode 1 profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x1, /* TX1 */ .reserved = (rlUInt16_t) 0x0 }, #if (CHAINS_RADAR_NUM_TX_ANTENNA > 1) { .chirpStartIdx = (rlUInt16_t) 0x1, .chirpEndIdx = (rlUInt16_t) 0x1, .profileId = (rlUInt16_t) 0x0, /* First profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x2, /* TX2 */ .reserved = (rlUInt16_t) 0x0 }, #endif #if (CHAINS_RADAR_NUM_TX_ANTENNA > 2) { .chirpStartIdx = (rlUInt16_t) 0x2, .chirpEndIdx = (rlUInt16_t) 0x2, .profileId = (rlUInt16_t) 0x0, /* First profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x4, /* TX2 */ .reserved = (rlUInt16_t) 0x0 }, #endif }; static rlChirpCfg_t gAr1243ChirpCfgArgs_RadarMode2[] = { { .chirpStartIdx = (rlUInt16_t) 0x0, .chirpEndIdx = (rlUInt16_t) 0x0, .profileId = (rlUInt16_t) 0x1, /* Mode 2 profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x1, /* TX1 */ .reserved = (rlUInt16_t) 0x0 } }; static rlChirpCfg_t gAr1243ChirpCfgArgs_RadarMode4[] = { { .chirpStartIdx = (rlUInt16_t) 0x0, .chirpEndIdx = (rlUInt16_t) 0x0, .profileId = (rlUInt16_t) 0x2, /* Mode 4 profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x1, /* TX1 */ .reserved = (rlUInt16_t) 0x0 } }; static rlChirpCfg_t gAr1243ChirpCfgArgs_RadarMode5[] = { { .chirpStartIdx = (rlUInt16_t) 0x0, .chirpEndIdx = (rlUInt16_t) 0x0, .profileId = (rlUInt16_t) 0x3, /* Mode 5 profile */ .startFreqVar = (rlUInt32_t) 0x0, .freqSlopeVar = (rlInt16_t) 0x0, .idleTimeVar = (rlUInt16_t) 0x0, .adcStartTimeVar = (rlUInt16_t) 0x0, .txEnable = (rlUInt16_t) 0x1, /* TX1 */ .reserved = (rlUInt16_t) 0x0 } }; static rlBpmChirpCfg_t gAr1243BpmChirpCfgArgs[] = { { .chirpStartIdx = (rlUInt16_t) 0x0, .chirpEndIdx = (rlUInt16_t) 0x0, .constBpmVal = (rlUInt16_t) 0x0, .reserved = (rlUInt16_t) 0x0 }, #if (CHAINS_RADAR_NUM_TX_ANTENNA > 1) { .chirpStartIdx = (rlUInt16_t) 0x1, .chirpEndIdx = (rlUInt16_t) 0x1, .constBpmVal = (rlUInt16_t) 0x0, .reserved = (rlUInt16_t) 0x0 }, #endif #if (CHAINS_RADAR_NUM_TX_ANTENNA > 2) { .chirpStartIdx = (rlUInt16_t) 0x2, .chirpEndIdx = (rlUInt16_t) 0x2, .constBpmVal = (rlUInt16_t) 0x0, .reserved = (rlUInt16_t) 0x0 } #endif }; #define CHAINS_AR1243_CHIRPROW_SIZE (sizeof(gAr1243ChirpCfgArgs_RadarMode1)/sizeof(rlChirpCfg_t)) * \ (sizeof(gAr1243ProfileArgs_RadarMode1)/sizeof(rlProfileCfg_t)) * 16U rlChirpRow_t gAr1243ChirpRowArgs[CHAINS_MAX_NUM_RADARS][CHAINS_AR1243_CHIRPROW_SIZE] = {0}; /**< \brief Sensor configuration for the AR1243 Radar Sensor */ Bsp_Ar12xxConfigObj gAr12xx_config_RadarMode1 = { .rfChanCfgArgs = { .rxChannelEn = (rlUInt16_t) (1<<CHAINS_RADAR_NUM_RX_ANTENNA) -1, .txChannelEn = (rlUInt16_t) (1<<CHAINS_RADAR_NUM_TX_ANTENNA) - 1, .cascading = (rlUInt16_t) 0x0, .bReserved = (rlUInt16_t) 0x0 }, .adcOutCfgArgs = { .fmt = { .b2AdcBits = CHAINS_AR1243_DATA_FORMAT_CONFIG, .b6Reserved1 = (rlUInt32_t) 0x0, .b8FullScaleReducFctr = (rlUInt32_t) 0x0, .b2AdcOutFmt = RL_ADC_FORMAT_COMPLEX_1X, .b14Reserved2 = (rlUInt32_t) 0x0 }, .reserved = (rlUInt16_t) 0x0 }, .dataFmtCfgArgs = { .rxChannelEn = (rlUInt16_t) (1<<CHAINS_RADAR_NUM_RX_ANTENNA) - 1, .adcBits = (rlUInt16_t) CHAINS_AR1243_DATA_FORMAT_CONFIG, .adcFmt = (rlUInt16_t) RL_ADC_FORMAT_COMPLEX_1X, .iqSwapSel = (rlUInt8_t) RL_DEV_I_FIRST, .chInterleave = (rlUInt8_t) RL_DEV_CH_NON_INTERLEAVED, .reserved = (rlUInt32_t) 0x0 }, .rfLpModeCfgArgs = { .reserved0 = (rlUInt16_t) 0, .lpAdcMode = (rlUInt16_t) RL_ADC_MODE_REGULAR }, .chirpCfgArgs = gAr1243ChirpCfgArgs_RadarMode1, .numChirpCfgArgs = sizeof(gAr1243ChirpCfgArgs_RadarMode1)/sizeof(rlChirpCfg_t), .profileCfgArgs = gAr1243ProfileArgs_RadarMode1, .numProfileCfgArgs = sizeof(gAr1243ProfileArgs_RadarMode1)/sizeof(rlProfileCfg_t), .frameCfgArgs = &gAr1243FrmArgs_RadarMode1, .numFrameCfgArgs = sizeof(gAr1243FrmArgs_RadarMode1)/sizeof(rlFrameCfg_t), .dataPathCfgArgs = { .intfSel = (rlUInt8_t) 0, .transferFmtPkt0 = (rlUInt8_t) 6, /**< Data out Format, \n b5:0 Packet 0 content selection\n 000001 - ADC_DATA_ONLY \n 000110 - CP_ADC_DATA \n 001001 - ADC_CP_DATA \n 110110 - CP_ADC_CQ_DATA b7:6 Packet 0 virtual channel number (valid only for CSI2)\n 00 Virtual channel number 0 (Default)\n 01 Virtual channel number 1\n 02 Virtual channel number 2\n 03 Virtual channel number 3 \n*/ .transferFmtPkt1 = (rlUInt8_t) 0,/**< Data out Format, \n b5:0 Packet 0 content selection\n 000000 - Suppress Packet 1 \n 001110 - CP_CQ_DATA \n 001011 - CQ_CP_DATA \n b7:6 Packet 1 virtual channel number (valid only for CSI2)\n 00 Virtual channel number 0 (Default)\n 01 Virtual channel number 1\n 02 Virtual channel number 2\n 03 Virtual channel number 3\n*/ .cqConfig = (rlUInt8_t) 2, /* Armin: not sure whether we need to change these numbers??? */ .cq0TransSize = (rlUInt8_t) 64, .cq1TransSize = (rlUInt8_t) 64, .cq2TransSize = (rlUInt8_t) 64, .reserved = (rlUInt8_t) 0 }, .dataPathClkCfgArgs = { .laneClkCfg = (rlUInt8_t) 1, .dataRate = (rlUInt8_t) CHAINS_AR1243_CSI_DATA_RATE_VALUE, .reserved = (rlUInt16_t) 0 }, .hsiClkgs = { .hsiClk = (rlUInt16_t) CHAINS_AR1243_DDR_HSI_CLK, .reserved = (rlUInt16_t) 0x0 }, .laneEnCfgArgs = { .laneEn = (rlUInt16_t) #if CHAINS_AR1243_CSI_DATA1LANE_POS ((rlUInt16_t) 0x1) | #endif #if CHAINS_AR1243_CSI_DATA2LANE_POS ((rlUInt16_t) 0x2) | #endif #if CHAINS_AR1243_CSI_DATA3LANE_POS ((rlUInt16_t) 0x4) | #endif #if CHAINS_AR1243_CSI_DATA4LANE_POS ((rlUInt16_t) 0x8) | #endif ((rlUInt16_t) 0x0), .reserved = (rlUInt16_t) 0x0 }, .bpmCommnCfgArgs = { .mode.b2SrcSel = 0, .mode.b1Reserved1 = 0, .mode.b13Reserved2 = 0, .reserved0 = (rlUInt16_t) 0, .reserved1 = (rlUInt16_t) 0, .reserved2 = (rlUInt16_t) 0, .reserved3 = (rlUInt32_t) 0, .reserved4 = (rlUInt32_t) 0 }, .bpmChirpCfgArgs = gAr1243BpmChirpCfgArgs, .numBpmChirpCfgArgs = sizeof(gAr1243BpmChirpCfgArgs)/sizeof(rlBpmChirpCfg_t), .csiConfigArgs = { .lanePosPolSel = ((CHAINS_AR1243_CSI_CLOCKLANE_POS << 16U) | /* Polarity Always */ (CHAINS_AR1243_CSI_DATA4LANE_POS << 12U) | /* assumed to be 0 */ (CHAINS_AR1243_CSI_DATA3LANE_POS << 8U) | (CHAINS_AR1243_CSI_DATA2LANE_POS << 4U) | (CHAINS_AR1243_CSI_DATA1LANE_POS)), .reserved1 = (rlUInt32_t) 0U, }, // Khai: Do we want to use Advanced Cfg Frame? .advFrameCfgArgs = { .frameSeq = { .numOfSubFrames = (rlUInt8_t) CHAINS_AR1243_NUM_SUBFRAMES, .forceProfile = (rlUInt8_t) 1, .loopBackCfg = (rlUInt8_t) 0, .subFrameTrigger = (rlUInt8_t) 0, .subFrameCfg = { { .forceProfileIdx = (rlUInt16_t) 0, .chirpStartIdx = (rlUInt16_t) 0, .numOfChirps = (rlUInt16_t) CHAINS_RADAR_NUM_TX_ANTENNA, .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT_128, .burstPeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(66U), /* burstPeriodicity >= * (numLoops)* (numOfChirps) * chirpTime + InterBurstBlankTime, * where InterBurstBlankTime is primarily for sensor * calibration / monitoring, thermal control, and some minimum * time needed for triggering next burst. * NOTE: Across bursts, if the value numOfChirps, is not a * constant, then the actual available blank time can vary and * needs to be accounted for 1 LSB = 5 ns */ .chirpStartIdxOffset = (rlUInt16_t) 0, .numOfBurst = (rlUInt16_t) CHAINS_AR1243_NUM_BURSTS, .numOfBurstLoops = (rlUInt16_t) CHAINS_AR1243_NUM_BURST_LOOPS, .reserved1 = (rlUInt16_t) 0, .subFramePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(66U), .reserved2 = (rlUInt32_t) 0, .reserved3 = (rlUInt32_t) 0 }, /* Armin: replaced subFrameCfg[2] with empty place holder */ /* { .forceProfileIdx = (rlUInt16_t) 1, .chirpStartIdx = (rlUInt16_t) 0, .numOfChirps = (rlUInt16_t) 1, .numLoops = (rlUInt16_t) AR1243_RADAR_HEIGHT, .burstPeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(33U), .chirpStartIdxOffset = (rlUInt16_t) 0, .numOfBurst = (rlUInt16_t) CHAINS_AR1243_NUM_BURSTS, .numOfBurstLoops = (rlUInt16_t) CHAINS_AR1243_NUM_BURST_LOOPS, .reserved1 = (rlUInt16_t) 0, .subFramePeriodicity = (rlUInt32_t) CHAINS_AR1243_TIME_MS_TO_5NS(66U), .reserved2 = (rlUInt32_t) 0, .reserved3 = (rlUInt32_t) 0 }, */ { .forceProfileIdx = (rlUInt16_t) 0, .chirpStartIdx = (rlUInt16_t) 0, .numOfChirps = (rlUInt16_t) 0, .numLoops = (rlUInt16_t) 0, .burstPeriodicity = (rlUInt32_t) 0, .chirpStartIdxOffset = (rlUInt16_t) 0, .numOfBurst = (rlUInt16_t) 0, .numOfBurstLoops = (rlUInt16_t) 0, .reserved1 = (rlUInt16_t) 0, .subFramePeriodicity = (rlUInt32_t) 0, .reserved2 = (rlUInt32_t) 0, .reserved3 = (rlUInt32_t) 0 }, /* Armin: end replacement */ { .forceProfileIdx = (rlUInt16_t) 0, .chirpStartIdx = (rlUInt16_t) 0, .numOfChirps = (rlUInt16_t) 0, .numLoops = (rlUInt16_t) 0, .burstPeriodicity = (rlUInt32_t) 0, .chirpStartIdxOffset = (rlUInt16_t) 0, .numOfBurst = (rlUInt16_t) 0, .numOfBurstLoops = (rlUInt16_t) 0, .reserved1 = (rlUInt16_t) 0, .subFramePeriodicity = (rlUInt32_t) 0, .reserved2 = (rlUInt32_t) 0, .reserved3 = (rlUInt32_t) 0 }, { .forceProfileIdx = (rlUInt16_t) 0, .chirpStartIdx = (rlUInt16_t) 0, .numOfChirps = (rlUInt16_t) 0, .numLoops = (rlUInt16_t) 0, .burstPeriodicity = (rlUInt32_t) 0, .chirpStartIdxOffset = (rlUInt16_t) 0, .numOfBurst = (rlUInt16_t) 0, .numOfBurstLoops = (rlUInt16_t) 0, .reserved1 = (rlUInt16_t) 0, .subFramePeriodicity = (rlUInt32_t) 0, .reserved2 = (rlUInt32_t) 0, .reserved3 = (rlUInt32_t) 0 } }, .numFrames = (rlUInt16_t) 0, .triggerSelect = (rlUInt16_t) RL_FRAMESTRT_API_TRIGGER, .frameTrigDelay = (rlUInt32_t) 0, .reserved1 = (rlUInt32_t) 0, .reserved2 = (rlUInt32_t) 0 }, .frameData = { .numSubFrames = (rlUInt8_t) CHAINS_AR1243_NUM_SUBFRAMES, .reserved1 = (rlUInt8_t) 0, .reserved2 = (rlUInt16_t) 0, .subframeDataCfg = { { .totalChirps = (rlUInt32_t) CHAINS_RADAR_NUM_TX_ANTENNA * AR1243_RADAR_HEIGHT_128 * CHAINS_AR1243_NUM_BURSTS, /* Number of Chirps in Sub-Frame = * numOfChirps * numLoops * numOfBurst */ .numAdcSamples = (rlUInt16_t) AR1243_RADAR_WIDTH_256 * (rlUInt16_t) 2, .numChirpsInDataPacket = (rlUInt8_t) 1, /* In AR12xx: Program this as 1 */ .reserved1 = (rlUInt8_t) 0, }, // { // .totalChirps = // (rlUInt32_t) AR1243_RADAR_HEIGHT * CHAINS_AR1243_NUM_BURSTS, // .numAdcSamples = (rlUInt16_t) AR1243_PROFILE1_RADAR_WIDTH * (rlUInt16_t) 2, // .numChirpsInDataPacket = (rlUInt8_t) 1, // .reserved1 = (rlUInt8_t) 0, // }, { .totalChirps = (rlUInt32_t) 0, .numAdcSamples = (rlUInt16_t) 0, .numChirpsInDataPacket = (rlUInt8_t) 1, .reserved1 = (rlUInt8_t) 0, }, { .totalChirps = (rlUInt32_t) 0, .numAdcSamples = (rlUInt16_t) 0, .numChirpsInDataPacket = (rlUInt8_t) 1, .reserved1 = (rlUInt8_t) 0, } } } }, // Khai: enable TX Power Backoff and RX Gain Calibration bits .calibEnArgs = { .calibEnMask = (rlUInt32_t) 0x17f0, // 600 - enable tx rx, //200 - enable tx bk only, //0x17f0, .reserved0 = (rlUInt8_t) 0x0, .reserved1 = (rlUInt8_t) 0x0, .reserved2 = (rlUInt16_t) 0x0, .reserved3 = (rlUInt32_t) 0x0 } }; // POC: Radar Mode Configurations Bsp_Ar12xxConfigObj gAr12xx_config_RadarMode2; Bsp_Ar12xxConfigObj gAr12xx_config_RadarMode4; Bsp_Ar12xxConfigObj gAr12xx_config_RadarMode5; // POC: There will be equal number of chirp config objects as radar modes. // When a radar is selected, this function will be called and return the // corresponding chirp config for that radar mode. Bsp_Ar12xxConfigObj *getChirpConfig(UInt32 radarMode) { Bsp_Ar12xxConfigObj *ptr = NULL; if(radarMode == 1) { ptr = &gAr12xx_config_RadarMode1; } else if (radarMode == 2) { gAr12xx_config_RadarMode2 = gAr12xx_config_RadarMode1; ptr = &gAr12xx_config_RadarMode2; ptr->chirpCfgArgs = gAr1243ChirpCfgArgs_RadarMode2; ptr->numChirpCfgArgs = sizeof(gAr1243ChirpCfgArgs_RadarMode2)/sizeof(rlChirpCfg_t); ptr->frameCfgArgs = &gAr1243FrmArgs_RadarMode2; ptr->numFrameCfgArgs = sizeof(gAr1243FrmArgs_RadarMode2)/sizeof(rlFrameCfg_t); } else if (radarMode == 4) { gAr12xx_config_RadarMode4 = gAr12xx_config_RadarMode1; ptr = &gAr12xx_config_RadarMode4; ptr->chirpCfgArgs = gAr1243ChirpCfgArgs_RadarMode4; ptr->numChirpCfgArgs = sizeof(gAr1243ChirpCfgArgs_RadarMode4)/sizeof(rlChirpCfg_t); ptr->frameCfgArgs = &gAr1243FrmArgs_RadarMode4; ptr->numFrameCfgArgs = sizeof(gAr1243FrmArgs_RadarMode4)/sizeof(rlFrameCfg_t); } else if (radarMode == 5) { gAr12xx_config_RadarMode5 = gAr12xx_config_RadarMode1; ptr = &gAr12xx_config_RadarMode5; ptr->chirpCfgArgs = gAr1243ChirpCfgArgs_RadarMode5; ptr->numChirpCfgArgs = sizeof(gAr1243ChirpCfgArgs_RadarMode5)/sizeof(rlChirpCfg_t); ptr->frameCfgArgs = &gAr1243FrmArgs_RadarMode5; ptr->numFrameCfgArgs = sizeof(gAr1243FrmArgs_RadarMode5)/sizeof(rlFrameCfg_t); } else { Vps_printf("\nRadar Mode '%d' - Unsupported\n", radarMode); } return ptr; } // Khai: Selecting number of Radars menu (1 -4) Int32 Chains_ar12xxGetSampleConfig(ChainsCommon_Ar12xxConfigOut *pCfgOut, UInt32 fusionEnabled) { UInt32 i = 0U; UInt32 done = FALSE; char ch; if (Bsp_ar12xxGetConnType() == BSP_AR12XX_CONN_TYPE_FPDLINK) { if (fusionEnabled == 0U) { // If network control specifies radar mode if(pCfgOut->radarMode != 0) pCfgOut->numRadars = 1; else { while(!done) { ch = ChainsCommon_ar12xxRunTimeMenu(gChains_numRadarsMenu); switch(ch) { case '1': pCfgOut->numRadars = 1; done = TRUE; break; case '2': pCfgOut->numRadars = 2; done = TRUE; break; case '3': pCfgOut->numRadars = 3; done = TRUE; break; case '4': pCfgOut->numRadars = 4; done = TRUE; break; default: Vps_printf("\nUnsupported option '%c'. Please try again\n", ch); break; } } } } else { pCfgOut->numRadars = 1; } Vps_printf(" CHAINS: %d AR12xx connected via FPD-Link... \n\r", pCfgOut->numRadars); done = FALSE; } else { pCfgOut->numRadars = 1; } pCfgOut->fusionEnabled = fusionEnabled; /* Check for certain size limitations. This will show up as compile time * issues. */ COMPILE_TIME_ASSERT(sizeof(gAr1243ChirpCfgArgs_RadarMode1)/sizeof(rlChirpCfg_t) > 512); COMPILE_TIME_ASSERT( sizeof(gAr1243ProfileArgs_RadarMode1)/sizeof(rlProfileCfg_t) > CHAINS_AR1243_MAX_PROFILES); for (i = 0; i < pCfgOut->numRadars; i++) { /* Defaulting to macro as this not captured in the ar12xxConfig parameter */ pCfgOut->radarParams[i].numValidBits = CHAINS_AR1243_ADC_DATA_FORMAT; pCfgOut->radarParams[i].bpmEnabled = 0U; pCfgOut->radarParams[i].numProfiles = sizeof(gAr1243ProfileArgs_RadarMode1)/sizeof(rlProfileCfg_t); } for (i=0; i<CHAINS_MAX_NUM_RADARS; i++) { // Khai: This is where we provide the different chirp config based on the radar mode // request from external controller in getChirpConfig(1) memcpy(&pCfgOut->radarParams[i].ar12xxConfig, getChirpConfig(pCfgOut->radarMode), sizeof (gAr12xx_config_RadarMode1)); sprintf(pCfgOut->radarParams[i].configName, "%s_%d", CHAINS_AR1243_CONFIG_NAME, i); pCfgOut->radarParams[i].chirpRow = &gAr1243ChirpRowArgs[i][0]; pCfgOut->radarParams[i].numChirpRow = CHAINS_AR1243_CHIRPROW_SIZE; } /* Default to normal frame */ pCfgOut->frameType = 0U; return SYSTEM_LINK_STATUS_SOK; }