工程师你好,
我将pa_18xx_dss的EDMA初始化以及配置程序复制到高精度液位测量的程序下,代替原来的EDMA程序;
但是程序运行到EDMA_startDmaTransfer(obj->edmaHandle[EDMA_INSTANCE_A],
MMW_EDMA_CH_1D_IN_PING);出现错误;
错误提示如下:
[Cortex_R4_0] xdc.runtime.Main: "../APP/mss_main.c", line 795: assertion failure
xdc.runtime.Error.raise: terminating execution
[C674X_0] {module#38}: line 99: error {id:0x10000, args:[0x20034afd, 0x20034afc]}
xdc.runtime.Error.raise: terminating execution
为了说明我程序的正确性,我将附EDMA的相关程序;
int32_t MmwDemo_dataPathInitEdma(MmwDemo_DSS_DataPathObj *obj)
{
uint8_t numInstances;
int32_t errorCode;
EDMA_Handle handle;
EDMA_errorConfig_t errorConfig;
uint32_t instanceId;
EDMA_instanceInfo_t instanceInfo;
numInstances = EDMA_getNumInstances();
/* Initialize the edma instance to be tested */
for (instanceId = 0; instanceId < numInstances; instanceId++)
{
EDMA_init(instanceId);
handle = EDMA_open(instanceId, &errorCode, &instanceInfo);
if (handle == NULL)
{
// System_printf("Error: Unable to open the edma Instance, erorCode = %d\n", errorCode);
return -1;
}
obj->edmaHandle[instanceId] = handle;
errorConfig.isConfigAllEventQueues = true;
errorConfig.isConfigAllTransferControllers = true;
errorConfig.isEventQueueThresholdingEnabled = true;
errorConfig.eventQueueThreshold = EDMA_EVENT_QUEUE_THRESHOLD_MAX;
errorConfig.isEnableAllTransferControllerErrors = true;
errorConfig.callbackFxn = MmwDemo_edmaErrorCallbackFxn;
errorConfig.transferControllerCallbackFxn = MmwDemo_edmaTransferControllerErrorCallbackFxn;
if ((errorCode = EDMA_configErrorMonitoring(handle, &errorConfig)) != EDMA_NO_ERROR)
{
// System_printf("Debug: EDMA_configErrorMonitoring() failed with errorCode = %d\n", errorCode);
return -1;
}
}
return 0;
}
int32_t MmwDemo_dataPathConfigEdma(MmwDemo_DSS_DataPathObj *obj)
{
uint16_t shadowParam = EDMA_NUM_DMA_CHANNELS;
int32_t retVal = 0;
uint32_t numChirpTypes = 1;
uint32_t ADCBufferoffset = (32 * 1024)/4;
numChirpTypes = 1;
/*****************************************************
* EDMA configuration for getting ADC data from ADC buffer
* to L2 (prior to 1D FFT)
* For ADC Buffer to L2 use EDMA-A TPTC =1
*****************************************************/
/* Ping - copies chirp samples from even antenna numbers (e.g. RxAnt0 and RxAnt2) */
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(&obj->ADCdataBuf[0]),
(uint8_t *)(SOC_translateAddress((uint32_t)&obj->adcDataIn[0], SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_1D_IN_PING,
false,
shadowParam++,
obj->numAdcSamples * BYTES_PER_SAMP_1D,
MAX(obj->numRxAntennas / 2, 1),
ADCBufferoffset * 2,
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/* Pong - copies chirp samples from odd antenna numbers (e.g. RxAnt1 and RxAnt3)
* Note that ADCBufferoffset is in bytes, but ADCdataBuf is in cmplx16ReIm_t.
* There are four bytes in one cmplx16ReIm_t*/
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(&obj->ADCdataBuf[(ADCBufferoffset>>2)]),
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->adcDataIn[obj->numRangeBins]), SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_1D_IN_PONG,
false,
shadowParam++,
obj->numAdcSamples * BYTES_PER_SAMP_1D,
MAX(obj->numRxAntennas / 2, 1),
ADCBufferoffset * 2,
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/*
* EDMA configuration for storing 1d fft output in transposed manner to L3.
* It copies all Rx antennas of the chirp per trigger event.
*/
/* Ping - Copies from ping FFT output (even chirp indices) to L3 */
retVal =
EDMAutil_configType2a(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->fftOut1D[0]), SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
(uint8_t *)(&obj->radarCube[0]),
MRR_SF0_EDMA_CH_1D_OUT_PING,
false,
shadowParam++,
BYTES_PER_SAMP_1D,
obj->numRangeBins,
obj->numTxAntennas * numChirpTypes,
obj->numRxAntennas,
obj->numDopplerBins,
1,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/* Ping - Copies from pong FFT output (odd chirp indices) to L3 */
retVal =
EDMAutil_configType2a(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->fftOut1D[obj->numRxAntennas * obj->numRangeBins]),
SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
(uint8_t *)(&obj->radarCube[0]),
MRR_SF0_EDMA_CH_1D_OUT_PONG,
false,
shadowParam++,
BYTES_PER_SAMP_1D,
obj->numRangeBins,
obj->numTxAntennas * numChirpTypes,
obj->numRxAntennas,
obj->numDopplerBins,
1,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/*****************************************
* Interframe processing related EDMA configuration
*****************************************/
/* For the max-vel enh implementation, we pull out twice as much range-gates per range bin.
* Hence EDMA BCNT is multiplied by 2. */
/* Ping: This DMA channel is programmed to fetch the 1D FFT data from radarCube
* matrix in L3 mem of even antenna rows into the Ping Buffer in L2 mem*/
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(&obj->radarCube[0]),
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->dstPingPong[0]), SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_2D_IN_PING,
false,
shadowParam++,
obj->numDopplerBins * BYTES_PER_SAMP_1D,
(obj->numRangeBins * obj->numRxAntennas * obj->numTxAntennas * numChirpTypes) / 2,
obj->numDopplerBins * BYTES_PER_SAMP_1D * 2,
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/* Pong: This DMA channel is programmed to fetch the 1D FFT data from radarCube
* matrix in L3 mem of odd antenna rows into thePong Buffer in L2 mem*/
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)(&obj->radarCube[obj->numDopplerBins]),
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->dstPingPong[obj->numDopplerBins]),
SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_2D_IN_PONG,
false,
shadowParam++,
obj->numDopplerBins * BYTES_PER_SAMP_1D,
(obj->numRangeBins * obj->numRxAntennas * obj->numTxAntennas * numChirpTypes) / 2,
obj->numDopplerBins * BYTES_PER_SAMP_1D * 2,
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/* This EDMA Channel brings selected range bins from detection matrix in
* L3 mem (reading in transposed manner) into L2 mem for CFAR detection (in
* range direction). */
retVal =
EDMAutil_configType3(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)0,
(uint8_t *)0,
MRR_SF0_EDMA_CH_DET_MATRIX2,
false,
shadowParam++,
BYTES_PER_SAMP_DET, \
obj->numRangeBins,
(obj->numDopplerBins * BYTES_PER_SAMP_DET),
BYTES_PER_SAMP_DET,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/*********************************************************
* These EDMA Channels are for Azimuth calculation. They bring
* 1D FFT data for 2D DFT and Azimuth FFT calculation.
********************************************************/
/* Ping: This DMA channel is programmed to fetch the 1D FFT data from radarCube
* matrix in L3 mem of even antenna rows into the Ping Buffer in L2 mem.
*/
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)NULL,
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->dstPingPong[0]), SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_3D_IN_PING,
false,
shadowParam++,
obj->numDopplerBins * BYTES_PER_SAMP_1D,
MAX((obj->numRxAntennas * obj->numTxAntennas) / 2, 1),
(obj->numDopplerBins * BYTES_PER_SAMP_1D * 2),
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
/* Pong: This DMA channel is programmed to fetch the 1D FFT data from radarCube
* matrix in L3 mem of odd antenna rows into the Pong Buffer in L2 mem*/
retVal =
EDMAutil_configType1(obj->edmaHandle[EDMA_INSTANCE_A],
(uint8_t *)NULL,
(uint8_t *)(SOC_translateAddress((uint32_t)(&obj->dstPingPong[obj->numDopplerBins]), SOC_TranslateAddr_Dir_TO_EDMA, NULL)),
MRR_SF0_EDMA_CH_3D_IN_PONG,
false,
shadowParam++,
obj->numDopplerBins * BYTES_PER_SAMP_1D,
MAX((obj->numRxAntennas * obj->numTxAntennas) / 2, 1),
obj->numDopplerBins * BYTES_PER_SAMP_1D * 2,
0,
0,
NULL,
(uintptr_t)obj);
if (retVal < 0)
{
return -1;
}
return(0);
}