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.

CC2652P: I have try to make Source Routing Sending support Data Unit Fragmentation.

Part Number: CC2652P
Other Parts Discussed in Thread: Z-STACK

Tool/software:

I have try to fixed the SDK code like this. It sometimes work, sometimes not work.

uint16_t afRtgDstAddress = INVALID_NODE_ADDR;

afStatus_t AF_DataRequest(...)
{

....

    if((req.dstAddr.addrMode == Addr16Bit) && (!(req.txOptions & APS_TX_OPTIONS_SKIP_ROUTING)))
    {
      afRtgDstAddress = req.dstAddr.addr.shortAddr;
    }
    if (len > afDataReqMTU( &mtu ) )
    {
      if (apsfSendFragmented)
      {
        stat = (*apsfSendFragmented)( &req );
      }
      else
      {
        stat = afStatus_INVALID_PARAMETER;
      }
    }
    else
    {
      stat = APSDE_DataReq( &req );
    }
    afRtgDstAddress = INVALID_NODE_ADDR;

...

}





uint8_t afDataReqMTU( afDataReqMTU_t* fields )
{
  uint8_t len;
  uint8_t hdr;

  if ( fields->kvp == TRUE )
  {
    hdr = AF_HDR_KVP_MAX_LEN;
  }
  else
  {
    hdr = AF_HDR_V1_1_MAX_LEN;
  }

  len = (uint8_t)(APSDE_DataReqMTU(&fields->aps) - hdr);

  //match rtg table to recalculate MTU, fixed by luoyiming 2025-01-04
  if( zgConcentratorEnable && (afRtgDstAddress != INVALID_NODE_ADDR) )
  {
    uint8_t relayCnt = 0;
    uint16_t *relayList = NULL;
    if ( (RTG_GetRtgSrcEntry(afRtgDstAddress, &relayCnt, &relayList) == RTG_SUCCESS) && (relayCnt > 0) )
    {
      len -= 2 + relayCnt * sizeof(uint16_t);
    }
  }

  return len;
}

  • Hello Aries,

    I hope you are doing well. Which SDK version are you using here? As well as CCS version. 

    -Can you point me to the example you started with and/or expand on why the code snippet sometimes work/does not work (the steps/sequence)? 

    Thanks,
    Alex F

  • I set "MAX_RTG_SRC_ENTRIES" to 128 on my coordinator,but the zgConcentratorEnable on my coordinator is "FALSE". My coordinator send AF-Packet to an End-Device belong to another Router. Sometimes Coordinate will trigger Source-Routing for sending, and sometimes coordinator will not trigger Source-Routing.

    How can I turn-on and turn-off the Source-Routing when call "AF_DataRequest"

  • Hello Aries,

    Could you grab some sniffer debug logs here?

    As well as providing your routing definitions and to clarify your node roles (why is the coordinator not the MOT coordinator?).

    You can try to use RTG_GetRtgSrcEntry within AF_DataRequest to determine whether a source routing entry is available.

    Thanks,
    Alex F

  • I my program, RTG_GetRtgSrcEntry is called in AF_DataRequest, and RTG_GetRtgSrcEntry can detect the End-Device is recorded in coordinator's Source Routing table. But Coordinator won't trigger Source Routing.

  • Hey Aries, can you please provide all of your routing definitions and clarify your node roles (i.e. why is the coordinator not the MTO concentrator?)

    https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_41_00_17/docs/zigbee/html/zigbee/z-stack-overview.html#many-to-one-routing-protocol 

    From the Z-Stack UG: "As part of the Many-to-One routing, source routing is only utilized under certain circumstances. First, it is used when the concentrator is responding to a request initiated by the source device."

    What you are seeking to achieve may not be possible using the default Z-Stack pre-built libraries.

    Regards,
    Ryan

  • LINK_DOWN_TRIGGER=12
    NWK_ROUTE_AGE_LIMIT=5
    DEF_NWK_RADIUS=30
    DEFAULT_ROUTE_REQUEST_RADIUSX=8
    ROUTE_DISCOVERY_TIME=12
    SRC_RTG_EXPIRY_TIME=10
    MTO_RREQ_LIMIT_TIME=5000
    CONCENTRATOR_DISCOVERY_TIMEX=120
    MAX_RTG_SRC_ENTRIES=128
    CONCENTRATOR_ROUTE_CACHE=true
    CONCENTRATOR_ENABLE=true

  • Thanks, those are similar to swra650 and do not present any issues.  Sniffer logs could confirm that certain packet circumstances will not trigger source routing in the Z-Stack library by design.  How will this affect your end application?

    Regards,
    Ryan

  • I want the data unit fragmentation sending trigger source-routing, but sometimes source-routing will trigger and sometimes source-routing will not trigger. I want to prejudge that will the source-routing trigger in AF_DataRequest.

  • I have research the code of Z-stack lib, I have found that the coordinator will search the routing-path in Normal Routing Table(RTG Table) for first. Though the target address is recorded in Source Routing Table, it will not trigger Source Routing. So my code fixed in "uint8_t afDataReqMTU( afDataReqMTU_t* fields )"  can be like this

    uint8_t afDataReqMTU( afDataReqMTU_t* fields )
    {
      uint8_t len;
      uint8_t hdr;
    
      if ( fields->kvp == TRUE )
      {
        hdr = AF_HDR_KVP_MAX_LEN;
      }
      else
      {
        hdr = AF_HDR_V1_1_MAX_LEN;
      }
    
      len = (uint8_t)(APSDE_DataReqMTU(&fields->aps) - hdr);
    
      //match rtg table to recalculate MTU, fixed by luoyiming 2025-01-04
      if(afRtgDstAddress != INVALID_NODE_ADDR)
      {
        if ( RTG_CheckRtStatus( afRtgDstAddress, RT_ACTIVE, 0 ) != RTG_SUCCESS )
        {
          uint8_t relayCnt = 0;
          uint16_t *relayList = NULL;
          if ( (RTG_GetRtgSrcEntry(afRtgDstAddress, &relayCnt, &relayList) == RTG_SUCCESS) && (relayCnt > 0) )
          {
            len -= 2 + relayCnt * sizeof(uint16_t);
          }
        }
      }
    
      return len;
    }