Kurt Smith

MC1312x SRB stops receiving data

Discussion created by Kurt Smith on Mar 9, 2008
Latest reply on Mar 10, 2008 by Kurt Smith
    I'm working on a simple two-node network (1 SRB, 1 NCB), and today we came close to a working solution but ran into a problem.  After successfully receiving approximately 5 messages from the NCB, the SRB will no longer receive or transmit messages.  The problem consistenly occurs after the receiving between 4 and 6 messages.  Our codebase is Beestack and our solution is a lightly modified version of the Beestack Generic App.  Can anyone suggest possible problems?  It seems like the device is running out of message buffers, but we call MSG_Free() at the end of the data indication.  Resetting the device allows it to receive messages again, but of course it stops receiving (and will no longer transmit) after the 5th message. The code for BeeAppDataIndication() is shown below.

void BeeAppDataIndication(void){  apsdeToAfMessage_t *pMsg;  zbApsdeDataIndication_t *pIndication;  uint8_t myAuthCode;  while(MSG_Pending(&gAppDataIndicationQueue))  {    /* Get a message from a queue */    pMsg = MSG_DeQueue( &gAppDataIndicationQueue );    /* ask ZCL to handle the frame */    pIndication = &(pMsg->msgData.dataIndication);    /*      Note: if multiple endpoints are supported by this app, insert       endpoint filtering here...      This app assumes only 1 active endpoint. APS layer has already      filtered by endpoint and profile.      Note: all multi-byte over-the-air fields are little endian.      That is 0x1101 would come in byte order 0x01 0x11.    */    /* is the cluster for accelerometer— */    if(pIndication->aClusterId[1] != appDataCluster[1]) {      MSG_Free(pMsg); /* no, free it and we're done */      continue;    }    /* handle the command */        if(pIndication->aClusterId[0] == appDataCluster[0])     {            //turn on LED2      LED_SetLed(LED2, gLedOn_c);          // create packet and send to computer terminal for testing purposes      (void) UartX_Transmit(pIndication->pAsdu, pIndication->asduLength, NULL);                //myAuthCode = *pIndication->pAsdu;      FLib_MemCpy(&myAuthCode, pIndication->pAsdu, pIndication->asduLength);                  if (myAuthCode == 'G')       grantAccess();            else if (myAuthCode == 'D')      denyAccess();           }    /* Free memory allocated by data indication */    MSG_Free(pMsg);  }}


Message Edited by wareagle on 2008-03-09 03:41 AM