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.

CC1352P: Enable Network Joining forever

Part Number: CC1352P

...well, maybe not forever, but much longer than 180 seconds.  We know that the Zigbee standard only allows 3 minutes, but we need to maintain the network open for longer than 3 minutes.

So, we are calling ZDP_MgmtPermitJoinReq() at an interval of 150 seconds.  What we are seeing over-the-air is that the duration field is being set to 0.  We've tracked it down to the ZDP_MgmtPermitJoinReq(). 

This function sets up the join message in a global buffer...

ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION] = duration;
ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG] = TcSignificance;

... and then calls fillAndSend() twice.  Once to itself and once to the network. 

The problem is that ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION] is getting stepped on so in the second call to fillAndSend(), which broadcasts the JoinPermit to the network, the duration is coming out as 0.

They way we fixed this is to fill in the ZDP_TmpBuf before the second call.  


afStatus_t ZDP_MgmtPermitJoinReq( zAddrType_t *dstAddr, byte duration,
                                  byte TcSignificance, byte SecurityEnable )
{
  (void)SecurityEnable;  // Intentionally unreferenced parameter

  // Build buffer
  ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION] = duration;
  ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG]   = TcSignificance;

  // Check of this is a broadcast message
  if ( ((dstAddr->addrMode == Addr16Bit) || (dstAddr->addrMode == AddrBroadcast))
      && ((dstAddr->addr.shortAddr == NWK_BROADCAST_SHORTADDR_DEVALL)
          || (dstAddr->addr.shortAddr == NWK_BROADCAST_SHORTADDR_DEVZCZR)
          || (dstAddr->addr.shortAddr == NWK_BROADCAST_SHORTADDR_DEVRXON)) )
  {
    // Send this to our self as well as broadcast to network
    zAddrType_t tmpAddr;

    tmpAddr.addrMode = Addr16Bit;
    tmpAddr.addr.shortAddr = NLME_GetShortAddr();

    fillAndSend( &ZDP_TransID, &tmpAddr, Mgmt_Permit_Join_req,
                      ZDP_MGMT_PERMIT_JOIN_REQ_SIZE );
  }
  
  // ----------JCI PATCH-----------
  // Build buffer
  ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION] = duration;
  ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG]   = TcSignificance;
  // ----------JCI PATCH-----------

  // Send the message
  return fillAndSend( &ZDP_TransID, dstAddr, Mgmt_Permit_Join_req,
                      ZDP_MGMT_PERMIT_JOIN_REQ_SIZE );
}

Just wondering if we call using this function wrong or if this is a bug.


Thanks,

- Bill