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.

AWR2944EVM: MSS fails (likely) on reading from shared HSRAM

Part Number: AWR2944EVM


Tool/software:

I am adding custom processing to the AWR2944EVM's DDM demo. Ultimately an STFT (Short Time FFT) for classification data is to be added, but for starters I write in objectdetection.c a single byte to memory and try to transport it up to the PC via UART.

The transport up the DPM to dss_main.c is successful as I have observed in the debugger and test_printed in debug mode. But after writing my data to the shared memory in dss_main.c when I try to read these data in mss_main.c it fails with the following error (note both dss and mss test print 83 which is what I write to memory in objectdetection.c - 83 in ASCI is 'S' just like STFT):

Starting Sensor (issuing MMWave_start)
[C66xx_DSP] DEBUG: STFT payload[0] on DSS = 0x53 (83)
[Cortex_R5_0] DEBUG: STFT payload[0] on MSS = 0x53 (83)
[C66xx_DSP] DEBUG: STFT payload[0] on DSS = 0x53 (83)
[Cortex_R5_0] DEBUG: STFT payload[0] on MSS = 0x53 (83)
UART processing not completed: numObjOut 37 Time 207
ASSERT: 20.910911s: ../mss/mss_main.c:MmwDemo_DPC_ObjectDetection_reportFxn:2738: 0 failed !!!


Line 2738 is the else statement which is executed if this is false: gMmwMssMCB.stats.isLastFrameDataProcessed this suggests to me that something is wrong with synchronization of the messages or perhaps the reading of my data, though interestingly both the MSS and DSS see my written data properly.

So I am asking myself the following and it would be great if you could help me with the these questions:

  1. What is the proper way for copying the DPM results into the shared HSRAM am I missing something, like a cache invalidation etc. in my sketch?
  2. What is the proper way of reading these data on the MSS side?
  3. I understand that the payload "object" within MmWDemo_HSRAM struct is used by the default demo. What method do you recommend to transport custom data up to the MSS?

All help is appreciated,

Regards

Mark

To give you more context the modification that I have made are as follows:

  • On the MSS side the only modification that I have added is in MmwDemo_transmitProcessedOutput, when this is commented out the demo works:

////////////////////////////////////////////////////////////////////////
/////////////////////// STFT data translation //////////////////////////
////////////////////////////////////////////////////////////////////////
stftBusPtr = gMmwMssMCB.ptrResult.ptrBuffer[2];
if(stftBusPtr != NULL)
{
//stftSize = gMmwMssMCB.ptrResult.size[2];
stftLocalPtr = (uint8_t *) AddrTranslateP_getLocalAddr((uint32_t) stftBusPtr);

//Test print what we have read and check if it is hex=0x53 and decimal=83
uint8_t firstByte = stftLocalPtr[0];
test_print("DEBUG: STFT payload[0] on MSS = 0x%02X (%u), Length = %u bytes\n", firstByte, firstByte, tl[tlvIdx].length);
}
///////////////////////// End of data translation //////////////////////

  • On the dss side I have added a custom function and made modifications to the dpmTask:

static int32_t MmwDemo_copySTFTToHSRAM(MmwDemo_HSRAM *ptrHsramBuffer, const void *buf, uint32_t numBytes)
{
uint8_t *ptrCurr;
uint32_t freeBytes;

if ((ptrHsramBuffer == NULL) || (buf == NULL))
{
return -1;
}

//ptrCurr is where in the HSRAM we will write to,
//payload is an unused slot within MmwDemo_HSRAM struct designed for additional data
ptrCurr = ptrHsramBuffer->payload;
freeBytes = MMWDEMO_HSRAM_PAYLOAD_SIZE;
if (numBytes > freeBytes)
{
return -1;
}

// Copy STFT data into the very start of payload[]
memcpy(ptrCurr, buf, numBytes);

// return how many bytes remain free
return (int32_t)(freeBytes - numBytes);
}

Within the dpmTask


if ((retVal = MmwDemo_copyResultToHSRAM(&gHSRAM, result, &gMmwDssMCB.dataPathObj.subFrameStats[result->subFrameIdx])) >= 0)
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Write STFT results to shared HSRAM ////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Copy STFT results to HSRAM
retVal = MmwDemo_copySTFTToHSRAM(&gHSRAM, resultBuffer.ptrBuffer[2], resultBuffer.size[2]);
gHSRAM.outStats.interFrameProcessingMargin -= ((CycleCounterP_getCount32() - startTime)/DSP_CLOCK_MHZ);
if (retVal < 0)
{
test_print("Error: STFT -> HSRAM failed [Error: %d]\n", retVal);
MmwDemo_debugAssert(0);
}

uint8_t first = ((uint8_t*)gHSRAM.payload)[0];
test_print("DEBUG: STFT payload[0] on DSS = 0x%02X (%u)\n", first, first);

//Reassign DPM slot 2 to the new address of the STFT payload in HSRAM,
//The size is as it was, thus there is no need to update it (just as in the original code above)
resultBuffer.ptrBuffer[2] = (uint8_t *)&gHSRAM.payload;

//End of modification: Send all three buffers, this stays as it was
//////////////////////////////////////////////////////////////////////////////////////////////////////

// Update DPM buffer
resultBuffer.ptrBuffer[0] = (uint8_t *)&gHSRAM.result;
resultBuffer.ptrBuffer[1] = (uint8_t *)&gHSRAM.outStats;
resultBuffer.size[1] = sizeof(MmwDemo_output_message_stats);

/* YES: Results are available send them. */
retVal = DPM_sendResult (gMmwDssMCB.dataPathObj.objDetDpmHandle, true, &resultBuffer);
if (retVal < 0)
{
test_print ("Error: Failed to send results [Error: %d] to remote\n", retVal);
}
}

  • Hi Mark,

    Enabling print statements will increase the time taken to execute a particular set of instructions. If you want to add print statements, increase the frame periodicity.

    I see that you just want to check if the correct value is written to some address. In that case, you can just add an if condition to compare the results and eliminate printing them.

    Regards,

    Samhitha

  • Hi I have set now the interfarme time up to 1000ms, this resolved my issue.

    Though I have one more question concerning the proper transfer of custom data from the DSS to the MSS via HSRAM. Right now I write my single byte to ptrHsramBuffer->payload which from what I see is already used, though there seems to be a lot of freespace?

    Can you please recommend the best approach for moving custom data between DSS and MSS? I was thinking about two options
    1.) Adding a dedicated STFT payload to the HSRAM struct
    2.) Saving STFT results at the end of the current payload object within the HSRAM struct - which I currently do

    The first option seems cleaner but I fear that modifying this struct could impact the existing upstream code on the mss side.

    I appreciate your expert insight
    Best regards
    Mark

  • Hi Mark,

    I suggest you to update DPC_ObjectDetection_ExecuteResult structure which has pointers to data needed by MSS. You can add another field in the structure as per your requirement.

    Regards,

    Samhitha