Part Number:MCU-PLUS-SDK-AM273X
你好,专家
我在尝试配置am273x DDMA处理的dopplerprochwaDDMA中遇到了问题;描述如下:我想在sumTx后面加上一个doppler维度的CFAR,由于需要使用sumTx的输出作为输入,所以将原来完成sumTx后触发EDMA搬运sumTx结果的操作放到完成CFAR后进行。但是做出如上更改后,am273x在调用函数DPU_DopplerProcHWA_config进行配置时,就失败了。我在加上cfar的paramset后,已经调整了参数DOPPLERPROCHWA_DDMA_DOPPLER_NUM_HWA_PARAMSETS和obj->dopplerAzimHwaCommonConfig.paramStopIdx;请问是什么原因导致的上述问题。配置代码如下:
paramsetIdx++;hwParamsetIdx++;hwaParamCfg[paramsetIdx].triggerMode = HWA_TRIG_MODE_SOFTWARE; //HWA_TRIG_MODE_IMMEDIATE;hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_FFT;/* PREPROC CONFIG */hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.preProcCfg.dcEstResetMode = HWA_DCEST_INTERFSUM_RESET_MODE_NOUPDATE;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.preProcCfg.dcSubEnable = HWA_FEATURE_BIT_DISABLE;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.preProcCfg.complexMultiply.cmultMode = HWA_COMPLEX_MULTIPLY_MODE_DISABLE;/* ACCELMODE CONFIG (FFT) */hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.fftEn = HWA_FEATURE_BIT_ENABLE;fftSizeTemp = mathUtils_getValidFFTSize(obj->dopplerDemodCfg.numBandsTotal);if(fftSizeTemp % 3 == 0){hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.fftSize = mathUtils_ceilLog2(fftSizeTemp/3);hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.fftSize3xEn = HWA_FEATURE_BIT_ENABLE;}else{hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.fftSize = mathUtils_ceilLog2(fftSizeTemp);hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.fftSize3xEn = HWA_FEATURE_BIT_DISABLE;}hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.butterflyScaling = 0;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.windowEn = HWA_FEATURE_BIT_DISABLE;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.postProcCfg.magLogEn = HWA_FFT_MODE_MAGNITUDE_ONLY_ENABLED;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.postProcCfg.fftOutMode = HWA_FFT_MODE_OUTPUT_DEFAULT;hwaParamCfg[paramsetIdx].accelModeArgs.fftMode.preProcCfg.complexMultiply.cmultMode = HWA_COMPLEX_MULTIPLY_MODE_DISABLE;/* SOURCE CONFIG */hwaParamCfg[paramsetIdx].source.srcAddr = DPU_DOPPLERHWADDMA_ADDR_SUMTX_PING_IN;hwaParamCfg[paramsetIdx].source.srcAcnt = obj->dopplerDemodCfg.numBandsTotal - 1; /* this is samples - 1 */hwaParamCfg[paramsetIdx].source.srcAIdx = obj->dopplerDemodCfg.sumTxIOCfg.input.bytesPerSample;hwaParamCfg[paramsetIdx].source.srcBcnt = (obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal) - 1;hwaParamCfg[paramsetIdx].source.srcBIdx = obj->dopplerDemodCfg.sumTxIOCfg.input.bytesPerSample;hwaParamCfg[paramsetIdx].source.srcRealComplex = obj->dopplerDemodCfg.sumTxIOCfg.input.isReal;if(obj->dopplerDemodCfg.sumTxIOCfg.input.bytesPerSample == 2 ||(obj->dopplerDemodCfg.sumTxIOCfg.input.bytesPerSample == 4 &&(!obj->dopplerDemodCfg.sumTxIOCfg.input.isReal))){hwaParamCfg[paramsetIdx].source.srcWidth = HWA_SAMPLES_WIDTH_16BIT;}else{hwaParamCfg[paramsetIdx].source.srcWidth = HWA_SAMPLES_WIDTH_32BIT;}hwaParamCfg[paramsetIdx].source.srcSign = obj->dopplerDemodCfg.sumTxIOCfg.input.isSigned;hwaParamCfg[paramsetIdx].source.srcConjugate = 0;hwaParamCfg[paramsetIdx].source.srcScale = 8;hwaParamCfg[paramsetIdx].source.shuffleMode = HWA_SRC_SHUFFLE_AB_MODE_ADIM;hwaParamCfg[paramsetIdx].source.shuffleStart = 0;hwaParamCfg[paramsetIdx].source.wrapComb = obj->numDopplerBins * obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample;/* DEST CONFIG */hwaParamCfg[paramsetIdx].dest.dstAddr = DPU_DOPPLERHWADDMA_ADDR_SUMTX_PING_OUT +obj->numDopplerBins * obj->dopplerDemodCfg.DDMAMetricIOCfg.output.bytesPerSample;hwaParamCfg[paramsetIdx].dest.dstAcnt = 1 - 1;hwaParamCfg[paramsetIdx].dest.dstAIdx = obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample;hwaParamCfg[paramsetIdx].dest.dstBIdx = obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample;hwaParamCfg[paramsetIdx].dest.dstRealComplex = obj->dopplerDemodCfg.sumTxIOCfg.output.isReal;if(obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample == 2 ||(obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample == 4 &&(!obj->dopplerDemodCfg.sumTxIOCfg.output.isReal))){hwaParamCfg[paramsetIdx].dest.dstWidth = HWA_SAMPLES_WIDTH_16BIT;}else{hwaParamCfg[paramsetIdx].dest.dstWidth = HWA_SAMPLES_WIDTH_32BIT;}hwaParamCfg[paramsetIdx].dest.dstSign = obj->dopplerDemodCfg.sumTxIOCfg.output.isSigned;hwaParamCfg[paramsetIdx].dest.dstConjugate = HWA_FEATURE_BIT_DISABLE;hwaParamCfg[paramsetIdx].dest.dstScale = mathUtils_ceilLog2(obj->dopplerDemodCfg.numBandsTotal);hwaParamCfg[paramsetIdx].dest.dstSkipInit = 0;errCode = HWA_configParamSet(obj->hwaHandle,hwParamsetIdx,&hwaParamCfg[paramsetIdx],NULL);if (errCode != 0){goto exit;}// errCode = HWA_getDMAChanIndex(obj->hwaHandle, cfg->hwRes.edmaCfg.dopplerEdmaCfg.edmaSumLogAbsOut.pingPong[PING].channel, &destChan);// if (errCode != 0)// {//goto exit;// }// /* enable the DMA hookup to this paramset so that data gets copied out */// paramISRConfig.interruptTypeFlag = HWA_PARAMDONE_INTERRUPT_TYPE_DMA;// paramISRConfig.dma.dstChannel = destChan;// errCode = HWA_enableParamSetInterrupt(obj->hwaHandle, hwParamsetIdx, ¶mISRConfig);// if (errCode != 0)// {//goto exit;// }}}}/*******************************//* PING DOPPLER CFAR PARAMSET *//*******************************/#if 1 {{cfarAvgRight = 4;cfarAvgLeft = 4;cfarGuardCells = 0;paramsetIdx++;hwParamsetIdx++;hwaParamCfg[paramsetIdx].triggerMode = HWA_TRIG_MODE_IMMEDIATE;hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_CFAR;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.peakGroupEn = HWA_FEATURE_BIT_ENABLE;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.operMode = HWA_CFAR_OPER_MODE_LOG_INPUT_REAL; /* cfarInpMode = 1, cfarLogMode = 1, cfarAbsMode = 00b */hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.numGuardCells = cfarGuardCells;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.nAvgDivFactor = 3;//not applicable in CFAR_OShwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.cyclicModeEn = HWA_FEATURE_BIT_ENABLE;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.nAvgMode = HWA_NOISE_AVG_MODE_CFAR_OS;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.numNoiseSamplesRight = cfarAvgRight;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.numNoiseSamplesLeft = cfarAvgLeft;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.outputMode = HWA_CFAR_OUTPUT_MODE_I_PEAK_IDX_Q_NEIGHBOR_NOISE_VAL;// if (obj->cfarAzimFFTCfg.cfarCfg.averageMode == HWA_NOISE_AVG_MODE_CFAR_OS) // {hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.cfarOsKvalue =8;hwaParamCfg[paramsetIdx].accelModeArgs.cfarMode.cfarOsEdgeKScaleEn = 0;//obj->cfarAzimFFTCfg.cfarCfg.osEdgeKscaleEn; // }hwaParamCfg[paramsetIdx].source.srcAddr = DPU_DOPPLERHWADDMA_ADDR_SUMTX_PING_OUT + obj->numDopplerBins * obj->dopplerDemodCfg.DDMAMetricIOCfg.output.bytesPerSample;//后面可以优化hwaParamCfg[paramsetIdx].source.srcAcnt = obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal - 1+ 2 * cfarAvgRight + cfarGuardCells+ 2 * cfarAvgLeft + cfarGuardCells;hwaParamCfg[paramsetIdx].source.srcAIdx = obj->dopplerDemodCfg.sumTxIOCfg.output.bytesPerSample;//obj->cfarAzimFFTCfg.numAzimFFTBins * obj->cfarAzimFFTCfg.cfarIOCfg.input.bytesPerSample;hwaParamCfg[paramsetIdx].source.srcBIdx = 0;hwaParamCfg[paramsetIdx].source.srcBcnt = 1-1;hwaParamCfg[paramsetIdx].source.srcRealComplex = HWA_SAMPLES_FORMAT_REAL;hwaParamCfg[paramsetIdx].source.srcScale = 8;hwaParamCfg[paramsetIdx].source.srcWidth = HWA_SAMPLES_WIDTH_16BIT;hwaParamCfg[paramsetIdx].source.srcSign = HWA_SAMPLES_UNSIGNED;hwaParamCfg[paramsetIdx].source.srcConjugate = 0;hwaParamCfg[paramsetIdx].source.srcAcircShift = (obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal)- (2 * cfarAvgRight + cfarGuardCells);if ((obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal) % 3 == 0){ /* If numSamples % 3 == 0 */hwaParamCfg[paramsetIdx].source.srcCircShiftWrap3 = 1; /* 'b001, means wrap in A dim */hwaParamCfg[paramsetIdx].source.srcAcircShiftWrap = mathUtils_ceilLog2((obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal) / 3);}else{hwaParamCfg[paramsetIdx].source.srcCircShiftWrap3 = 0;hwaParamCfg[paramsetIdx].source.srcAcircShiftWrap = mathUtils_ceilLog2(obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal);}/* DEST CONFIG */hwaParamCfg[paramsetIdx].dest.dstAddr = HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(obj->hwaMemBankAddr[5]);hwaParamCfg[paramsetIdx].dest.dstAcnt = cfg->hwRes.maxCfarPeaksToDetect - 1;hwaParamCfg[paramsetIdx].dest.dstAIdx = 8;//obj->cfarAzimFFTCfg.cfarIOCfg.output.bytesPerSample; sizeof(cmplx32ImRe_t)hwaParamCfg[paramsetIdx].dest.dstBIdx = (obj->numDopplerBins / obj->dopplerDemodCfg.numBandsTotal) * 8;hwaParamCfg[paramsetIdx].dest.dstRealComplex = HWA_SAMPLES_FORMAT_COMPLEX;hwaParamCfg[paramsetIdx].dest.dstWidth = HWA_SAMPLES_WIDTH_32BIT;hwaParamCfg[paramsetIdx].dest.dstSign =0;// unsignedhwaParamCfg[paramsetIdx].dest.dstConjugate = HWA_FEATURE_BIT_DISABLE;hwaParamCfg[paramsetIdx].dest.dstScale = 8;hwaParamCfg[paramsetIdx].dest.dstSkipInit = 0;errCode = HWA_configParamSet(obj->hwaHandle,hwParamsetIdx,&hwaParamCfg[paramsetIdx],NULL);if (errCode != 0){goto exit;}// errCode = HWA_getDMAChanIndex(obj->hwaHandle, cfg->hwRes.edmaCfg.azimCfarEdmaCfg.edmaCfarOut.pingPong[PING].channel, &destChan);errCode = HWA_getDMAChanIndex(obj->hwaHandle, cfg->hwRes.edmaCfg.dopplerEdmaCfg.edmaSumLogAbsOut.pingPong[PING].channel, &destChan); //SumTx result;if (errCode != 0){goto exit;}/* enable the DMA hookup to this paramset so that data gets copied out */paramISRConfig.interruptTypeFlag = HWA_PARAMDONE_INTERRUPT_TYPE_DMA;paramISRConfig.dma.dstChannel = destChan;errCode = HWA_enableParamSetInterrupt(obj->hwaHandle, hwParamsetIdx, ¶mISRConfig);if (errCode != 0){goto exit;} }} #endif
谢谢
Gary Lu:
您好,
1. 参数设置错误:您已经提到了调整了参数DOPPLERPROCHWA_DDMA_DOPPLER_NUM_HWA_PARAMSETS和obj->dopplerAzimHwaCommonConfig.paramStopIdx。请确保您对所有相关参数进行了正确的设置,包括CFAR的参数和相应的内存配置。检查这些参数是否正确设置。
2. 内存访问冲突:当您将原来的操作放到CFAR后时,可能会导致内存访问冲突。请确保您在进行CFAR操作时没有修改sumTx的输出内存。如果在CFAR操作过程中需要访问sumTx的输出,请确保使用正确的同步机制(例如互斥锁)来避免冲突。
3. 资源不足:添加CFAR操作后,可能会导致资源不足的问题。请确保您的系统有足够的资源(例如内存、计算能力等)来支持同时进行sumTx和CFAR操作。如果资源不足,您可能需要重新评估您的系统配置或优化您的算法。