AnsweredAssumed Answered

Problem with JN5168 when Continuous sending datas

Question asked by Terry Si on Jun 15, 2017

I start my project with JN-AN-1184, the hardware consist with an coordinator which is used to receive datas and an enddevice which is used to send datas periodically. I use ZPS_eAplAfUnicastDataReq() to send data (string), everything seems ok with the first tow datas, but the coordinator can't receive any data after that while the debug message from the enddevice show show the data is sent successfully.And when enddevice sends the 8th data, the debug message show "No free MCPS request descriptor" error. Has anyone ever encountered this problem?

Here is my data-sending fuction:

PRIVATE void vStr_Send(uint8* content,uint8 lenth)
{
lenth--;
uint8 u8TransactionSequenceNumber;

PDUM_thAPduInstance hAPduInst = PDUM_hAPduAllocateAPduInstance(apduMyData);
uint16 u16Offset = 0;
uint16 i;

// Fill hAPDU payload
int _PDUM_STATE = PDUM_eAPduInstanceSetPayloadSize(hAPduInst, lenth);
if(_PDUM_STATE == 0)DBG_vPrintf(TRUE, "PDUM_OK\n");
else DBG_vPrintf(TRUE, "_PDUM_STATE %d\n",_PDUM_STATE);
for (i = 0; i < lenth; i++) {
u16Offset += PDUM_u16APduInstanceWriteNBO(hAPduInst, u16Offset,"b", *(content + i));
DBG_vPrintf(TRUE, "%c", *(content + i));
}
DBG_vPrintf(TRUE, "Size : %d\n Sending : \n", PDUM_u16APduInstanceGetPayloadSize(hAPduInst));

if (hAPduInst == PDUM_INVALID_HANDLE)
{
DBG_vPrintf(TRUE, "PDUM_INVALID_HANDLE\n");
} else {
ZPS_teStatus eStatus;
ZPS_teAplAfSecurityMode eSecurityMode = (ZPS_E_APL_AF_SECURE_NWK);

eStatus = ZPS_eAplAfUnicastDataReq( hAPduInst,
0x1234,
0x01,
0x01,
0x0000,//address to coordinator
eSecurityMode,
0,
&u8TransactionSequenceNumber
);
if(eStatus != ZPS_E_SUCCESS) DBG_vPrintf(TRUE, "ZPS_E_state %x\n",eStatus);
else if(eStatus == ZPS_E_SUCCESS)DBG_vPrintf(TRUE, "Send success\n");
//PDUM_eAPduFreeAPduInstance(hAPduInst);
}
}

Outcomes