Tool/software: Code Composer Studio
hi !
I don't have any idea about Awr1642's Adv-frame configuration.Can ti offer some code for that , or where can i find some information about the process?
present , I want to combine two sub-frame as one frame. each sub-frame has 32 unique chirp(32 chirp is just for test),so the final total frame has 64 chirp.i try to modificate the mmwave-demo offer by ti which the version is mmwave_sdk_01_00_00_05. please help me to check the process wether or not is right.
1), calling the function named MmwDemo_notifySensorStop(); stop the sensor
2) , populating the gMmwMssMCB struct as below(i just paste parts Code segment):
/**************************************************************************************************************/
/**************************************************************************************************************/
rlFrameCfg_t frameCfg1;
rlFrameCfg_t frameCfg2;
uint16_t ChirpCnt = 0;
frameCfg->chirpStartIdx = 0;
frameCfg->chirpEndIdx = 31;
frameCfg->numLoops = 1;
frameCfg->numFrames = 0;
frameCfg->framePeriodicity = 100 * 1000000 / 5;
frameCfg->triggerSelect = 1; //Software API based triggering
frameCfg->frameTriggerDelay = 0 * 1000000 / 5;
profileCfg1.profileId = 0;
profileCfg1.startFreqConst = (uint32_t) (77 * (1U << 26) / 3.6);
profileCfg1.idleTimeConst = (uint32_t)((float)7 * 1000 / 10);
profileCfg1.adcStartTimeConst = (uint32_t)((float)7 * 1000 / 10);
profileCfg1.rampEndTime = (uint32_t)((float)58 * 1000 / 10);
profileCfg1.txOutPowerBackoffCode = 0;
profileCfg1.txPhaseShifter = 0;
profileCfg1.freqSlopeConst = (uint32_t)(0.1 * (1U << 26) / (3.6*1e3*900));//(uint32_t)(68 * (1U << 26) / (3.6*1e3*900)); //2^26 * 1e6/((3.6*1e9)*900)
profileCfg1.txStartTime = (uint32_t)((float)1 * 1000 / 10);
profileCfg1.numAdcSamples = 256;
profileCfg1.digOutSampleRate = 5500;
profileCfg1.hpfCornerFreq1 = 0;
profileCfg1.hpfCornerFreq2 = 0;
profileCfg1.rxGain = 30;
profileCfg2.profileId = 1;
profileCfg2.startFreqConst = (uint32_t) (78 * (1U << 26) / 3.6);
profileCfg2.idleTimeConst = (uint32_t)((float)7 * 1000 / 10);
profileCfg2.adcStartTimeConst = (uint32_t)((float)7 * 1000 / 10);
profileCfg2.rampEndTime = (uint32_t)((float)58 * 1000 / 10);
profileCfg2.txOutPowerBackoffCode = 0;
profileCfg2.txPhaseShifter = 0;
profileCfg2.freqSlopeConst = (uint32_t)(0.1 * (1U << 26) / (3.6*1e3*900));//(uint32_t)(68 * (1U << 26) / (3.6*1e3*900)); //2^26 * 1e6/((3.6*1e9)*900)
profileCfg2.txStartTime = (uint32_t)((float)1 * 1000 / 10);
profileCfg2.numAdcSamples = 256;
profileCfg2.digOutSampleRate = 5500;
profileCfg2.hpfCornerFreq1 = 0;
profileCfg2.hpfCornerFreq2 = 0;
profileCfg2.rxGain = 30;
/*first profile polution*/
for(ChirpCnt = 0 ; ChirpCnt < 32 ; ChirpCnt ++){
/* Populate the chirp configuration: */
chirpCfg.chirpStartIdx = ChirpCnt ;
chirpCfg.chirpEndIdx = ChirpCnt ;
chirpCfg.profileId = 0;
chirpCfg.startFreqVar = (uint32_t)((((ChirpCnt)*10e6) * ((uint64_t)(1<<26))) / (3.6*1e9));
chirpCfg.freqSlopeVar = (int16_t)(0 * ((uint64_t)(1<<26))) / ((uint64_t)(3.6*1e9*900));
chirpCfg.idleTimeVar = (uint32_t)((float)0 * 1000 / 10);
chirpCfg.adcStartTimeVar = (uint32_t)((float)0 * 1000 / 10);
chirpCfg.txEnable = 1;
/* Get the profile handle to which the chirp is to be added: */
if (MMWave_getProfileHandle (gMmwMssMCB.ctrlHandle, chirpCfg.profileId,
&profileHandle, &errCode) < 0)
{
/* Error: Unable to get the profile handle. Return the error code */
return errCode;
}
/* Add the chirp to the profile */
if (MMWave_addChirp (profileHandle, &chirpCfg, &errCode) == NULL)
{
/* Error: Unable to add the chirp. Return the error code. */
return errCode;
}
}
/*secend profile polution*/
for(ChirpCnt = 0 ; ChirpCnt < 32 ; ChirpCnt ++){
/* Populate the chirp configuration: */
chirpCfg.chirpStartIdx = ChirpCnt ;
chirpCfg.chirpEndIdx = ChirpCnt ;
chirpCfg.profileId = 1;
chirpCfg.startFreqVar = (uint32_t)((((ChirpCnt)*10e6) * ((uint64_t)(1<<26))) / (3.6*1e9));
chirpCfg.freqSlopeVar = (int16_t)(0 * ((uint64_t)(1<<26))) / ((uint64_t)(3.6*1e9*900));
chirpCfg.idleTimeVar = (uint32_t)((float)0 * 1000 / 10);
chirpCfg.adcStartTimeVar = (uint32_t)((float)0 * 1000 / 10);
chirpCfg.txEnable = 1;
/* Get the profile handle to which the chirp is to be added: */
if (MMWave_getProfileHandle (gMmwMssMCB.ctrlHandle, chirpCfg.profileId,
&profileHandle, &errCode) < 0)
{
/* Error: Unable to get the profile handle. Return the error code */
return errCode;
}
/* Add the chirp to the profile */
if (MMWave_addChirp (profileHandle, &chirpCfg, &errCode) == NULL)
{
/* Error: Unable to add the chirp. Return the error code. */
return errCode;
}
}
/**************************************************************************************************************/
/**************************************************************************************************************/
3) configuration the adv-frame struct
//******************************************************************************************************// //******************************************************************************************************// //this part of code is reference by :"\mmwave_sdk_01_00_00_05\mmwave_sdk_01_00_00_05\packages\ti\control\mmwavelink\test\common\testlink.c" rlAdvFrameCfg_t advFrameCfg; memset(advFrameCfg , 0 , sizeof(advFrameCfg)); advFrameCfg.frameSeq.numOfSubFrames = 2, // i wanna two subframe combine as one frame advFrameCfg.frameSeq.forceProfile = xxQ1, //i have two profile , profile0 and profile1 but i don't kown what values should be set in here advFrameCfg.frameSeq.reserved1 = 0, advFrameCfg.frameSeq.subFrameCfg[0].forceProfileIdx = 0, // mine first profile0 advFrameCfg.frameSeq.subFrameCfg[0].chirpStartIdx = 0, // start idx is 0 , and mine chirp is 0 - 31; advFrameCfg.frameSeq.subFrameCfg[0].numOfChirps = 32, // advFrameCfg.frameSeq.subFrameCfg[0].numLoops = 0, // advFrameCfg.frameSeq.subFrameCfg[0].burstPeriodicity = 0,// can it be 0 , after all i don't have burst advFrameCfg.frameSeq.subFrameCfg[0].chirpStartIdxOffset = xxQ2, // I don't follow this? advFrameCfg.frameSeq.subFrameCfg[0].numOfBurst = 1, advFrameCfg.frameSeq.subFrameCfg[0].numOfBurstLoops = 1, advFrameCfg.frameSeq.subFrameCfg[0].reserved1 = 0, advFrameCfg.frameSeq.subFrameCfg[0].subFramePeriodicity = 0,// can it be zero advFrameCfg.frameSeq.subFrameCfg[0].reserved2 = 0, advFrameCfg.frameSeq.subFrameCfg[0].reserved3 = 0, advFrameCfg.frameSeq.subFrameCfg[1].forceProfileIdx = 1, advFrameCfg.frameSeq.subFrameCfg[1].chirpStartIdx = 0, advFrameCfg.frameSeq.subFrameCfg[1].numOfChirps = 32, advFrameCfg.frameSeq.subFrameCfg[1].numLoops = 0, advFrameCfg.frameSeq.subFrameCfg[1].burstPeriodicity = 0, advFrameCfg.frameSeq.subFrameCfg[1].chirpStartIdxOffset = 0, advFrameCfg.frameSeq.subFrameCfg[1].numOfBurst = 1, advFrameCfg.frameSeq.subFrameCfg[1].numOfBurstLoops = 1, advFrameCfg.frameSeq.subFrameCfg[1].reserved1 = 0, advFrameCfg.frameSeq.subFrameCfg[1].subFramePeriodicity = 0, advFrameCfg.frameSeq.subFrameCfg[1].reserved2 = 0, advFrameCfg.frameSeq.subFrameCfg[1].reserved3 = 0, advFrameCfg.frameSeq.numFrames = 0, //infinite frames to transmit advFrameCfg.frameSeq.triggerSelect = 1, advFrameCfg.frameSeq.frameTrigDelay = 0, // can it be zero advFrameCfg.frameSeq.reserved2 = 0, advFrameCfg.frameData.numSubFrames = 2, //two sub-frame advFrameCfg.frameData.reserved1 = 0, advFrameCfg.frameData.reserved2 = 0, advFrameCfg.frameData.subframeDataCfg[0].totalChirps = 32, //numOfChirps * numLoops * numOfBurst = 32*1*1 = 32 advFrameCfg.frameData.subframeDataCfg[0].numAdcSamples = 128, //64point * 2 = 128 advFrameCfg.frameData.subframeDataCfg[0].numChirpsInDataPacket = 1, advFrameCfg.frameData.subframeDataCfg[0].reserved1 = 0, advFrameCfg.frameData.subframeDataCfg[1].totalChirps = 32, advFrameCfg.frameData.subframeDataCfg[1].numAdcSamples = 128, advFrameCfg.frameData.subframeDataCfg[1].numChirpsInDataPacket = 1, advFrameCfg.frameData.subframeDataCfg[1].reserved1 = 0, //******************************************************************************************************// //******************************************************************************************************//
i have some problem about the code ,
Q1 : advFrameCfg.frameSeq.forceProfile;
what value should be set and what is means?
what the different between the advFrameCfg.frameSeq.forceProfile and advFrameCfg.frameSeq.subFrameCfg[1].forceProfileIdx?
Q2 : can advFrameCfg.frameSeq.subFrameCfg[0].burstPeriodicity be zeros?
Q3 : have some problem with the configration about advFrameCfg ?
4) calling the function MmwDemo_mssDataPathConfig() to configurated all of parameter to BSS
5) calling the function named MMWave_fullConfig() ;
//**********************************************************************************************************************//
//**********************************************************************************************************************//
static int32_t MMWave_fullConfig (MMWave_MCB* ptrMMWaveMCB, MMWave_CtrlCfg* ptrControlCfg, int32_t* errCode)
{
int32_t retVal = -1;
MMWave_InitRFCfg initRFCfg;
/* Initialize the RF configuration: */
memset ((void*)&initRFCfg, 0, sizeof(MMWave_InitRFCfg));
/* Populate the configuration */
initRFCfg.ptrChannelCfg = &ptrControlCfg->u.fullControlCfg.chCfg;
initRFCfg.ptrADCOutCfg = &ptrControlCfg->u.fullControlCfg.adcOutCfg;
initRFCfg.ptrLowPowerModeCfg = &ptrControlCfg->u.fullControlCfg.lowPowerMode;
initRFCfg.freqLimitLow = ptrControlCfg->freqLimitLow;
initRFCfg.freqLimitHigh = ptrControlCfg->freqLimitHigh;
/* Initialize the RF: */
retVal = MMWave_initRF (ptrMMWaveMCB, &initRFCfg, errCode);
if (retVal < 0)
{
/* Error: Initialization of the RF failed; error code is already setup */
goto exit;
}
/* Configure the Link with the application supplied configuration: */
retVal = MMWave_configLink (ptrMMWaveMCB, ptrControlCfg, errCode);
if (retVal < 0)
{
/* Error: Configuration of the Link failed; error code is already setup */
goto exit;
}
/* Link configuration validated: We can now pass this to the SOC Handler. */
retVal = gMMWaveHwAttributes.cfgFxn (ptrMMWaveMCB, ptrControlCfg, errCode);
if (retVal < 0)
{
/* Error: mmWave Link configuration failed. Error code is already configured
* Fall through! */
goto exit;
}
/* mmWave Link configured. */
ptrMMWaveMCB->isConfigured = true;
/* Setup the return value: */
retVal = 0;
exit:
return retVal;
}
//**********************************************************************************************************************//
//**********************************************************************************************************************//
Q5 : i think i should add the function named:
rlSetAdvFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlAdvFrameCfg_t*)&advFrameCfg);
into the function MMWave_configLink (ptrMMWaveMCB, ptrControlCfg, errCode), but i'm not sure where to add. I'v try to code it ,please help me check it :
6) add the function rlSetAdvFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlAdvFrameCfg_t*)&advFrameCfg) into MMWave_configLink().
//**********************************************************************************************//
//**********************************************************************************************//
int32_t MMWave_configLink
(
MMWave_MCB* ptrMMWaveMCB,
MMWave_CtrlCfg* ptrControlCfg,
int32_t* errCode
)
{
int32_t retVal;
int32_t index;
rlContModeEn_t contModeEnable;
rlProfileCfg_t profileCfg;
MMWave_ChirpHandle chirpHandle;
rlChirpCfg_t chirpCfg;
uint32_t numChirps;
uint32_t chirpIndex;
/* Determine the DFE Output mode? */
if (ptrControlCfg->u.fullControlCfg.dfeDataOutputMode == MMWave_DFEDataOutputMode_CHIRP)
{
/**************************************************************************
* Chirp Mode:
* Order of operations as specified by the mmWave Link are
* - Profile configuration
* - Chirp configuration
* - Frame configuration
**************************************************************************/
for (index = 0; index < MMWAVE_MAX_PROFILE; index++)
{
/* Do we have a valid profile? */
if (ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.profileHandle[index] == NULL)
{
/* NO: Skip to the next profile */
continue;
}
/* YES: Get the profile configuration */
if (MMWave_getProfileCfg (ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.profileHandle[index],
&profileCfg, errCode) < 0)
{
/* Error: Unable to get the profile configuration. Setup the return value */
retVal = -1;
goto end;
}
/* Configure the profile using the mmWave Link API */
retVal = rlSetProfileConfig (RL_DEVICE_MAP_INTERNAL_BSS, 1U, &profileCfg);
if (retVal != RL_RET_CODE_OK)
{
/* Error: Setting the profile configuration failed */
*errCode = MMWAVE_EPROFILECFG;
MMWave_translateErrorCode(&retVal);
goto end;
}
/* Get the number of chirps configured and attached to the profile: */
if (MMWave_getNumChirps (ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.profileHandle[index],
&numChirps, errCode) < 0)
{
/* Error: Unable to get the number of chirps. Error code is already setup */
retVal = -1;
goto end;
}
/* For the profile; Cycle through all the chirps and configure them. */
for (chirpIndex = 1U; chirpIndex <= numChirps; chirpIndex++)
{
/* Get the Chirp Handle associated at the specified index */
if (MMWave_getChirpHandle (ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.profileHandle[index],
chirpIndex, &chirpHandle, errCode) < 0)
{
/* Error: Unable to get the chirp handle. Error code is already setup */
retVal = -1;
goto end;
}
/* Get the chirp configuration: */
if (MMWave_getChirpCfg (chirpHandle, &chirpCfg, errCode) < 0)
{
/* Error: Unable to get the chirp configuration. Error code is already setup */
retVal = -1;
goto end;
}
/* Set the chirp configuration in the mmWave link */
retVal = rlSetChirpConfig(RL_DEVICE_MAP_INTERNAL_BSS, 1U, &chirpCfg);
if (retVal != RL_RET_CODE_OK)
{
/* Error: Setting the chirp configuration failed */
*errCode = MMWAVE_ECHIRPCFG;
MMWave_translateErrorCode(&retVal);
goto end;
}
}
}
/* Set the frame configuration: */
//retVal = rlSetFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, &ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.frameCfg);
retVal = rlSetAdvFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlAdvFrameCfg_t*)&advFrameCfg);if (retVal != RL_RET_CODE_OK)
{
/* Error: Setting the frame configuration failed */
*errCode = MMWAVE_EFRAMECFG;
MMWave_translateErrorCode(&retVal);
goto end;
}
}
else
{
/**************************************************************************
* Continuous Mode:
* Order of operations as specified by the mmWave Link are
* - Continuous Mode configuration
* - Device enable streaming
**************************************************************************/
retVal = rlSetContModeConfig (RL_DEVICE_MAP_INTERNAL_BSS, &ptrControlCfg->u.fullControlCfg.u.continuousModeCfg.contModeCfg);
if (retVal != RL_RET_CODE_OK)
{
*errCode = MMWAVE_ECONTMODECFG;
MMWave_translateErrorCode(&retVal);
goto end;
}
/* Initialize the continuous mode configuration: */
memset ((void*)&contModeEnable, 0, sizeof(rlContModeEn_t));
/* Populate the continuous mode configuration: */
contModeEnable.contModeEn = 1U;
retVal = rlEnableContMode (RL_DEVICE_MAP_INTERNAL_BSS, &contModeEnable);
if (retVal != RL_RET_CODE_OK)
{
*errCode = MMWAVE_ECONTMODE;
MMWave_translateErrorCode(&retVal);
goto end;
}
}
/* Set the return value to be success. */
retVal = 0;
end:
return retVal;
}
//**********************************************************************************************//
//**********************************************************************************************//
i just used the function
retVal = rlSetAdvFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlAdvFrameCfg_t*)&advFrameCfg);
instead of the function
retVal = rlSetFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, &ptrControlCfg->u.fullControlCfg.u.chirpModeCfg.frameCfg);
can it be work?otherwise how can i do it?
BR
havi