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.

Inter-PAN Transmission between ZR and ZC

I use two projects: zr_sw and zc_light and the guide

dev.ti.com/.../z-stack-overview.html

I added sending Inter-PAN messages on the ZR side and I see that it works with the sniffer.

But what should I do on the ZC side to receive the Inter-PAN messages?

I added the INTER_PAN define in the predefined symbols of the zc_light project and tried to set some breakpoints where I found the APS_INCOMING_MSG (zcl.c, zd_app.c, zstacktask.c) but no one of them is triggered. Note: I didn't start comissioning, both devices (zr and zc were erased).

  • Hi,

    Can you share the sniffer log ?
    Might be useful for us to see the contents of it.

    Have you tried commissioning the device ?
    It looks like the device will need a valid short address before it's handled :

    In <zr_*>/Stack/zmac/zmac_cb.c  --   MAC_CbackEvent :

      if ( event == MAC_MCPS_DATA_IND )
      {
    
    // ...
    
        MAP_MAC_MlmeGetReq( MAC_SHORT_ADDRESS, &tmp );
        if ( (tmp == INVALID_NODE_ADDR) ||
             (tmp == NWK_BROADCAST_SHORTADDR_DEVALL) ||
    
    // ...
    
             (pData->dataInd.msdu.len == 0) )
        {
          MAP_mac_msg_deallocate( (uint8_t **)&pData );
          return;
        }

    Regards,
    Toby

  • I've imported clean ZR and ZC projects from the latest SDK and tested everything again (without commissioning).

    I send Inter-PAN message from ZR, I see the message in the sniffer and now I have the triggered breakpoint on the ZC side:

    MAP_mac_msg_deallocate()

    as in the snipped code you have sent before.

    So looks like the Interpan message is delivered.

    How should I handle the message on the high level now? I want to get access to the payload of a received InterPan message.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/158/interpan_5F00_zr_5F00_to_5F00_zc_5F00_without_5F00_comissioning.pcapng.7z

  • Thanks for the update.

    Just to note, inter-pan is non-secure and is targeted for touchlink use cases; perhaps refer to how it is used in touchlink_target_app.c (or touchlink_initiator_app.c).

    Can you share details on what you'd be using inter-pan for, if not touchlink ?

  • I know that it is non-secure, but we can encrypt payload, so it is not a question. The main purpose of using Inter-PAN messages is transmission our manufacturer data between two coordinators. Now I'm testing Inter-PAN for different configurations of ZED,ZR,ZC.

    I found another issue. If I send an Inter-PAN message from a ZC that hasn't been commissioned before (after chip erasing and programming a new firmware) and then start commissioning, it gets stuck in Main_assertHandler() with assertReason=3.

    If I reset ZC, don't send Inter-PAN and start commissioning, it works. But if I reset ZC, start inter-PAN first, then start commissioning, it doesn't work.

    There is a piece of code that starts Inter-PAN transmission:

    Why does it happen and how could it be fixed?

  • I fixed the issue I've talked about in my previous post. Maybe it would be interesting for you.

    If you call StubAPS_SetIntraPanChannel() after Inter-PAN transmission on a device that was not commissioned, it gets stuck on the

    ZMacSetReq( ZMacChannel, &(_NIB.nwkLogicalChannel) );

    because _NIB.nwkLogicalChannel is 0.

    So you should check "if _NIB.nwkLogicalChannel != 0" before calling StubAPS_SetIntraPanChannel() or before ZMacSetReq( ZMacChannel, &(_NIB.nwkLogicalChannel) );

    Now it works fine.

  • Thanks for sharing your fix.

    Makes sense, since valid channel range is [11, 26].
    This is further confirmed by touchlink commissioning setting the channel in the _NIB beforehand (which offers an alternative solution of setting the NIB/channel before any inter-pan messaging) :

    void initiatorSelectNwkParams( void )
    {
    
    // ...
    
      if ( _NIB.nwkLogicalChannel == 0 )
      {
        // Select randomly one of the TouchLink channels as our logical channel
        _NIB.nwkLogicalChannel = touchLink_GetRandPrimaryChannel( );
      }

    I'll pass your findings along to our development team.

  • Also I found why ZC didn't receive Inter-PAN messages. If I comment the line of the code, Inter-PAN messages are passed by the condition and I get events  zstackmsg_CmdIDs_AF_INCOMING_MSG_IND in zclSampleLight_processZStackMsgs().

    So now it looks working and I can receive inter-PAN messages, but are there any unwanted consequences of this fix?

  • Is this after the ZC has formed a network ?

    Once a device is in a network, its short address should be assigned/initialized to a valid value (i.e. should not be a broadcast address).

    Commenting this out means that the device could receive messages before it has a valid short address (which may be ok for your use case).
    In steady state operation (device operating in network), the device would have a valid short address throughout its lifetime in the network, so the condition for this if block will evaluate true.

    Another consideration for inter-PAN would be security related. Having some kind of screening procedure could be useful (e.g. filtering out unknown commands).

  • Toby Pan said:
    Is this after the ZC has formed a network ?

    Yes, but only on the same channel. If I send interPAN message on a different channel, it gets stuck in some time after calling StubAPS_SetIntraPanChannel().

    I found that ZMacSetReq( ZMacChannel, &(_NIB.nwkLogicalChannel) ) returns error code 0x1A.

    But _NIB.nwkLogicalChannel is 11, so it should be okay.

    I didn't find ZMacStatus_t status value 0x1A in the zcomdef.h file.

    What does status 0x1A mean?

  • Looks like 0x1A is MAC_NO_RESOURCES

    #define MAC_NO_RESOURCES 0x1A /* The operation could not be completed because no

    memory resources were available */

    But why?

  • It looks like I found a bug in the zstacktask.c

  • Thanks for pointing this out.
    The struct zstack_devForceNetworkSettingsReq_t does not have a logicalChannel field here, so I will check with development team if this was intentional.

    At a glance, I'd agree that _NIB.nwkLogicalChannel should not be set to channelList (which is a bitmask of channels).

    Are you using this API in your code ? (The SDK examples do not use it by default).

    The MAC_NO_RESOURCES is the status returned when the MAC channel change api (i.e. MAP_macRadioSetChannel) is unsuccessful.

    It looks like StubAPS_SetIntraPanChannel and StubAPS_SetInterPanChannel both are changing the active channel.
    However, StubAPS_SetInterPanChannel is calling StubAPS_SetNewChannel,   vs   StubAPS_SetIntraPanChannel which is calling ZMacSetReq( ZMacChannel, ...) directly.
    As such, can you try something like this :

    ZStatus_t StubAPS_SetIntraPanChannel( void )
    {
      uint8_t currChannel;
      uint8_t rxOnIdle;
    
      if ( channelChangeInProgress )
        return ( ZFailure );
    
      ZMacGetReq( ZMacChannel, &currChannel );
      if ( currChannel == _NIB.nwkLogicalChannel )
        return ( ZSuccess );
    
      return StubAPS_SetInterPanChannel(_NIB.nwkLogicalChannel);
    
    }

  • No, I don't use this API. I found it accidentally.

    Thanks, but probably there is also required

    // set NWK task to run
    nwk_setStateIdle( FALSE );

    after StubAPS_SetInterPanChannel(), otherwise it doesn't work.

    Btw, I found the solution for my problem and now can change Inter-PAN channels and send messages any time. It doesn't depend on a formed network. It is important to call StubAPS_SetIntraPanChannel() ONLY after receiving zstackmsg_CmdIDs_AF_DATA_CONFIRM_IND event. So now it works for commissioned and non-commissioned devices.

    But I still get 0x1A status value from ZMacSetReq( ZMacChannel, &channel ) when change inter-PAN channel (if ZigBee network is formed). Although it doesn't affect on functionality, the channel is changed and I see this in the sniffer.

  • Thanks for sharing your solution here!

    I'll file a ticket to have the documentation updated accordingly.