This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello!
I'm working on hard-coded configuration of IWR6843ISK ODS sensor without using of CLI functions. I use ods_point_cloud_68xx_hwa lab as a reference project.
I have Init, mmwaveCtrl and DPM_Task. Instead of CLI_task, I have SensorConfig task.
In SensorConfig task I call MMWave_open and MMWave_config and after that I call dataPathConfig() function that should send DPC_OBJDET_IOCTL__STATIC_PRE_START_COMMON_CFG and DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG to the DPC.
DPC_OBJDET_IOCTL__STATIC_PRE_START_COMMON_CFG is done with no errors, but when I fill DPC_ObjectDetection_PreStartCfg structure with values based on profile_iwr6843_ods_3d.cfg from ods_point_cloud_68xx_hwa lab, and send DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG I get
ti.sysbios.heaps.HeapMem: line 259: assertion failure: A_zeroBlock: Cannot allocate size 0
I did compare content of DPC_ObjectDetection_PreStartCfg in my project and in ods_point_cloud_68xx_hwa in debug session, both structure are almost identical.
Can you please suggest the way to fix this issue?
Here is my code for dataPathConfig() function.
int32_t dataPathConfig (void){
DPC_ObjectDetection_PreStartCommonCfg preStartCommonCfg;
DPC_ObjectDetection_PreStartCfg preStartCfg;
DPC_ObjectDetection_StaticCfg staticCfg;
DPC_ObjectDetection_DynCfg dynCfg;
int32_t retVal, errCode;
// ---------- sending DPCpreStartCommonConfig
preStartCommonCfg.numSubFrames = 1;
preStartCommonCfg.antDef = antDef_IWR6843ODS;
errCode = DPM_ioctl(dpm, DPC_OBJDET_IOCTL__STATIC_PRE_START_COMMON_CFG,
&preStartCommonCfg, sizeof(DPC_ObjectDetection_PreStartCommonCfg));
if (errCode == 0) {
printf("DPM pre-start common cfg OK!!!\n");
} else {
printf("DPM pre-start common cfg error %d\n", errCode);
}
// ---------- filling and sending DPCpreStartConfig
preStartCfg.subFrameNum = 1;
// filling staticCfg
// ---------- ADCBuf data
staticCfg.ADCBufData.data = (void *) SOC_XWR68XX_MSS_ADCBUF_BASE_ADDRESS;
staticCfg.ADCBufData.dataProperty.adcBits = 2;
staticCfg.ADCBufData.dataProperty.dataFmt = DPIF_DATAFORMAT_COMPLEX16_IMRE;
staticCfg.ADCBufData.dataProperty.interleave = DPIF_RXCHAN_NON_INTERLEAVE_MODE;
staticCfg.ADCBufData.dataProperty.numAdcSamples = profileCfg.numAdcSamples;
staticCfg.ADCBufData.dataProperty.numChirpsPerChirpEvent = 1;
// -- antenna number and order, ADCBuf offsets
uint8_t numRxAntennas = 0U;
uint8_t channel;
int32_t rxChanOffsetIndx = 0;
uint16_t currentChanOffset = 0;
uint16_t numBytePerSample = 4U;
uint32_t chanDataSize = profileCfg.numAdcSamples * numBytePerSample;
chanDataSize = (chanDataSize + 15U) / 16U * 16U;
for (channel = 0U; channel < SYS_COMMON_NUM_RX_CHANNEL; channel++) {
if (openCfg.chCfg.rxChannelEn & (0x1U << channel)) {
staticCfg.rxAntOrder[numRxAntennas] = channel;
numRxAntennas++;
staticCfg.ADCBufData.dataProperty.rxChanOffset[rxChanOffsetIndx++] = currentChanOffset;
currentChanOffset += chanDataSize * staticCfg.ADCBufData.dataProperty.numChirpsPerChirpEvent;
} else {
staticCfg.rxAntOrder[channel] = 0U;
}
}
staticCfg.ADCBufData.dataProperty.numRxAntennas = numRxAntennas;
staticCfg.ADCBufData.dataSize = numRxAntennas * profileCfg.numAdcSamples * sizeof(cmplx16ImRe_t);
for (channel = 0U; channel < SYS_COMMON_NUM_TX_ANTENNAS; channel++) {
staticCfg.txAntOrder[channel] = mathUtils_floorLog2(chirpCfg[channel].txEnable);
}
//-------sending commands to в ADCBuf
uint32_t rxChanMask = 0xF;
retVal = ADCBuf_control(adcbufHandle, ADCBufMMWave_CMD_CHANNEL_DISABLE, (void *)&rxChanMask);
if (retVal < 0) {
printf("ADCBufMMWave_CMD_CHANNEL_DISABLE error\n");
} else {
printf("ADCBufMMWave_CMD_CHANNEL_DISABLE OK!\n");
}
ADCBuf_dataFormat dataFormat;
dataFormat.adcOutFormat = staticCfg.ADCBufData.dataProperty.dataFmt;
dataFormat.channelInterleave = staticCfg.ADCBufData.dataProperty.interleave;
dataFormat.sampleInterleave = 1;
retVal = ADCBuf_control(adcbufHandle, ADCBufMMWave_CMD_CONF_DATA_FORMAT, (void *) &dataFormat);
if (retVal < 0) {
printf("ADCBufMMWave_CMD_CONF_DATA_FORMAT error\n");
} else {
printf("ADCBufMMWave_CMD_CONF_DATA_FORMAT OK!\n");
}
ADCBuf_RxChanConf rxChanConf;
memset((void*)&rxChanConf, 0, sizeof(ADCBuf_RxChanConf));
for (channel = 0; channel < SYS_COMMON_NUM_RX_CHANNEL; channel++){
if(openCfg.chCfg.rxChannelEn & (0x1U << channel)){
rxChanConf.channel = channel;
retVal = ADCBuf_control(adcbufHandle, ADCBufMMWave_CMD_CHANNEL_ENABLE, (void *)&rxChanConf);
if (retVal < 0) {
printf("ADCBufMMWave_CMD_CHANNEL_ENABLE channel %d error\n", channel);
} else {
printf("ADCBufMMWave_CMD_CHANNEL_ENABLE OK!\n");
}
}
}
uint32_t chirpThresholdVal = staticCfg.ADCBufData.dataProperty.numChirpsPerChirpEvent; // привести к 4-байтной переменной
retVal = ADCBuf_control(adcbufHandle, ADCBufMMWave_CMD_SET_PING_CHIRP_THRESHHOLD, (void *)&chirpThresholdVal);
if (retVal < 0) {
printf("ADCBufMMWave_CMD_SET_PING_CHIRP_THRESHHOLD error\n");
} else {
printf("ADCBufMMWave_CMD_SET_PING_CHIRP_THRESHHOLD OK!\n");
}
retVal = ADCBuf_control(adcbufHandle, ADCBufMMWave_CMD_SET_PONG_CHIRP_THRESHHOLD, (void *)&chirpThresholdVal);
if (retVal < 0) {
printf("ADCBufMMWave_CMD_SET_PONG_CHIRP_THRESHHOLD error\n");
} else {
printf("ADCBufMMWave_CMD_SET_PONG_CHIRP_THRESHHOLD OK!\n");
}
//-------number of virtual antennas
uint32_t numTxAntAzim = 2; // azimTxAntMask = 0b101
uint32_t numTxAntElev = 1; // elevTxAntMask = 0b010
staticCfg.numVirtualAntAzim = numTxAntAzim * staticCfg.ADCBufData.dataProperty.numRxAntennas; // 2 * 4 = 8
staticCfg.numVirtualAntElev = numTxAntElev * staticCfg.ADCBufData.dataProperty.numRxAntennas; // 1 * 4 = 4
staticCfg.numVirtualAntennas = staticCfg.numVirtualAntAzim + staticCfg.numVirtualAntElev; // 8 + 4 = 12
//-------
int16_t frameTotalChirps = (ctrlCfg.u.frameCfg.frameCfg.chirpEndIdx - ctrlCfg.u.frameCfg.frameCfg.chirpStartIdx) + 1;
staticCfg.numChirpsPerFrame = frameTotalChirps * ctrlCfg.u.frameCfg.frameCfg.numLoops;
//-------
staticCfg.numRangeBins = mathUtils_pow2roundup(profileCfg.numAdcSamples);
staticCfg.rangeStep =
SPEED_OF_LIGHT_IN_METERS_PER_SEC *
profileCfg.digOutSampleRate * 1e3 /
(2 * profileCfg.freqSlopeConst * ((freqScaleFactor*1e3*900)/(1U << 26)) * 1e12 * staticCfg.numRangeBins);
//-------
staticCfg.numTxAntennas = 3;
staticCfg.numDopplerChirps = staticCfg.numChirpsPerFrame / staticCfg.numTxAntennas;
staticCfg.numDopplerBins = mathUtils_pow2roundup(staticCfg.numDopplerChirps);
staticCfg.dopplerStep = SPEED_OF_LIGHT_IN_METERS_PER_SEC /
(2.0 * profileCfg.startFreqConst/(1U << 26)*freqScaleFactor*1e9 *
(profileCfg.idleTimeConst+ profileCfg.rampEndTime)/1000.*10*1.e-6 *
staticCfg.numDopplerBins *
staticCfg.numTxAntennas);
//----
staticCfg.isValidProfileHasOneTxPerChirp = 1;
//---------------------- adding staticCfg
preStartCfg.staticCfg = staticCfg;
// filling dynCfg
//------ range CFAR
DPU_CFARCAProc_CfarCfg *cfarCfgRange = &dynCfg.cfarCfgRange;
cfarCfgRange->averageMode = 2; // CASO
cfarCfgRange->winLen = 8;
cfarCfgRange->guardLen = 4;
cfarCfgRange->noiseDivShift = 3;
cfarCfgRange->cyclicMode = 0;
cfarCfgRange->thresholdScale = convertCfarToLinear(15.0, 12); // 480.0 for 15.0 dB
cfarCfgRange->peakGroupingEn = 0;
//------ Doppler CFAR
DPU_CFARCAProc_CfarCfg *cfarCfgDoppler = &dynCfg.cfarCfgDoppler;
cfarCfgDoppler->averageMode = 0; // CA
cfarCfgDoppler->winLen = 4;
cfarCfgDoppler->guardLen = 2;
cfarCfgDoppler->noiseDivShift = 3;
cfarCfgDoppler->cyclicMode = 1;
cfarCfgDoppler->thresholdScale = convertCfarToLinear(15.0, staticCfg.numVirtualAntennas); // 480.0 for 15.0 dB
cfarCfgDoppler->peakGroupingEn = 0;
cfarCfgDoppler->peakGroupingScheme = 0;
//-------
DPU_AoAProc_MultiObjBeamFormingCfg *multiObjBeamFormingCfg = &dynCfg.multiObjBeamFormingCfg;
multiObjBeamFormingCfg->enabled = 1;
multiObjBeamFormingCfg->multiPeakThrsScal = 0.5;
//------ Calib DC Range Signature
DPU_RangeProc_CalibDcRangeSigCfg *calibDcRangeSigCfg = &dynCfg.calibDcRangeSigCfg;
calibDcRangeSigCfg->enabled = 0;
calibDcRangeSigCfg->negativeBinIdx = -5;
calibDcRangeSigCfg->positiveBinIdx = 8;
calibDcRangeSigCfg->numAvgChirps = 256;
//------- Clutter Removal
DPC_ObjectDetection_StaticClutterRemovalCfg_Base *staticClutterRemovalCfg = &dynCfg.staticClutterRemovalCfg;
staticClutterRemovalCfg->enabled = 0; // disable
//------
DPU_AoAProc_FovAoaCfg *fovAoaCfg = &dynCfg.fovAoaCfg;
fovAoaCfg->minAzimuthDeg = -90;
fovAoaCfg->maxAzimuthDeg = 90;
fovAoaCfg->minElevationDeg = -90;
fovAoaCfg->maxElevationDeg = 90;
//------
DPU_CFARCAProc_FovCfg *fovRange = &dynCfg.fovRange;
fovRange->min = 0.25;
fovRange->max = 15.0;
//------
DPU_CFARCAProc_FovCfg *fovDoppler = &dynCfg.fovDoppler;
fovDoppler->min = -13.39;
fovDoppler->max = 13.39;
//------ Extended Max Velocity
DPU_AoAProc_ExtendedMaxVelocityCfg *extMaxVelCfg = &dynCfg.extMaxVelCfg;
extMaxVelCfg->enabled = 0; // disable
//------
dynCfg.prepareRangeAzimuthHeatMap = 0;
preStartCfg.dynCfg = dynCfg;
errCode = DPM_ioctl(dpm, DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG,
&preStartCfg,
sizeof(DPC_ObjectDetection_PreStartCfg));
if (errCode == 0)
{
printf("DPM pre-start cfg OK!!!\n");
}
else
{
printf("DPM pre-start cfg error %d\n", errCode);
}
return 0;
}
I'm using mmwaveSDK 3.3.
__
Denis
Hi Denis,
I had provided you an alternate method to hard-code sensor configuration by modifying the cli lib, in response to your other thread. Please use that method. We do not have an example of hard-coding the config using the above approach at this time.
In general, regarding this exception or any debugging in general, it's very hard to comment on the cause of the exception just by looking at code. You will need to narrow it down by stepping into the code and localizing it to a function or line.
You will first need to compile the code to enable statement level stepping (debug). The default options in the project use -O3 optimization which does not allow statement level debug so please change it to level 1 ( in CCS after importing the project) as shown below, and rebuild the project.
Regards
-Nitin
Hello again, Nitin!
There is no optimization in my project (Optimization Level - off). And it is important for our project not to use any CLI functions (includeing modified CLI lib files).
Here is call stack when error occurs.
Apperently error happens in DPC_ObjDet_rangeConfig function, because staticCfg passed to this function has zeroes in all fields (including numTxAntennas, which makes hwRes->dcRangeSigMeanSize equal to 0 which then leads to MemoryP_ctrlAlloc error).
Here is DPC_ObjDet_rangeConfig call in debugger
That is strange because staticCfg does have correct fields when it's passed to DPC_ObjDet_preStartConfig.
Inside DPC_ObjDet_preStartConfig before DPC_ObjDet_rangeConfig call, staticCfg is assigned to corresponding field of SubFrameObj *obj. After this assignment all fields turned to 0. Here is right hand side (RHS) and left hand side (LHS) of this assignment
When I debug ods_point_cloud_68xx_hwa lab, at this line RHS and LHS of assignment are identical.
Pretty strange issue.
Please, let me know if i need to provide more info on the issue.
Thank you for your time.
__
Denis
Hi Denis,
Looking at the empty staticCfg structure, it appears that the parser function MmwDemo_RFParser_parseCtrlConfig is not called as the configuration structures are filled in this function. So please look at your initialization sequence to make sure that this is done.
However, as mentioned, we are not able to provide more support to this method at this time as we have not implemented this example.
Please use the CLI method in the meantime. I'm not sure why you cannot use it, but if you concern is that whether you need to have COM port brought out on your board (in case you are using a custom board), it does not require you to actually have or connect UART on your board since the commands are sent to the COM port on the device directly from the software.
Regards
-Nitin
Hello, Nitin
It was a strange issue and is resolved in even more strange way:
I just copied my project, removed several comments and the problem was gone - there is no error sending prestartConfig.
I added sensor start function which is almost exactly the same as in ods_point_cloud_68xx_hwa lab and it seems to be working fine, because I receive RL_RF_AE_FRAME_TRIGGER_RDY_SB message mmWave eventFxn function.
Anyway thank you for your support.
__
Denis
Hi Denis,
Thanks for the update. Please feel free to create a new thread for further support.
Regards
-Nitin