Zigbee Data Transmission

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Zigbee Data Transmission

760 Views
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.

Labels (2)
0 Kudos
22 Replies

442 Views
tushar_verma
Contributor I

Yes now string data is transmitting normally, But there is problem with hex data, I am sending int data_packet[] = { 0x45,0x43,0x75,0x67}
by using this code i am putting data 

for (i = 0; i < result; i++) {
uint32 reversedByte = (uint32) data_packet[i];
u16Offset += PDUM_u16APduInstanceWriteNBO(hAPduInst,u16Offset ,"la\x04", reversedByte);
DBG_vPrintf(TRUE,"-------%d",u16Offset);
DBG_vPrintf(TRUE, "%02x ", reversedByte);
}

and retrieving data 
for (int i = 0; i < payloadSize; i++)
PDUM_u16APduInstanceReadNBO(hAPduInst, u16Offset + i * sizeof(int),"w", &received[i]);
from this code but data is coming in wrong format
please let me know where i am going wrong 

0 Kudos

435 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

I'm glad to know you are able to send data.

Please find the following community post, where is explained the parameters that are required in order to send the data in a proper way.

This include the szFormat string of the data:

  • b 8-bit byte
  • h 16-bit half-word (short integer)
  • w 32-bit word l 64-bit long-word (long integer)
  • a\xnn nn (hex) bytes of data (array)
  • p\xnnnn (hex) bytes of packing ... Variable list of data values described by the format string

Note that the compiler will not correctly interpret the format string “a\xnnb” for a data array followed by a single byte, e.g. “a\x0ab”. In this case, to ensure that the ‘b’ (for byte) is not interpreted as a hex value, use the format “a\xnn” “b”, e.g. “a\x0a” “b”.

 

Please let me know if there is anything else where I can help you.

0 Kudos

381 Views
tushar_verma
Contributor I

Sure Sir,

I want to know the maximum data packet we can send over zigbee from one node to another Node in Apdu Instance ?

0 Kudos

367 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Sure, please find the following community post that can help you with this information.

Please let me know if there is anything else where I can help you.

0 Kudos

346 Views
tushar_verma
Contributor I

Please let me know if i want to send 1kb of file or buffer to any another node which function is suitable for that and do i have to change any flag for this as one maximum packet size is 100-127 byte for single transmission and how can i receive that 1kb of data.

0 Kudos

321 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

In this case if the APDU size is larger than the maximum packet size allowed on the network, in this case the APDU will be broken up into fragments (NPDUs) for transmission, for this is necessary to have enable fragmentation in the ZigBee Network by setting the parameter Maximum Number of Transmitted Simultaneous Fragmented Messages to a non-zero value.

You can find information about this, and how to implement this on the ZigBee 3.0 Stack User Guide (located on the KW41Z documentation).

Please let me know if there is anything else where I can help you.

0 Kudos

300 Views
tushar_verma
Contributor I

Hi Sir,

Thanks for the response, I have changed the parameter Maximum Number of Transmitted Simultaneous Fragmented Messages to a non-zero value on both the coordinator side and router side(Rx parameter), again tried to send larger data with the help of function 

void Send_Data(uint8_t *data, uint8_t len)
{
 
     int result = storeHexValuesInArray(data,data_packet,sizeof(data_packet) / sizeof(data_packet[0]));
     uint8 pSeqNum;
     PDUM_thAPduInstance hAPduInst = PDUM_hAPduAllocateAPduInstance(apduZDP);
     uint16 u16Offset = 0;
     uint16 i;
 
     PDUM_eAPduInstanceSetPayloadSize(hAPduInst, result*sizeof(int));
     DBG_vPrintf(TRUE, "Result %d \n", result);
     for (i = 0; i < result ; i++) {
        uint32 singleByte = (uint32)data_packet[i];
        PDUM_u16APduInstanceWriteNBO(hAPduInst, u16Offset + i * sizeof(int), "w",singleByte);
        DBG_vPrintf(TRUE, "%02x ", singleByte);
    }
 
    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 {
        ZPS_teStatus eStatus;
        ZPS_teAplAfSecurityMode eSecurityMode = (ZPS_E_APL_AF_SECURE_NWK);
 
        eStatus = ZPS_eAplAfUnicastAckDataReq(hAPduInst,
                                                                                  0x0013,
                                                                                            0,
                                                                                            0,
                                                                                  u16add,
                                                                      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);
       }
}
i am putting around 150 bytes of data into APDU but only receiving around 80 bytes, I am receiving data through this function 
void vDataReceive(PDUM_thAPduInstance hAPduInst) {
int add16 = ZPS_u16NwkNibGetNwkAddr(ZPS_pvAplZdoGetNwkHandle());
    uint16 u16Offset = 0;
    uint16 payloadSize = PDUM_u16APduInstanceGetPayloadSize(hAPduInst);
    DBG_vPrintf(TRUE, "Payloadsize = %d\n", payloadSize);
 
   for(int i = 0; i < payloadSize/4; i++)
         PDUM_u16APduInstanceReadNBO(hAPduInst, u16Offset + i * sizeof(int),"w", &received[i]);
 
   PDUM_eAPduFreeAPduInstance(hAPduInst);
 
    shell_write("Data Received for this Node\n");
    for(int i = 0; i<payloadSize/4; i++)
    DBG_vPrintf(TRUE, "%02x ",received[i]);
}

Please let me know where i am going wrong or what changes i can implement to send data about 1024 bytes.
0 Kudos

217 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Can you please help me by trying the following steps:

  1. Increase APDU size to the maximum payload size required by application.
  2. Increase FragmentationMaxNumSimulRx/FragmentationMaxNumSimulTx to the maximum fragmentation block number (integer).
  3. APS Max Window Size defines how many fragments are sent before an acknowledgment is expected. Set APS Max Windows Size to 1.

Please let me know the results of this implementation.

0 Kudos

191 Views
tushar_verma
Contributor I

Thankyou Sir for your prompt response,

I have few more query.
1.)If we have joined 10 more devices(Nodes) to the coordinator and we want to check network address of the connected devices to the coordinator how can we check that.
2.)And if we want to check endpoint for the each 10 devices how can we check that also, to which      endpoint we can send data, I have confusions about endpoints which is suitable to send data and how we can come to know that. 


0 Kudos

183 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

In this case in order to monitor and analyze the ZigBee network activity and thus check the actual structure if it you could use an sniffer for this. I would recommend on this case the USB-Dongle of KW41Z this can be  used as a sniffer along with a network analyzer program such as Wireshark.

Hope this helps, have a great day.

0 Kudos

128 Views
tushar_verma
Contributor I

Thanks for the response,

I don't have USB-KW41Z, but i do have two FRDM-KW41 board, will wireshark would work for FRDM-KW41Z board also for packet sniffing?

0 Kudos

120 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

Unfortunately this feature is not supported on the FRDM-KW41Z board. The packet sniffer features is only supported by our dongle device.

Hope you have a great day.

0 Kudos

110 Views
tushar_verma
Contributor I

Ok Sir,

Is there any other way or application to do check with packets for FRDM-KW41Z board that would be very helpful for us.

0 Kudos

98 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

For monitoring and analyze the ZigBee network activity thus check the actual structure. We can only provide as a solution a sniffer, it is not necessary to use the USB-Dongle of KW41Z any other sniffer that has the capabilities to sniff ZigBee packets will work.

0 Kudos

718 Views
tushar_verma
Contributor I

Hi Sir, 
We are using FRDM-KW41Z board and SDK version is latest only, though I had already downloaded SDK_2.2.0 for FRDM-KW41Z board, and already gone through that document (AN12061) but found nothing about data transmission
and also gone through many document but did find any help.

Please let me help regarding data transmission.  

0 Kudos

732 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Thank you for contacting NXP support.

I have the following recommendations:

  1. Please use the latest version of the SDK and MCUXpresso.
  2. Also please download the SDK documentation (that is not included in the device package).

In the SDK documentation you will find the AN12061 that describe in a more detailed way how to use the examples of the Coordinator and Router. This documentation can be found on the following path sdk_documentation->docs->wireless->ZigBee->ApplicationNotes

Also can you please confirm that you are using the KW41Z-EVK board.

0 Kudos

695 Views
tushar_verma
Contributor I

Hi Sr,

I found these functions below which seems helpful for sending data but don't know how to use them and how to initiate the communication. 
ZPS_eAplAfApsdeDataReq
ZPS_eAplAfUnicastDataReq 
ZPS_eAplAfUnicastIeeeDataReq
ZPS_eAplAfUnicastAckDataReq 
ZPS_eAplAfUnicastIeeeAckDataReq 

Please let me know how to use them and from where to call them for data transmission.

warm regards 
Tushar

0 Kudos

683 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

You can find some documentation that have the description of this functions and also explains how this should be used and how they work.

This information is located inside  the SDK documentation inside the ZigBee 3.0 Stack User Guide. On the chapter 7.1.2 Data Transfer Functions you will find each function and how each one works.
Please let me know if there is anything else where I can help you.
 

0 Kudos

654 Views
tushar_verma
Contributor I

Hello,

Yes I found these functions in the documentation, but as we are running coordinator and router application they are command based only few commands are there regarding connection formation nothing about send data or receive data, please let me know how to implement data transmission.

0 Kudos

645 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Please find the following community post that I think can help you out, with the data transmission on the ZigBee with the KW41Z.

Please let me know if you found useful this information.

0 Kudos