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.

Zigbee Communication is not occur

Hi Friends,

I am using zstack sample app for my project. 

I have one coordinator and end device. 

Coordinator have connected with end device. 

But the data is not transmitted between coordinator and end device. 

Please give me the solution.

Regards,

Keerthi G.

  • Would you show me how do you send data between ZC and ZED?

  • Hi Chen,

    Ok. Yes chen. With pleasure. 

    Coordinator side:

    // Broadcast to everyone
    SampleApp_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrBroadcast; 
    SampleApp_Periodic_DstAddr.endPoint = SAMPLEAPP_ENDPOINT; 
    SampleApp_Periodic_DstAddr.addr.shortAddr = 0xFFFF; 

    if ( events & SAMPLEAPP_SEND_PERIODIC_MSG_EVT ) 
    {
    // Send the periodic message

    SampleApp_SendPeriodicMessage();
    // Setup to send message again in normal period (+ a little jitter)
    osal_start_timerEx( SampleApp_TaskID, SAMPLEAPP_SEND_PERIODIC_MSG_EVT,
    (SAMPLEAPP_SEND_PERIODIC_MSG_TIMEOUT + (osal_rand() & 0x00FF)) );

    // return unprocessed events
    return (events ^ SAMPLEAPP_SEND_PERIODIC_MSG_EVT);
    }

    void SampleApp_SendPeriodicMessage( void )
    {

    if ( AF_DataRequest( &SampleApp_Periodic_DstAddr, &SampleApp_epDesc,
    SAMPLEAPP_PERIODIC_CLUSTERID,
    1,
    (uint8*)&SampleAppPeriodicCounter, //Gerold - right now I dont see the SampleAppPeriodicCounter being updated
    &SampleApp_TransID,
    AF_DISCV_ROUTE,
    AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {

    SB_HalUART_USCIA0_WriteString("Perodic event success... ");
    }
    else
    {

    SB_HalUART_USCIA0_WriteString("Perodic event failed... ");
    }
    }

    End device side:

    void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pkt )
    {
    uint16 flashTime;
    switch ( pkt->clusterId ) 
    {
    case SAMPLEAPP_PERIODIC_CLUSTERID:
    SB_HalUART_USCIA1_WriteString(" Received correctly...... \n");
    break;


    case SAMPLEAPP_SEND_CLUSTERID:
    HalLcdWriteScreen( (char*)pkt->cmd.Data, "rcvd" ); // receive the data and display into LCD
    // SampleApp_SendTheMessage(); // respond when receiving the data
    break;
    }
    }


     

    Regards,

    Keethi G

  • I see you use broadcast to send message from ZC to ZED. Broadcast might be missed if ZED doesn't wake up in time to polling for the messag. You should use unicast instead of broadcast.

  • Hi Chen,

    Thanks. 

    1) I have set poll rate = 100.

    I can't send message from end device to coordinator also. 

    2) ZDO_JoinConfirmCB(). 

    Is this function used for confirmation of end device joined with coordinator?

    Regards,

    Keerthi G

  • 1. How do you send message from ZED to ZC?

    2. When ZED joins ZB network, it would get ZD_STATE_CHANGE.

  • Hi Chen,

    Code to send the data from ZED to ZC. 

    SampleApp_humi_DstAddr.addrMode = (afAddrMode_t)afAddr16Bit; 
    SampleApp_humi_DstAddr.endPoint = SAMPLEAPP_ENDPOINT; 
    SampleApp_humi_DstAddr.addr.shortAddr = 0x0000; 

    void SampleApp_SendTempHumiValue( uint8 *TempHumi )
    {


    if ( AF_DataRequest( &SampleApp_humi_DstAddr, &SampleApp_epDesc,
    SAMPLEAPP_TEMPERATURE_HUMIDITY_CLUSTERID,
    5,
    TempHumi, 
    &SampleApp_TransID,
    AF_DISCV_ROUTE,
    AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {

    SB_HalUART_USCIA1_WriteString("Success_TH");

    }
    else
    {
    SB_HalUART_USCIA1_WriteString("Failed_TH");
    }
    }

    Regards,

    Keerthi G

  • I suggest you using Uniqua Packet Analyzer to have a check.

  • Hi Chen,

    Ok chen. . . 

    Thank You.

    Regards,

    Keerthi G.