RF4CE Beekit issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RF4CE Beekit issue

565 Views
mlopez
Contributor III

Hi,

We are developing a product with protocol stack RF4CE, MC1323X and Beekit.

In the reference code produced by Beekit I`ve found an issue that I don`t know how to resolve.

In  the App_HandleNldeEvent() function:

/*****************************************************************************

*  App_HandleNldeEvent

*

*  Handles messages received on the NLDE SAP

*

*****************************************************************************/

static void* App_HandleNldeEvent(void)

{

  void *pMsgIn;

  /* Try to get the first message in the Nlde message queue */

  pMsgIn = MSG_DeQueue(&mNldeAppInputQueue);       

  if((pMsgIn) && (appStateMachine.state == gAppStateIdle_c))

  {

    /* Handle the message in Idle state */

    App_HandleNldeMessage((nwkNldeToAppMsg_t*)pMsgIn);

    MSG_Free(pMsgIn);

    pMsgIn = NULL;

  }

  return pMsgIn;

}

You take out the message from the Queue, but if the appStateMachine is not idle (for example when you are sending data) you simply throw away the message and lost it.

We can't lost packets in my application.

I`ve tried to change this code but in every intent the communications fail.

If I don`t test the idle state and process the message anyway, it fails.

If I don`t DeQueue the message if appStateMachine is not idle, also fails.

What could I do?

Thanks in advance,

Miguel Angel

Labels (1)
  • RF

0 Kudos
2 Replies

352 Views
Wlodek_D_
Senior Contributor II

Hello mlopez,

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Wlodek_D.

0 Kudos

352 Views
mlopez
Contributor III

Hi,

The issue is not resolved yet.

For further information:

I found that there is two kind of data messages that goes through the NLDE queue:

  1. the data frames (gNwkNldeDataInd_c)
  2. the ACK answers (gNwkNldeDataCnf_c) to a NLDE_DataRequest() or NLME_StartRequest or NLME_UnpairRequest() commands.

The data frames are processed with the App_HandleNldeMessage() function.

If it is an ACK answer, the App_HandleNldeEvent() dequeue the message that it is processed later by the App_DataState() or App_StartState() or App_UnpairState() functions. When the appStateMachine.state is idle, we could be waiting for an ACK answer. If you don't dequeue the message, you will never receive the ACK.

The bug: while we are sending requests to the zigbee stack we put the appStateMachine.state out of idle. During that time, all received data packets will be lost. This time could be long because we change the appStateMachine.state when we launch the TS_SendEvent().

We have tried one solution but doesn't work:

We are using the latest version of the Beekit library: BeeStack Consumer codebase version 1.7.2

We've only changed the Target code for the test.

We have changed App_HandleNldeEvent() to:

static void* App_HandleNldeEvent(void)

{

  void *pMsgIn;

  /* Try to get the first message in the Nlde message queue */

  pMsgIn = MSG_DeQueue(&mNldeAppInputQueue);

  if(pMsgIn)

  {

    /* Handle the message in Idle state */

App_HandleNldeMessage((nwkNldeToAppMsg_t*)pMsgIn);

  }

  return pMsgIn;

}

And App_HandleNldeMessage() to:

static void App_HandleNldeMessage(nwkNldeToAppMsg_t* pMsgIn) {

switch(pMsgIn->msgType)

  {

    /* Data indication received */

    case gNwkNldeDataInd_c:

App_HandleDataInd(&pMsgIn->msgData.nwkNldeDataInd);

      MSG_Free(pMsgIn);

      pMsgIn = NULL;

      break;

   

    default:

      break;       

  }

}

If the NLDE message is a data frame (gNwkNldeDataInd_c), we process it and free pMsgIN, even if appStateMachine.state is not idle (I think that should work).

If the NLDE message is an ACK (gNwkNldeDataCnf_c), we dequeue it an pass it to the other functions.

That works for about 10 seconds and then the App_MainTask() is not called anymore.

We don't understand by.

If we made the change in the Controller, it works without problem.

Regards

0 Kudos