Tool/software:
Hi,
Recently, while debugging the advanced frame mode, I encountered some issues when I came across this interface:
My SDK: 04.04.01.02
In interface "MMWave_configureAdvFrame" : the variable can take a value of either 0 or 1.pstAdvFrameCfg = &ptrControlCfg->u.advancedFrameCfg[u32DevIdx].frameCfg;
u32DevIdx
static int32_t MMWave_configureAdvFrame(MMWave_MCB * ptrMMWaveMCB, MMWave_CtrlCfg * ptrControlCfg, int32_t * errCode) { MMWave_ProfileHandle * ptrProfileHandle; rlAdvFrameCfg_t * pstAdvFrameCfg; rlProfileCfg_t stProfileCfg; int32_t retVal; uint32_t u32ProfIdx; uint32_t u32SubFrIdx; uint32_t u32DevIdx; uint16_t u16MasterTriggerSelectCnf; uint16_t u16AdcDataType; uint16_t u16NumAdcSamples; uint8_t u8DeviceMap; /* Get data to compute the value of the numAdcSamples parameter. * NOTE: It is assumed that all devices use the same number of ADC samples. */ if(ptrMMWaveMCB->openCfg.adcOutCfg.fmt.b2AdcOutFmt == 0U) { u16AdcDataType = 1U; /* Data type = Real */ } else { u16AdcDataType = 2U; /* Data type = Complex */ } /* Get the number of ADC samples (it is expected that all profiles across * all devices have the same number) */ ptrProfileHandle = &ptrControlCfg->u.advancedFrameCfg[ptrMMWaveMCB->openCfg.MasterDevIdx].profileHandle[0]; for(u32ProfIdx = 0U; u32ProfIdx < MMWAVE_MAX_PROFILE; u32ProfIdx++) { /* Check if this index holds a profile handle */ if(ptrProfileHandle[u32ProfIdx] != NULL) { /* Get the profile configuration */ MMWave_getProfileCfg(ptrProfileHandle[u32ProfIdx], &stProfileCfg, errCode); /* Compute the number of ADC samples for the frame configuration */ u16NumAdcSamples = u16AdcDataType * stProfileCfg.numAdcSamples; break; } } /* Loop across all devices to check the trigger select configuration */ for(u32DevIdx = 0U; u32DevIdx < MMWAVE_RADAR_DEVICES; u32DevIdx++) { /* Get the frame configuration of the device */ pstAdvFrameCfg = &ptrControlCfg->u.advancedFrameCfg[u32DevIdx].frameCfg; if(u32DevIdx == (uint32_t) ptrMMWaveMCB->openCfg.MasterDevIdx) { /* Master - Frame can be triggered by external trigger or by SW) */ if(pstAdvFrameCfg->frameSeq.triggerSelect != (uint16_t) RL_FRAMESTRT_SYNCIN_TRIGGER) { pstAdvFrameCfg->frameSeq.triggerSelect = (uint16_t) RL_FRAMESTRT_API_TRIGGER; } u16MasterTriggerSelectCnf = pstAdvFrameCfg->frameSeq.triggerSelect; } else { /* Slaves - Frame can be triggered only by external trigger */ pstAdvFrameCfg->frameSeq.triggerSelect = (uint16_t) RL_FRAMESTRT_SYNCIN_TRIGGER; } } /* Loop across all devices to * - check the sub-frame trigger configuration. * - update the number of ADC sample for each sub-frame */ for(u32DevIdx = 0U; u32DevIdx < MMWAVE_RADAR_DEVICES; u32DevIdx++) { /* Get the frame configuration of the device */ pstAdvFrameCfg = &ptrControlCfg->u.advancedFrameCfg[u32DevIdx].frameCfg; /* NOTE: The configuration HW or SW trigger for frames and no trigger for sub-frames */ if(u16MasterTriggerSelectCnf == (uint16_t) RL_FRAMESTRT_API_TRIGGER) { /* Master is triggered by SW, then no need of sub-frame trigger */ pstAdvFrameCfg->frameSeq.subFrameTrigger = 0U; } else { /* Master is triggered by HW, then sub-frames should also be triggered by HW. */ pstAdvFrameCfg->frameSeq.subFrameTrigger = 1U; } /* Update the number of ADC sample with the computed value. This parameter is * required only for AWR1243/2243 chips and configures the size of ADC samples * per chirp to be sent on LVDS/CSI2 interface */ for(u32SubFrIdx = 0U; u32SubFrIdx < (uint32_t) pstAdvFrameCfg->frameData.numSubFrames; u32SubFrIdx++) { pstAdvFrameCfg->frameData.subframeDataCfg[u32SubFrIdx].numAdcSamples = u16NumAdcSamples; } } /* Loop across all devices to send the advanced frame configuration */ u32DevIdx = 0; for(u32DevIdx = 0U; u32DevIdx < MMWAVE_RADAR_DEVICES; u32DevIdx++) { /* Create a local device map to select each device one per one */ u8DeviceMap = (uint8_t) ((uint32_t) 1U << u32DevIdx); /* Get the frame configuration of the device */ pstAdvFrameCfg = &ptrControlCfg->u.advancedFrameCfg[u32DevIdx].frameCfg; retVal = rlSetAdvFrameConfig(u8DeviceMap, pstAdvFrameCfg); if (retVal != RL_RET_CODE_OK) { *errCode = MMWave_encodeError(MMWave_ErrorLevel_ERROR, MMWAVE_EFRAMECFG, retVal); retVal = MINUS_ONE; break; } } return retVal; }
However, in the file, all interfaces related to advanced frames only assign values to the structure with an ID of 0. For example, in the configuration of the interface , only the cli_mmwave.c
CLI_MMWaveAdvFrameDataCfg
structure with an ID of 0 is assigned values, as seen in the following code:
memcpy((void *)&gCLIMMWaveControlCfg.u.advancedFrameCfg[0].frameCfg.frameData.subframeDataCfg[subFrameNum],
(void *)&subFrameDataCfg, sizeof(rlSubFrameDataCfg_t));
static int32_t CLI_MMWaveAdvFrameDataCfg (int32_t argc, char* argv[]) { rlSubFrameDataCfg_t subFrameDataCfg; uint8_t subFrameNum; /* Sanity Check: Minimum argument check */ if (argc != 5) { CLI_write ("Error: Invalid usage of the CLI command\n"); return -1; } /* Sanity Check: Sub Frame configuration is valid only for the Advanced Frame Mode: */ if (gCLIMMWaveControlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME) { CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Advanced Frame\n"); return -1; } /* Initialize the frame configuration: */ memset ((void *)&subFrameDataCfg, 0, sizeof(rlSubFrameDataCfg_t)); /* Populate the frame configuration: */ subFrameNum = (uint8_t)atoi (argv[1]); if (subFrameNum > gCLIMMWaveControlCfg.u.advancedFrameCfg[0].frameCfg.frameData.numSubFrames) { CLI_write ("Error: Invalid subframe number.\n"); return -1; } subFrameDataCfg.numAdcSamples = atoi (argv[2]) * 2 ; subFrameDataCfg.totalChirps = atoi (argv[3]); subFrameDataCfg.numChirpsInDataPacket = atoi (argv[4]); /* Save Configuration to use later */ memcpy((void *)&gCLIMMWaveControlCfg.u.advancedFrameCfg[0].frameCfg.frameData.subframeDataCfg[subFrameNum], (void *)&subFrameDataCfg, sizeof(rlSubFrameDataCfg_t)); return 0; }
his should be problematic, right? How should it be corrected?