Zigbee Data Transmission

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Zigbee Data Transmission

12,050件の閲覧回数
tushar_verma
Contributor I

I have tried working upon sample code of zigbee 3.0 coordinator and router from SDK version 2.0 but couldn't rectify the code to generate any data/message for transmission from coordinator to router and vice versa. I am using MCUXpresso IDE, Please let me know which functions from which file can be used for data transmission and from where we can call them. as these examples are command based.

ラベル(2)
0 件の賞賛
返信
22 返答(返信)

748件の閲覧回数
tushar_verma
Contributor I

Hi Sir,

I have implemented data receive and data send function on both coordinator and router application 
void Send_Data(uint8* data,uint8 len){

         uint8 pSeqNum;
         uint8 value = 40;
         PDUM_thAPduInstance hAPduInst = PDUM_hAPduAllocateAPduInstance(apduZDP);
         uint16 u16Offset = 0;
         uint16 i;
 
         int PDUM_STATE = PDUM_eAPduInstanceSetPayloadSize(hAPduInst, len);
 
         if(PDUM_STATE == 0)
            DBG_vPrintf(TRUE, "PDUM_OK\n");
         else
            DBG_vPrintf(TRUE, "PDUM_STATE %d\n",PDUM_STATE);
 
         for (i = 0; i < len; i++) {
         u16Offset += PDUM_u16APduInstanceWriteNBO(hAPduInst, u16Offset,"a", *(data + i));
         DBG_vPrintf(TRUE, "%c", *(data + i));
         }
 
         DBG_vPrintf(TRUE, "Size : %d\n Sending : \n", PDUM_u16APduInstanceGetPayloadSize(hAPduInst));
 
         if (hAPduInst == PDUM_INVALID_HANDLE){
               DBG_vPrintf(TRUE, "PDUM_INVALID_HANDLE\n");
               return;
         }
         else {
        for(uint16_t pos = 0; pos < u16Offset; pos++) {
                    DBG_vPrintf(TRUE, "------%c", hAPduInst->au8Storage[pos]);
                }
           ZPS_teStatus eStatus;
           ZPS_teAplAfSecurityMode eSecurityMode = (ZPS_E_APL_AF_SECURE_NWK);
 
           eStatus = ZPS_eAplAfBroadcastDataReq(hAPduInst,
                                        0x0013,
                                                0x01,
                                                0x01,
                                                ZPS_E_BROADCAST_ZC_ZR,
                                                eSecurityMode,
                                                0,
                                                &pSeqNum
                                                );
 
           if(eStatus != ZPS_E_SUCCESS)
           DBG_vPrintf(TRUE, "ZPS_E_state %x\n",eStatus);
           else if(eStatus == ZPS_E_SUCCESS)
           DBG_vPrintf(TRUE, "Send success\n");
     PDUM_eAPduFreeAPduInstance(hAPduInst);
}
}

void vDataReceive(PDUM_thAPduInstance hAPduInst)
{
shell_write("In Received\n");
    uint16 u16Offset = 0;
    uint16 payloadSize = PDUM_u16APduInstanceGetPayloadSize(hAPduInst);
 
    DBG_vPrintf(TRUE,"Payloadsize = %d\n",payloadSize);
 
     uint8 value = 0;
   // char *receivedString = (char *)malloc(payloadSize + 1);
 
         PDUM_u16APduInstanceReadNBO(hAPduInst,u16Offset,"b",&value);
         //receivedString[payloadSize] = '\0';
 
    PDUM_eAPduFreeAPduInstance(hAPduInst);
    DBG_vPrintf(TRUE, "Received Data: data = %d\n", value);
   // free(receivedString);
}

I am calling data receive function in CASE ZPS_EVENT_APS_DATA_INDICATION: 
I want to send string data from coordinator to router and vice versa, while sending data it is showing 
ZCL_Task endpoint event:1
BDB: APP_vGenCallback [1 1]
In data Indication
Read: 1, Data:

But not receiving data please let me know where i am going wrong, is it there any problem in using specific cluster id or i am calling receive function at wrong place?

0 件の賞賛
返信

705件の閲覧回数
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

There should not be any problem by using a custom cluster ID, but can you please try with a default cluster ID.

Also I recommend for debug proposes to use an sniffer, do you have a KW41 dongle?

And if you have one please share with me the captures from the sniffer.

0 件の賞賛
返信