Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC1352P: FFD trying to join network as a RFD

$
0
0

Part Number: CC1352P

We've recently ported our application to SDK3.30 and are now seeing several new strange behaviors.  This is one of them.

Per the attached wire shark capture, you can see a device sending out beacon requests and then it sends an association request, but its asking to associated as a RFD.  (See frames 21 - 27)

Our device resets if it associates as the wrong type of device and then tries again.

Eventually it sends an association request as an FFD and then completes the completes the key exchange and runs normally. (See frames 256 - 295)

This was not occurring with the SDK3.20 stack.

Did something change in the way the BDB needs to be set up?

Our device can be either a Coordinator OR Router. 

// define to include both coordinator and router capabilities
#define ZSTACK_DEVICE_BUILD (DEVICE_BUILD_COORDINATOR | DEVICE_BUILD_ROUTER)

 In the following code, we first make a call to set up the default bdb parameters (MyApp_initParameters)

Then once we know what device type we are (Coordinator or Router) and a user specified PAN_ID,  we call MyApp_SetPanId() which calls Zstackapi_bdbStartCommissioningReq() with the desired commissioning_mode.

This is when it starts sending Beacon Requests and for some reason associating as a RFD as demonstrated in the wireshark capture.

Any thought on why this is occurring would be appreciated.

- Bill

 
static void MyApp_initParameters( void )
{
  zstack_bdbSetAttributesReq_t zstack_bdbSetAttrReq = {0};

  zstack_bdbSetAttrReq.has_bdbCommissioningGroupID          = TRUE;
  zstack_bdbSetAttrReq.bdbCommissioningGroupID              = BDB_DEFAULT_COMMISSIONING_GROUP_ID;

  zstack_bdbSetAttrReq.has_bdbPrimaryChannelSet             = TRUE;
  zstack_bdbSetAttrReq.bdbPrimaryChannelSet                 = BDB_DEFAULT_PRIMARY_CHANNEL_SET;

  zstack_bdbSetAttrReq.has_bdbScanDuration                  = TRUE;
  zstack_bdbSetAttrReq.bdbScanDuration                      = BDB_DEFAULT_SCAN_DURATION;

  if ( isCoordinatorMode() )
  {
    zstack_bdbSetAttrReq.has_bdbJoinUsesInstallCodeKey        = TRUE;
    zstack_bdbSetAttrReq.bdbJoinUsesInstallCodeKey            = BDB_DEFAULT_JOIN_USES_INSTALL_CODE_KEY;

    zstack_bdbSetAttrReq.has_bdbTrustCenterNodeJoinTimeout    = TRUE;
    zstack_bdbSetAttrReq.bdbTrustCenterNodeJoinTimeout        = BDB_DEFAULT_TC_NODE_JOIN_TIMEOUT;

    zstack_bdbSetAttrReq.has_bdbTrustCenterRequireKeyExchange = TRUE;
    zstack_bdbSetAttrReq.bdbTrustCenterRequireKeyExchange     = BDB_DEFAULT_TC_REQUIRE_KEY_EXCHANGE;

    zstack_bdbSetAttrReq.has_bdbSecondaryChannelSet           = TRUE;
    zstack_bdbSetAttrReq.bdbSecondaryChannelSet               = 0x00000000; // The secondary channel set is zero for coordinators
                                                                            // so they only attempt to start a network on the
                                                                            // primary channel set
}
  else // (isRouterOrRepeaterMode)
  {
    zstack_bdbSetAttrReq.has_bdbSecondaryChannelSet           = TRUE;
    zstack_bdbSetAttrReq.bdbSecondaryChannelSet               = BDB_DEFAULT_SECONDARY_CHANNEL_SET;  // routers are allowed to use the secondary channel
                                                                                                    // set when searching for a network to join
  }

  Zstackapi_bdbSetAttributesReq( MyApp_ZstackId, &zstack_bdbSetAttrReq );

  // Start bdb in idle mode to and see if its restoring from NV
  zstack_bdbStartCommissioningReq_t zstack_bdbStartCommissioningReq;
  zstack_bdbStartCommissioningReq.commissioning_mode = BDB_COMMISSIONING_MODE_IDDLE;
  Zstackapi_bdbStartCommissioningReq( MyApp_ZstackId, &zstack_bdbStartCommissioningReq );
}


static void MyApp_SetPanId( uint16 requestedPanID )
{
  NVINTF_itemID_t nvId;

  // If joining a new pan,
  // set the global panid before starting the network
  if ( ( MyApp_nvPanID != 0xFFFF ) && ( MyApp_nvPanID != requestedPanID ) )
  {
    // Save the new panID
    nvId.systemID = NVINTF_SYSID_ZSTACK;
    nvId.subID = ZCD_NV_PANID;
    nvId.itemID = ZCD_NV_EX_LEGACY;
    MyApp_nvPanID = requestedPanID;
    zstack_user0Cfg.nvFps.writeItem( nvId, sizeof( uint16 ), &requestedPanID );

    // To force a "new" join, ForceRadioRestart
    ForceRadioRestart();
  }

  else
  {
    // Only start the network if not already done and valid PAN ID,
    if ( requestedPanID <= MAX_PAN_ID && RadioHasJoined() == FALSE )
    {
      zstack_bdbStartCommissioningReq_t zstack_bdbStartCommissioningReq;

      // Update the stack's Pan ID
      if ( MyApp_nvPanID == 0xFFFF )
      {
        nvId.systemID = NVINTF_SYSID_ZSTACK;
        nvId.subID = ZCD_NV_PANID;
        nvId.itemID = ZCD_NV_EX_LEGACY;
        MyApp_nvPanID = requestedPanID;
        zstack_user0Cfg.nvFps.writeItem( nvId, sizeof( uint16 ), &requestedPanID );
      }

      // Update the stack's device logical type NV
      if ( zgDeviceLogicalType != MyApp_DeviceLogicalType )
      {
        nvId.systemID = NVINTF_SYSID_ZSTACK;
        nvId.subID = ZCD_NV_LOGICAL_TYPE;
        nvId.itemID = ZCD_NV_EX_LEGACY;
        zgDeviceLogicalType = MyApp_DeviceLogicalType;
        zstack_user0Cfg.nvFps.writeItem( nvId, sizeof( zgDeviceLogicalType ), &zgDeviceLogicalType );
      }

      // Start or Join the PAN
      if (!bdb_isDeviceNonFactoryNew())
      {
        if ( MyApp_DeviceLogicalType == ZG_DEVICETYPE_COORDINATOR )
        {
          zstack_bdbStartCommissioningReq.commissioning_mode = BDB_COMMISSIONING_MODE_NWK_FORMATION;
          Zstackapi_bdbStartCommissioningReq( MyApp_ZstackId, &zstack_bdbStartCommissioningReq );
        }
        else
        {
          zstack_bdbStartCommissioningReq.commissioning_mode = BDB_COMMISSIONING_MODE_NWK_STEERING;
          Zstackapi_bdbStartCommissioningReq( MyApp_ZstackId, &zstack_bdbStartCommissioningReq );
        }
      }
    }
  }
}

(Please visit the site to view this file)


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>