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.

Duplicate messages

I have a strange problem with two EPs talking to each other. First one sends a packet every second using SMPL_Send (SMPL_LINKID_USER_UUD, msg, 3);, but the scond one receives packet twice! The second EP is using the following " ... if (SMPL_Receive (SMPL_LINKID_USER_UUD, msg, &len) == SMPL_SUCCESS) ...".  FREQUENCY_AGILITY is NOT active. Any help would be appreciated. 

  • Hello.

    This is not a strange problem if you have an Access Point in the configuration. The Access Point will replay frames that are not destined for the NWK support on the AP or any peer running on the AP. That is, it acts like a Range Extender. If the two peers are on End Devices the AP will always replay the frames exchanged between the peers. This is why the sample code usually has a transaction ID byte in the application payload. It is used to filter duplicates.

    Note that the duplicate filtering scheme may not be foolproof. It is just a starting point. For exmaple, if the application does not use acks it is possible for one peer to miss the frame that has the wrapped TID -- when the TID wraps from 0xFF to 0x00. If this happens the example filtering will cause the receiving device to wait a long time until things get back into sync which can only happen when the receiving device does in fact receive the "wrapped" TID frame. This can be avoided for exmaple by using acks (ineffecient) or using a 16-bit (or larger) TID which, while it still suffers the same weakness as the single byte TID, is a lot less likely to do so due to the size of the TID field.

    Hope this helps.

    lfriedman

     

  • Thanks. You are absolutely right, I do have AP in the network. Is it any way to disable that behaviour? It is doubling the traffic in the network making it almost unusable for my application.

  • There are a number of alternatives.

    First (easiest) if one of the End Devices can be always-powered then you can run that peer on the Access Point platform. As noted previously the AP will not replay frames that are destined for a peer running on its platform.

    Second possibilty is to assess the requirement for the AP. Whether an AP is required depends on infrastrcurure requirements and topology. For example, if you are using the AP to control network access by using unique join or link tokens than you need toe AP. If you are supporting a polling device or using Frequency Agility than you need an AP. If you need the Range Extension functionality (apparently not in your case) than you need an AP. But if you are not doing any of these then you do not need the AP.

    A third, less desireable method is to neutralize the replay function. This would require simple modification of the NWK code. But if you do this you disable the function in all cases. There is no disciplined way at this time to disable the replay function other than code modification.

    Hope this helps.

    lfriedman

     

  • But wait...there's more!

     

    I just noticed that you are using the UUD capablity based on your original post. (I should have paid more attention originally -- sorry.) In this case even if the peer is running on your AP platform the AP will still replay the frame. This is beause the UUD frames are broadcast. The who;e point of those is that the peer relationships are not connection-based. It's kind of a back door scheme to communicate among devices when there may be a huge number of peer relationshiops -- you don't need explicit connection between each possible peer. See the 'Cascading End Device' example. But the price paid is that these fremas are always broadcast and when the AP sees a frame sent to the UUD port it will by defualt replay it. So, this eliminates the first (easiest) alternative unless you establish an explicit connection between the peers which is the recommended approach. It depends on your requirements and what the goal of the scenario is.

    lfriedman

     

  • lfriedman2999 said:
    For exmaple, if the application does not use acks it is possible for one peer to miss the frame that has the wrapped TID -- when the TID wraps from 0xFF to 0x00.

    This can be avoided for exmaple by using acks (ineffecient) or using a 16-bit (or larger) TID

    Instead of having a special case for wraparound, just take advantage of the way subtraction wraps around for unsigned integers:

    https://en.wikipedia.org/wiki/Serial_number_arithmetic