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 Communication Issue

Other Parts Discussed in Thread: Z-STACK

Dear Ti,

We are using Z-Stack 2.5.1 and in our setup there is a coordiantor and a router. We are trying to implement a Inter PAN communication for the scenario where the router hasn't joined the coordinator due to a different Pan ID of the coordinator.

We have been able to sucessfully send the message from Router to the Coordinator and have been able to receive the InterPan message on the coordinator as well. We however want to send a message back from coordinator to the router informing about the Pan ID that needs to be used for communication. Unfortunately we are able to see this message on the Packet sniffer going from the coordinator, however it's not geting detected on StubAPS_ProcessEvent(): MAC_MCPS_DATA_IND on router side.

Please help us resolve this issue.

Code on Coordinator Side

--------------------------------

void INTERP_DataIndication( macMcpsDataInd_t *dataInd )
{
  NLDE_FrameFormat_t snff;
  aps_FrameFormat_t saff;
  zAddrType_t srcAddr;
  NLDE_Signal_t sig;
  uint16 logicalType =0;
  uint8 transId =1; 
  afAddrType_t   GenericApp_DstAddr;  
  char buf[6];
  //char theMessageData[] = "666666";
    //APSDE_DataReq_t
  // parse the Stub NWK header
  StubNWK_ParseMsg( dataInd->msdu.p, dataInd->msdu.len, &snff );

  // Fill in MAC destination address
  snff.macDstAddr = dataInd->mac.dstAddr.addr.shortAddr;
  osal_nv_read(ZCD_NV_LOGICAL_TYPE,0, sizeof(uint16), &logicalType);
  logicalType&=0xFF;
  if(logicalType == ZG_DEVICETYPE_COORDINATOR)
  {      
       (void)osal_memcpy(GenericApp_DstAddr.addr.extAddr, dataInd->mac.srcAddr.addr.extAddr, Z_EXTADDR_LEN);

    GenericApp_DstAddr.addrMode = (afAddrMode_t)Addr64Bit;
  
      GenericApp_DstAddr.endPoint = STUBAPS_INTER_PAN_EP;
 
    GenericApp_DstAddr.panId = 0x1008;//0xFFFF;//_NIB.nwkPanId;
    buf[0] =(byte)_NIB.nwkPanId;  // lo byte
    buf[1] =(byte)(_NIB.nwkPanId>>8); // then hi byte
    buf[2]= (byte)'8';buf[3]= (byte)'8';    
    if(AF_DataRequest(&GenericApp_DstAddr,&sapi_epDesc,
                         2,
                         4+1,
                         (uint8 *)buf,
                         &transId,
                         AF_TX_OPTIONS_NONE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {
 
      // Successfully requested to be sent.
 
      //  HalLcdWriteStringValue( "Pongs ENV", valorEnv, 10, HAL_LCD_LINE_1 );
 
    }
    else
    {
 
      // Error occurred in request to send.
 
      StubAPS_SetIntraPanChannel();


     
    }
                                            
    }
    else{
      // other than coordinator device than this is comman
     if(logicalType != ZG_DEVICETYPE_COORDINATOR)
     {
        //_NIB.nwkPanId=;
        // _NIB.nwkPanId= buf[1];  // lo byte
       //  _NIB.nwkPanId<<=8;
        // _NIB.nwkPanId |=buf[0]; // then hi byte
        // NLME_UpdateNV(NWK_NV_NIB_ENABLE);
        if((buf[2]==buf[3])&&(buf[3]=='8'))
        {
       
       
        }
    
     }
     
    } 
  // fill in MAC source address (Stub NWK frame doesn't have address fields)
  osal_copyAddress( &srcAddr, (zAddrType_t *)&(dataInd->mac.srcAddr) );
 
  // check if incoming frame is of the right type
  if ( snff.frameType != STUB_NWK_FRAME_TYPE )
    return;
   
  // check if incoming frame is of the right version
  if ( snff.protocolVersion != NLME_GetProtocolVersion() )
    return;
 
  // check if the remaining sun-fields are zero
  if ( ( snff.discoverRoute != 0 ) || ( snff.multicast != 0 )   ||
       ( snff.secure != 0 )        || ( snff.srcRouteSet != 0 ) ||
       ( snff.dstExtAddrSet != 0 ) || ( snff.srcExtAddrSet != 0 ) )
  {
    return;
  }
 
  // parse the Stub APS header
  StubAPS_ParseMsg( &snff, &saff );

  // check if incoming frame is of the right type
  if ( ( saff.FrmCtrl & APS_FRAME_TYPE_MASK ) != STUB_APS_FRAME )
    return;
  
  // check if delivery mode is of the right type
  if ( ( saff.FrmCtrl & APS_DELIVERYMODE_MASK ) == APS_FC_DM_INDIRECT )
    return;
 
  // check if incoming frame is unsecured
  if ( saff.FrmCtrl & APS_FC_SECURITY )
    return;
 
  // check if there's no extended header
  if ( saff.FrmCtrl & APS_FC_EXTENDED )
      return;
 
  // Set the endpoints
  saff.DstEndPoint = appEndPoint;
  saff.SrcEndPoint = STUBAPS_INTER_PAN_EP;
 
  // Set the signal strength information
  sig.LinkQuality = dataInd->mac.mpduLinkQuality;
  sig.correlation = dataInd->mac.correlation;
  sig.rssi = dataInd->mac.rssi;
 
  APSDE_DataIndication( &saff, &srcAddr, dataInd->mac.srcPanId,
                        &sig, snff.broadcastId, FALSE, dataInd->mac.timestamp );

}

---------------------------------

Code from Router Side

__________________

The below functionality is called ever 2 sec

dataReq_t.dstAddr.addrMode = (afAddrMode_t)AddrBroadcast;
      dataReq_t.dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;      
      dataReq_t.dstEP = 0xfe;     
      dataReq_t.dstPanId = 0x1008;                 
      INTERP_DataReq(&dataReq_t);

_____________________

Thanks

Anubhav

  • So for the one direction that you see "working", ZR to ZC, I think that it is working by accident - the ZR is not really a ZR yet, it is nothing, it is in an undefined state. You will probably need to do something more complicated like make the ZR start a network as a ZC, get information about which PanId to join as a ZR, leave its own network or just reset, and then join the indicated PanId as a ZR. But this is all so complex - why can't you make your ZR just look for the IEEE address of the ZC that it is supposed to join?

     

  • Hi Harry,

    I understand your point that ZR is not a router till it actually gets into the network. And for that matter we can treat it as an End Device which needs to join the network. The situation is that the ZR/end dEvice which is added to the network later will not be knowing the address of the ZC. Thus Z/End DeviceR would need to send an Inter PAN message to either 0x0000 address or broadcast so that ZC can respond back with the correct Pan ID, Channel ID for ZR to join.

    The Basic Issue that I need to resolve is that when two coordinators are in the same vicinity the coordinator which boots later changes it's PAN ID. Thus all the routers/end devices associated with this coordinator suddenly cannot connect to this coordinator.

    Please suggest how best to tackle this situation.

    Thanks

    Anubhav

  • Sorry, I don't clearly understand the network commissiong problem that you are trying to solve - hopefully some forum members with experience on this will add their wisdom.