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.

CC2530: Permit join to a specific ZED?

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

Hello everyone.

I am working several ZC and several ZEDs based on zstack 3.0.1.

My question,can I send a activation permit join to a specific ZED?

Piao

  • You cannot send activation permit join to ZED. You can only do permit join on ZC/ZR.
  • YK Sir.

    Thank you very much.

    Then can ZC allow only specific ZEDs to be connected?
  • By default, it cannot allow only specific ZEDs to be connected. However, you can implement white list on your ZC and send leave request to devices that are not on the list after they join network.
  • Which function does ZC know that ZED has join network?
    And How should ZED make a "wnable permit" in ZC to connect to ZC?
  • 1. You can refer to sunmaysky.blogspot.tw/.../how-to-handle-end-node-announcement.html
    2. When you say "How should ZED make a "wnable permit" in ZC to connect to ZC?", do you mean to send permit join request from ZED to ask ZC enable permit join?
  • YK Sir.

    Thanks.

    For 2nd question, you are right.

    Would you please explain to me in detail?
  • Does your ZED already join network? If not, you cannot send permit join request to ZC/ZR.
  • I want ZEDs only in whitelist join in ZC.
    So in ZDO_JoinIndicationCB(), I let ZC check whitelist.

    Then ZED is often unable to connect to ZC.

    What did I do wrong?

    Please let me know.
  • It might be time critical to process this white list thing in ZDO_JoinIndicationCB. I would suggest you to register receiving end node announcement and check white list when receiving end node announcement to decide leave the joined device or not.
  • YK Sir.

    Thanks a lots of.

    I am a beginner for zigbee.

    Sorry, you said "when receiving end node announcement",

    in detail which function?
  • YK Sir.

    I opened your link but ...

  • Are you from China?
  • I think it's blocked by Great Firewall..... Anyway, I attach the blog content in the followings:

    When a Zigbee device joins network, it would broadcast end node announcement with its short and IEEE address. We can register a callback event in Z-Stack to receive end node announcement and store short/IEEE address of device to a device list. Then, we usually call ZDP_ActiveEPReq to request active endpoint and register a callback event in Z-Stack to receive active endpoint response and store it to device list. Finally, we can call ZDP_SimpleDescReq to request simple descriptor and register a callback event in Z-Stack to receive simple descriptor response and store it to device list too.

    The following steps show you how to handle end node announcement in Z-Stack SampleLight.

    1. Add "ZDO_RegisterForZDOMsg(task_id, Device_annce);" in zclSampleLight_Init().

    2. Add the following codes to process Device_annce event in zclSampleLight_ProcessZDOMsgs and you would get end node announcement information in devAnnce structure.

    ZDO_DeviceAnnce_t devAnnce;

    if ( pMsg->clusterID == Device_annce )
    ZDO_ParseDeviceAnnce( pMsg, &devAnnce );





    The following steps show you how to handle active endpoint response in Z-Stack SampleLight.

    1. Add "ZDO_RegisterForZDOMsg(task_id, Active_EP_rsp);" in zclSampleLight_Init().

    2. Add the following codes to process Active_EP_rsp event in zclSampleLight_ProcessZDOMsgs and you would get end node announcement information in pActiveEndpointRsp pointer of ZDO_ActiveEndpointRsp_t structure.

    ZDO_ActiveEndpointRsp_t *pActiveEndpointRsp;

    if ( pMsg->clusterID == Active_EP_rsp )
    pActiveEndpointRsp = ZDO_ParseEPListRsp( pMsg );


    The following steps show you how to handle simple descriptor response in Z-Stack SampleLight.

    1. Add "ZDO_RegisterForZDOMsg(task_id, Simple_Desc_rsp);" in zclSampleLight_Init().

    2. Add the following codes to process Simple_Desc_rsp event in zclSampleLight_ProcessZDOMsgs and you would get simple descriptor in simpleDescRsp structure.

    ZDO_SimpleDescRsp_t simpleDescRsp;

    if ( pMsg->clusterID == Simple_Desc_rsp )
    ZDO_ParseSimpleDescRsp( pMsg, &simpleDescRsp );
  • YK Chen Sir.

    Thank you very much.

    I have learn lots of things from you.

    谢谢。

    Piao.
  • YK Sir.

    I have tried to understand your suggestion but I have question.
    1. Where id "zclSampleLight_ProcessZDOMsgs"?
    If I have to implement it myself, Where should I call it?

    2. Where should pMsg get?
  • Yk Sir.

    I found related link.

    e2e.ti.com/.../2239350

    right?
  • Since you are using Z-Stack 3.0.1, you have to add "case ZDO_CB_MSG:" in your zclXXX_event_loop and refer to touchLink_RouterProcessZDOMsg( (zdoIncomingMsg_t *)pMsg ) in touchLinkInitiator_event_loop to add your own custom zcl_xxxProcessZDOMsg( (zdoIncomingMsg_t *)pMsg ) in your "case ZDO_CB_MSG:" of zclXXX_event_loop. Then you can add your "case Device_annce:" in your own zcl_xxxProcessZDOMsg to process device announcement.

  • Thanks for your assist.

    I have put your suggestion.

     void EasenLock_ProcessZDOMsgs(zdoIncomingMsg_t *pMsg);

    ...

    In ...Init(), I put as following.

    ZDO_RegisterForZDOMsg(EasenLock_TaskID, Device_annce);
    ZDO_RegisterForZDOMsg(EasenLock_TaskID, Active_EP_rsp);
    ZDO_RegisterForZDOMsg(EasenLock_TaskID, Simple_Desc_rsp);

    ...

    uint16 EasenLock_event_loop( uint8 task_id, uint16 events )
    {
    afIncomingMSGPacket_t *MSGpkt;
    afDataConfirm_t *afDataConfirm;


    (void)task_id; // Intentionally unreferenced parameter
    if ( events & SYS_EVENT_MSG )
    {
    while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( EasenLock_TaskID )) )
    {
    switch ( MSGpkt->hdr.event )
    {
    case ZDO_CB_MSG:
    SendDataByUart("ZDO_CB_MSG ",11);
    EasenLock_ProcessZDOMsgs((zdoIncomingMsg_t *)MSGpkt);
    break;

    case ZCL_INCOMING_MSG:

    ...

    void EasenLock_ProcessZDOMsgs(zdoIncomingMsg_t *pMsg)
    {

    ZDO_DeviceAnnce_t devAnnce;
    ZDO_ActiveEndpointRsp_t *pActiveEndpointRsp;
    ZDO_SimpleDescRsp_t simpleDescRsp;

    uint8 ret;
    uint8 iEndDev;
    uint8 passAddr[Z_EXTADDR_LEN];
    uint8 fSuccess = 0;
    char szMsg[96] = { 0 };
    switch (pMsg->clusterID)
    {
    case Device_annce:
    ZDO_ParseDeviceAnnce( pMsg, &devAnnce );
    #if (ZDO_COORDINATOR)
    for(iEndDev = 0; iEndDev < MAX_END_DEV_NUM; iEndDev ++)
    {
    osal_nv_item_init(NV_APP_EASEN_LOOKUP + iEndDev, Z_EXTADDR_LEN, NULL);
    osal_nv_read(NV_APP_EASEN_LOOKUP + iEndDev, 0, Z_EXTADDR_LEN, passAddr);
    if ( AddrMgrExtAddrEqual( passAddr, devAnnce.extAddr) == TRUE )
    {
    fSuccess = 1;
    break;
    }
    }
    if (fSuccess == 0)
    {
    zAddrType_t destAddr;
    destAddr.addrMode = Addr16Bit;
    destAddr.addr.shortAddr = devAnnce.nwkAddr;

    ret = ZDP_MgmtLeaveReq(&destAddr,devAnnce.extAddr,1,1,0);
    AssocRemove(devAnnce.extAddr);
    }
    else
    {
    AssocAddNew(devAnnce.nwkAddr, devAnnce.extAddr,CHILD_RFD);
    ZDP_ActiveEPReq(devAnnce.extAddr,devAnnce.nwkAddr,0);
    }
    #endif
    break;
    case Active_EP_rsp:
    pActiveEndpointRsp = ZDO_ParseEPListRsp( pMsg );
    break;
    case Simple_Desc_rsp:
    ZDO_ParseSimpleDescRsp( pMsg, &simpleDescRsp );
    break;
    }
    }

    Please let  me know my wrong.

    Piao

  • YK Sir.

    My issue is "case ZDO_CB_MSG:" is not executed at all.
  • Can you see "case ZDO_CB_MSG:" in touchLinkInitiator_event_loop?
  • YK Chen Sir.

    Sorry for distube to you.

    I attached one image.

    Would you please explain to me "Blue underline"?

    Piao

  • You can use Ubiqua Protocol Analyzer to open sniffer log and it can be better parsed.