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.

how to enable Automatic permit join.

Guru 14820 points
Other Parts Discussed in Thread: CC2531, CC2530, Z-STACK

Hello,

I am working on cc2530 and using z stack home 1.2.1,I am configuring cc2530 as router and using cc2531 znp(connected with beaglebone).Now every time when i power on the cc2530 ,to add the cc2530 in the network i have to send permit join request from linux getway by pressing a key from keyboard(currently "P") .But i want to enable the cc2530 to join the network automatically after  power on each time.

please help somebody as soon as possible.

Thanks a Lot  in advance. 

Regards 

Dhanraj

  • You can send permit join enable when power on.
  • but what i want is,when i power on the cc2530 it should automatically join the network independent of permit join request.
  • basically i dont want to send any permit join request from linux getway "manually". i want automatic network formation.
  • Then, you have to add "NLME_PermitJoiningRequest(255);" in "case ZDO_STATE_CHANGE:" of znpEventLoop() and rebuild ZNP.
  • before compiling which option to select out of-
    1)cc2531-Debug
    2)cc2531-TestHex
    3)cc2531-ProdSBL
    4)cc2531-ProdHex
  • Do you use CC2531 or CC2530?
  • I m using cc2531 as ZNP.
  • Then, you can use cc2531-ProdHex.
  • I have done everything as you told,but still i have to send permit join request to add cc2530 into the network from linux getway, are there any required on cc2530 side?
    else something wrong am doing.
  • I have done everything as you told,but still i have to send permit join request to add cc2530 into the network from linux getway, are there any changes required on cc2530 side?
    else something wrong am doing.
  • Can you show me your revisions on source code of ZNP?

  • Filename: znp_app.c
    Revised: $Date: 2014-03-26 10:34:30 -0700 (Wed, 26 Mar 2014) $
    Revision: $Revision: 37901 $

    Description: This file is the Application implementation for the ZNP.
  • I mean what you modify in znpEventLoop?
  • I have copied the edited znpEventLoop please check


    uint16 znpEventLoop(uint8 taskId, uint16 events)
    {
    osal_event_hdr_t *pMsg;
    #if !defined CC2531ZNP
    uint8 *pBuf;
    #endif

    if (events & SYS_EVENT_MSG)
    {
    while ((pMsg = (osal_event_hdr_t *) osal_msg_receive(znpTaskId)) != NULL)
    {
    switch (pMsg->event)
    {
    /* incoming message from UART transport */
    case CMD_SERIAL_MSG:
    MT_ProcessIncoming(((mtOSALSerialData_t *)pMsg)->msg);
    break;

    #if defined ZCL_KEY_ESTABLISH
    #if defined (MT_UTIL_FUNC)
    case ZCL_KEY_ESTABLISH_IND:
    MT_UtilKeyEstablishInd((keyEstablishmentInd_t *)pMsg);
    break;
    #endif
    #endif

    case AF_INCOMING_MSG_CMD:
    #if defined ZCL_KEY_ESTABLISH
    if (ZCL_KEY_ESTABLISHMENT_ENDPOINT == (((afIncomingMSGPacket_t *)pMsg)->endPoint))
    {
    zcl_ProcessMessageMSG((afIncomingMSGPacket_t *)pMsg);
    }
    else
    #endif
    {
    MT_AfIncomingMsg((afIncomingMSGPacket_t *)pMsg);
    }
    break;

    #ifdef MT_ZDO_FUNC
    case ZDO_STATE_CHANGE:


    NLME_PermitJoiningRequest(255); // for automatic permit join



    MT_ZdoStateChangeCB(pMsg);
    break;

    case ZDO_CB_MSG:
    MT_ZdoSendMsgCB((zdoIncomingMsg_t *)pMsg);
    break;
    #endif

    case AF_DATA_CONFIRM_CMD:
    MT_AfDataConfirm((afDataConfirm_t *)pMsg);
    break;

    default:
    break;
    }

    osal_msg_deallocate((byte *)pMsg);
    }

    events ^= SYS_EVENT_MSG;
    }
    #if !defined CC2531ZNP
    else if (events & ZNP_SPI_RX_AREQ_EVENT)
    {
    if ((pBuf = npSpiGetReqBuf()) != NULL )
    {
    MT_ProcessIncoming(pBuf);
    npSpiAReqComplete();
    }

    events ^= ZNP_SPI_RX_AREQ_EVENT;
    }
    else if (events & ZNP_SPI_RX_SREQ_EVENT)
    {
    if ((pBuf = npSpiGetReqBuf()) != NULL)
    {
    MT_ProcessIncoming(pBuf);
    }

    events ^= ZNP_SPI_RX_SREQ_EVENT;
    }
    #endif
    else if (events & ZNP_UART_TX_READY_EVENT)
    {
    npUartTxReady();
    events ^= ZNP_UART_TX_READY_EVENT;
    }
    #if defined MT_SYS_FUNC
    else if (events & MT_SYS_OSAL_EVENT_0)
    {
    MT_SysOsalTimerExpired(0x00);
    events ^= MT_SYS_OSAL_EVENT_0;
    }
    else if (events & MT_SYS_OSAL_EVENT_1)
    {
    MT_SysOsalTimerExpired(0x01);
    events ^= MT_SYS_OSAL_EVENT_1;
    }
    else if (events & MT_SYS_OSAL_EVENT_2)
    {
    MT_SysOsalTimerExpired(0x02);
    events ^= MT_SYS_OSAL_EVENT_2;
    }
    else if (events & MT_SYS_OSAL_EVENT_3)
    {
    MT_SysOsalTimerExpired(0x03);
    events ^= MT_SYS_OSAL_EVENT_3;
    }
    #endif
    #if defined POWER_SAVING
    else if (events & ZNP_PWRMGR_CONSERVE_EVENT)
    {
    (void)osal_pwrmgr_task_state(znpTaskId, PWRMGR_CONSERVE);
    events ^= ZNP_PWRMGR_CONSERVE_EVENT;
    }
    #endif
    else if (events & ZNP_SECONDARY_INIT_EVENT)
    {
    npInit();
    events ^= ZNP_SECONDARY_INIT_EVENT;
    }
    #if defined MT_ZNP_FUNC
    else if (events & ZNP_BASIC_RSP_EVENT)
    {
    npBasicRsp();
    events ^= ZNP_BASIC_RSP_EVENT;
    }
    #endif
    else if (events & MT_AF_EXEC_EVT)
    {
    MT_AfExec();
    events ^= MT_AF_EXEC_EVT;
    }
    else
    {
    events = 0; /* Discard unknown events. */
    }

    return ( events );
    }
  • There is no problem in your modification. I suspect Z-Stack Linux Home GW might disable permit join when it starts up. You have to dig into it to verify this.
  • since I m a beginner can you please tell me in Z-Stack Linux Home GW in which file permit join related command is written.
  • I don't know if you have full source code of Z-Stack Linux Home GW to trace this. Let's try another way on ZNP. Please revise "retValue = (uint8)ZDP_MgmtPermitJoinReq( &destAddr, duration, tcSignificance, 0);" to "retValue = 1;" in MT_ZdoMgmtPermitJoinRequest() and test again.