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.

CCS/CC2652R: AF_DataRequest in z-stack3.0.1

Part Number: CC2652R

Tool/software: Code Composer Studio

Hi, I am trying to send an "Hello World" custom packet with the AF_DataRequest commend. I'm using the zed_light and zc_switch and trying to send the packet from the light to the switch. I wait for my device to bind before i try to send my DataRequest. Here some of the code I use to send Data. I tried adding a Breakpoint in afBuildMSGIncoming but it won't hit. Thanks in advance for the Help.

if(keysPressed == KEY_RIGHT)
    {
        uint8 SampleLightApp_TransID=0;
        test();
        char theMessageData[]="Hello World";
        AF_DataRequest( &zclSampleLight_DstAddr,
                        &zclSampleLightEpDesc,
                        ZCL_CLUSTER_ID_GEN_BASIC,
                        (byte)osal_strlen( theMessageData ) + 1,
                        (byte *)&theMessageData,
                        &SampleLightApp_TransID,
                        AF_DISCV_ROUTE,
                        AF_DEFAULT_RADIUS );
    }
// Set destination address to indirect
  zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
  zclSampleLight_DstAddr.endPoint = 0;
  zclSampleLight_DstAddr.addr.shortAddr = 0;

  //Register Endpoint
  zclSampleLightEpDesc.endPoint = SAMPLELIGHT_ENDPOINT;
  zclSampleLightEpDesc.simpleDesc = &zclSampleLight_SimpleDesc;
  zclport_registerEndpoint(zclSampleLight_Entity, &zclSampleLightEpDesc);

  • AddrNotPresent means you want to use data in BindingTable to send messages so do you do binding successfully to cluster you intend to send?
  • Yes, i'm able to toggle the light with my switch just like the exemples shows ous.
  • It only means you do binding correctly to ON/OFF cluster but I see you send message using ZCL_CLUSTER_ID_GEN_BASIC not ON/OFF cluster.
  • I change the cluster with the ZCL_CLUSTER_ID_GEN_ON_OFF, since i know that this cluster binds succesfully, but i don't hit the breakpoint i placed in afBuildMSGIncoming
  • Hi Francis,

    Can you please provide a sniffer log of your devices being commissioning and being bound? This will be of great assistance for us.

    For reference, please consider the following as noted in the Zigbee Cluster Library Specification (0751234) Section 2.2.2 Client/Server Model

    "A type 1 cluster's primary function is to initiate transactions from the client to the server. For example, an On/Off client sends commands (data) to the On/Off server. A type 2 cluster's primary function is to initiate transactions from the server to the client. For example, a temperature measurement server reports to the temperature measurement client."

    The ZED light, ZC switch is by default acting as a type 1 cluster. The switch binds to the light, therefore being able to send a data packet to the light. The light does not know the switch's address and is not bound to the switch. Binding is one way.

    In order to what what you're wanting to be able to do, you need to ensure that the light is the one binding the switch, requiring your own manual bind rather than using the default Finding & Binding mechanism.

    Best,

    Sean

  • Francis, Sean gives you thoroughly explanation on ZCL client/server architecture and I agree that is the problem that you failed to send message.
  • Thanks Sean and YK for the help.

    I want to do a packet error rate in zigbee and i am trying to send a Hello World as my packet. If I understand correctly I can send the AF_DataRequest from the switch to the light since that the way my cluster type works.

  • Yup, if you keep the existing client/server architecture that were in the Light/Switch examples, you should be able to use the AF_DataRequest from switch->Light!