Part Number: CC2650EM-7ID-RD
Other Parts Discussed in Thread: CC2650
i have CC2650 setup as ZNP, but after receiving around ~200 Async Requests from the host, it fails at ICall_primAllocMsg() with return ICALL_ERRNO_NO_RESOURCE.
I have registered incoming Rx event App Callback function from the host as Intercept
NPITask_registerIncomingRXEventAppCB(SensorTagApp_NPITask_RxCB, INTERCEPT);
Inside the SensorTagApp_NPITask_RxCB(uint8_t *pMsg), i free the npi msg frame.
Inside the
void SensorTagApp_NPITask_RxCB(uint8_t *pMsg)
{
uint8_t *pStartRxMsg;
pStartRxMsg = pMsg;
uint8_t datalen = *pMsg++; //LEN
uint8_t cmd0 = *pMsg++; //CMD0
uint8_t cmd1 = *pMsg++; //CMD1
/* // Some Msg Processing and App Logic
......
......
......
*/
// At the end free the npi_frame msg
ICall_freeMsg(pStartRxMsg);
}
Now inside the NPITask_processRXQ() in Components/npi/npi_task.c , its mentioned not to free the npi Msg container since it will be done in the stack, but since i'm intercepting the RX event to the app and not redirecting to stack, so shouldn't recPtr->npiMsg be freed. Is this causing the Memory leak?
// -----------------------------------------------------------------------------
//! \brief Dequeue next message in the RX Queue and process it.
//!
//! \return void
// -----------------------------------------------------------------------------
static void NPITask_processRXQ(void)
{
NPI_QueueRec *recPtr = NULL;
recPtr = Queue_dequeue(npiRxQueue);
if (recPtr != NULL)
{
if (incomingRXEventAppCBFunc != NULL)
{
switch (incomingRXReroute)
{
case ECHO:
{
// send to stack and a copy to the application
NPITask_sendBufToStack(npiAppEntityID, recPtr->npiMsg);
incomingRXEventAppCBFunc(recPtr->npiMsg->pBuf);
break;
}
case INTERCEPT:
{
// send a copy only to the application
incomingRXEventAppCBFunc(recPtr->npiMsg->pBuf);
break;
}
case NONE:
{
NPITask_sendBufToStack(npiAppEntityID, recPtr->npiMsg);
break;
}
}
}
else
{
// send to stack and a copy to the application
NPITask_sendBufToStack(npiAppEntityID, recPtr->npiMsg);
}
//free the Queue record
ICall_free(recPtr);
// DON'T free the referenced npiMsg container. This will be free'd in the stack task.
}
}