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/LAUNCHXL-CC1352R1: Zigbee Question about processing of incoming message

Part Number: LAUNCHXL-CC1352R1


Tool/software: Code Composer Studio

Hi TI Support Team,

I am having some confusion regarding the used functions in the zed_genericapp examples to process incoming messages.

When I am about to transmit (from concentrator) to my zigbee end device that has zed_genericapp example, and I am trying to debug print to the following functions it seems to be not working as I have been expecting:

1.) zclGenericApp_processAfIncomingMsgInd()

I was able to get a successful debug print on this function

static void zclGenericApp_processAfIncomingMsgInd(
        zstack_afIncomingMsgInd_t *pInMsg)
{
    testPrintWithInput(53); //This is just for debugging purposes. It gets triggered everytime I receive a zcl write payload
    

}

2.) zclGenericApp_ProcessIncomingMsg

On this function I wasn't able to get a successful debug print. In this function too is where I can identify if it is zcl_read or zcl_write command.

And it also says in the comment Process ZCL Foundation incoming message On what specific condition needed to call this function?

here is a snippet code from my project

static uint8_t zclGenericApp_ProcessIncomingMsg(zclIncoming_t *pInMsg)
{

    uint8_t handled = FALSE;
    testPrintWithInput(54); //this line is for debugging purposes, but it never gets triggered even if I I have already sent a zcl write command to this device.
    switch (pInMsg->hdr.commandID)
    {
#ifdef ZCL_READ
    case ZCL_CMD_READ_RSP:
        zclGenericApp_ProcessInReadRspCmd(pInMsg);
        handled = TRUE;
        break;
#endif
#ifdef ZCL_WRITE
    case ZCL_CMD_WRITE_RSP:
        zclGenericApp_ProcessInWriteRspCmd(pInMsg);
        handled = TRUE;
        break;
#endif
}

Update: I have added the source code from my project for better understanding.

Any help would be appreciated.

Thank you and Regards,

Jonathan

  • Hi Jonathan,

    If you look at zcl_ProcessMessageMSG then you will see that the endpoint and cluster ID of the incoming command must match that which is registered by zclport_registerEndpoint from zcl_genericapp.c and further defined in zcl_genericapp_data.c for the attributes and simple descriptor contents if it is to be processed by zclGenericApp_ProcessIncomingMsg.  Please refer to the other application examples and SimpleLink Academy labs for more information.  Also provide a sniffer log with the incoming messages in question if you have further inquiries.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for the response. In my case I am throwing a zcl write command from SmartThings (a zigbee coordinator) for a cluster of HVAC thermostat cluster with attribute for system mode. And as I have checked, the data that I have encoded in the zcl write command from smartthings was supposed to match one of the cluster list. But still it doesn't trigger the zclGenericApp_ProcessIncomingMsg

    And also, is it normal that whenever I trigger a zcl command for onoff cluster, it doesn't trigger too the zclGenericApp_ProcessIncomingMsg? But the callbacks for zcl onoff cluster gets triggered.

    And also to add information, I haven't implemented binding for the hvac thermostat with attribute for system mode. Do I need to create a binding for it to trigger the zclGenericApp_ProcessIncomingMsg?

    Regards,

    Jonathan

  • Hey Jonathan,

    Binding should not be required.  I  advise that you follow the zed_thermostat example, specifically  zcl_samplethermostat_data.c file for cluster and attribute initialization.  You could even attempt to join and debug an out-of-box example to determine whether zclSampleThermostat_ProcessIncomingMsg is entered and then migrate accordingly.  You can also break inside zcl_ProcessMessageMSG to make sure the message is handled as expected.

    Edit: Binding could be required after further investigation

    Regards,
    Ryan

  • Hi Ryan,

    Thank you, I will begin my investigation on thermostat examples.

    But I do have one question

    what is the difference between zclGenericApp_processAfIncomingMsgInd and zclGenericApp_ProcessIncomingMsg?


    In the zed_samplelight example, when I haven't done binding, I am receiving the command in zclGenericApp_processAfIncomingMsgInd only.

    But after the binding I am now able to trigger zclGenericApp_ProcessIncomingMsg  as well.

     

    Regards,

    Jonathan

  • zclGenericApp_processAfIncomingMsgInd processes all AF incoming messages and zclGenericApp_ProcessIncomingMsg only processes ZCL related messages.

  • Hi YK Chen,


    Thank you for that information. Can you also explain this condition?


    In the zed_samplelight example, when I haven't done binding, I am receiving the command in zclGenericApp_processAfIncomingMsgInd only.

    But after the binding I am now able to trigger zclGenericApp_ProcessIncomingMsg  as well.

    Regards,

    Jonathan

  • I would say the device sends ZCL packets after you do binding.

  • Hi Y-K Chen,

    But why it can't trigger zclGenericApp_ProcessIncomingMsg  whenever I am sending zcl_read / zcl_write command from smartthings to my device?

    Regards,

    Jonathan

  • Do you use sniffer to check if your ZCL command is sent correctly?

  • Hi YK Chen,

    I can confirm in my packet sniffer that it transfer the zcl_write command for thermostat cluster. And the end device did respond with an acknowldegement.

    But it didnt trigger the zclGenericApp_ProcessIncomingMsg.

     

    Below is the image of the packet sniffer 

    Regars,

    Jonathan

  • Can you attach your sniffer log? By the way, do you add related cluster support into your device which would process zclGenericApp_ProcessIncomingMsg?

  • Hi YK-Chen,

    Here is my the packet sniffer log (generated from wireshark). I had a zcl_write for thermostat at line 4009.

    For the simple description I have added the clusters for the thermostat.

    I also will be attaching the genericapp_data.c and the genericapp.c (though I have renamed it to task_zcl_data.c and task_radio_zb.c)

    I hope you could help me to pinpoint if I have missed something in the code.

    Thank you,

    Jonathan

    Jonathan sniffer log and code.zip

  • Hi Jonathan,

    Are you able to enter zclSampleThermostat_ProcessIncomingMsg of a default example with your SmartThings sending a zcl_write command?  If so then you should be able to use the thermostat code as a template.  Note that the attributes listed in the AttrRec must be in ascending order per cluster to allow right function of the Foundation discovery commands.

    Regards,
    Ryan

  • Part Number: LAUNCHXL-CC1352R1

    Tool/software: Code Composer Studio

    Hi TI Support Team,

    I came into a problem wherein i am trying to capture zcl_read and zcl_write command using zcl_registerReadWriteCB().

    But it doesn't call the callback that I have entered.

    I have added breakpoint at zclProcessInReadCmd in the zcl.c file, and it seems to be just working fine in this part. But I don't quite get it why it doesnt call the callback inside zcl_registerReadWriteCB?

    I hope anyone could help me in this matter.



    Regards,

    Jonathan

  • Do you register correct endpoint using zcl_registerReadWriteCB?

  • Hi YK-Chen,

    Yes, I have verified that the registered endpoint is correct. But still it is not working as intended. What could I have missed?

  • Hi YK Chen,

    It is also weird that I couldn't capture zcl_read and zcl_write in zclSampleThermostat_ProcessIncomingMsg  of the default example of zed thermostat.

    But it is responding when it received a default response.


    In my example too, I have tried reorganizing the AttrRec  in proper order, but it seems to be the same.
    By the way was the ATTRID_CLUSTER_REVISION a mandatory attribute? Like something will not function as intended if I have missed this?

    Regards,

    Jonathan

  • Do you use sniffer to check what happens over the air? Is ZCL read/write command sent out over the air?

  • Hi Jonathan,

    Since ZCL_READ and ZCL_WRITE are defined by default I agree with YK that some sniffer logs would help with the investigation.

    The Cluster Revision is a global mandatory attribute as documented in the ZCL 7 Specification.

    Regards,
    Ryan