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.

sending bulk of data on zigbee

Other Parts Discussed in Thread: CC2538, Z-STACK

Hello everyone,

Greeting for the Day !!!!

i hav one buffer of size 140 Kbyte and storing some data in it. now i want to send this buffer data over zigbee from one device to other device in a periodic interval .

for ex - if in every 1 sec i want to  send this buffer data from ZED to ZC then how can i do this ?

i am using zstack HA 1.2 and cc2538, and using sample thermostat (ZC)  and sample temp (ZED)  as a reference code .

i know that to accomplish this task i need to send data in a loop but any one has any idea how can i do this ? what are the changes i need to do in ZED and ZC side.

plz help me to complete this task....

Thanks & Regards,

Maneesh singh

  • Hi,

    ZigBee is not a protocol for bulk data transfer at fast speeds - it can do max 250kbps.CC2538 has max 32K RAM, you won't be able to fit 140K buffer on the device. "AF_DataRequest" API is used to send data . Please consult the developers guide and the sample example source code.


    Saurabh

  • Hi  Saurabh,

    Thanks for your reply...

    u are right but what i was planning to do ->

    1) read some 1K or 2K data from SD-CARD and fill it in the buffer

    2) now send this 1K or 2K buffer data over zigbee

    3) again read data from SD-CARD and fill it in the buffer and send it over zigbee.

    4) this process continue until all the data from SD-CARD is not transmitted...

    5) periodicity may  be 1sec or 2 sec or 5sec that not a much problem...

    Now i want to know how can i send this buffer data over zigbee becoz in Temp sensor ref code they are sending approx 2byte of data....

    any suggestion or Pseudo -code will be highly appreciated...

    thanks & Regards,

    Maneesh singh 

     

  • You can download Z-STACK-MESH 1.0.0. There is GenericApp example show you send "Hello World" using AF_DataRequest.

  • Hello YiKai Chen sir,

    Thanks for Reply !!

    1) Is Z-STACK-MESH 1.0.0 is zigbee Home automation profile based or private profile based stack? what is the difference between zigbee mesh stack and zigbee HA stack

    2) if i'll use sample temp sensor and thermostat as a reference then is this possible to use  AF_DataRequest cmd for sending data ? becoz in sample temp they used  zcl_SendReportCmd to send the data..... 

    3) where i can get description or detail of  AF_DataRequest cmd .

    4) if i am using Generic App then is this possible to send any ON/OFF cmd or toggle cmd from ZC to ZED

    Regards,

    Maneesh

     

  • 1. Z-Stack mesh is private profile. The difference is profile only.

    2. Yes, you still can use AF_DataRequest.

    3. Z-Stack API.pdf

    4. Yes.

  • Hello sir,

    As u suggested i am using AF_DataRequest in temp sensor code as below ->

    i took the reference from the Generic app.....

    plz correct me if i am wrong or doing any mistake... 

    my code at temp side is ->

    1) in eventloop fn

    case ZDO_STATE_CHANGE:

    .............

    // Start sending "the" message in a regular interval.
    osal_start_timerEx ( zclSampleTemperatureSensor_TaskID,
                                         SAMPLETEMPERATURESENSOR_SEND_MSG_EVT,
                                         SAMPLETEMPERATURESENSOR_SEND_MSG_TIMEOUT );

    case AF_INCOMING_MSG_CMD:
    GenericApp_MessageMSGCB( MSGpkt );
    break;

    2) 

    static void zclSampleTemperatureSensor_SendTemp( void )
    {
               char theMessageData[] = "Maneesh singh"; 

    if ( AF_DataRequest( &zclSampleTemperatureSensor_DstAddr, &sampleTemperatureSensor_TestEp,
    ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
    (byte)osal_strlen( theMessageData ) + 1,
    (byte *)&theMessageData,
    &zclSampleTemperatureSensor_TransID,
    AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {
    // Successfully requested to be sent.
    }
    else
    {
    // Error occurred in request to send.
    }
    }

    3) and for receiving data from thermostat ->

    static void zclSampleTemperatureSensor_MessageMSGCB( afIncomingMSGPacket_t *pkt )
    {
    switch ( pkt->clusterId )
    {
    case ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT:
    // "the" message

    UARTprintf ("Received data is = %s\n", (char*)pkt->cmd.Data);

    break;
    }
    }

     

    And Same Steps will be repeated for thermostat side. so that i can send data from temp sensor to thermostat and get data from thermostat to temp sensor.

    is my above steps are correct sir ? do i need to do any other changes also in my code somewhere ?

     


    Thanks & regards,

    Maneesh singh

  • hello yikai sir,

    plz tell me sir is my above steps are correct or not?

    plz reply sir...

    Thanks & Regards,

    Maneesh singh

  • Your pseudo code looks OK.

  • Hello sir,

    1) i am trying to send array data from temp sensor to thermostat.. for that i did following modification in my code plz check whether my code is correct or not ->

    Temp sensor side ->

    int i = 0;   /////local variable for loop
    int8 newarr[] = {1,2,3,4,5,6,7} ;  //////  my int array buffer

     
    if(pReport != NULL)
    {
    pReportCmd->numAttr = 1;
    pReportCmd->attrList[0].attrID = ATTRID_MS_TEMPERATURE_ARRAY_VALUE;
    pReportCmd->attrList[0].dataType = ZCL_DATATYPE_ARRAY;

    if ( i = 0; i<7; i++) ///// for loop for sending array data sequentially
    {
    pReportCmd->attrList[0].attrData = (void *)(&newarr[i]);

    zcl_SendReportCmd( SAMPLETEMPERATURESENSOR_ENDPOINT, &zclSampleTemperatureSensor_DstAddr,
    ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
    pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, zclSampleTemperatureSensorSeqNum++ );

    }
    }

    and Thermostat side ->

    if ( pInTempSensorReport->attrList[0].attrID == ATTRID_MS_TEMPERATURE_ARRAY_VALUE )

       if (pInTempSensorReport->attrList[0].dataType==ZCL_DATATYPE_ARRAY)

      {

            for(i = 0; i<7; i++)
            {
                   UARTprintf("received Data is %d\n", (pInTempSensorReport->attrList[0].attrData[i]));


             }
      }
    }


    I just want to send array of data from temp sensor side and want to receive at thermostat side..

    plz verify whether my code is correct or not ? if any changes is needed plz let me know...

    2) will you plz tell me how many bytes of maximum data i can send from zcl_SendReportCmd() ?

    Thanks & Regards,

    Maneesh singh