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.

Include a command in the example sample app for messaging between ESP and Simple Metering

Hello,

In the application I'm working, I need to send the coordinator requesting data from the router device command. Used as the basis GetProfileCmd GetProfileRsp and commands used in the sample design and app Simple ESP Metering. But the messaging is not occurring as expected.

In debug, when the coordinator sends the command created, is entering the stretch of the zcl.c code:

ZStatus_t zcl_SendCommand (uint8 srcEP, afAddrType_t * destAddr,
                            ClusterID uint16, uint8 cmd, specific uint8, uint8 direction,
                            disableDefaultRsp uint8, uint16 Manucode, uint8 seqNum,
                            cmdFormatLen uint16, uint8 * cmdFormat)
{
   * endPointDesc_t epDesc​​;
   zclFrameHdr_t hdr;
   uint8 * msgBuf;
   uint16 msglen;
   uint8 * pBuf;
   uint8 options;
   ZStatus_t status;

   epDesc ​​= afFindEndPointDesc (srcEP);
   if (NULL == epDesc​​)
   {
     return (ZInvalidParameter); // EMBEDDED RETURN
   }

My question is:
1) Because this error is occurring if I just include the command as another in the set of commands zcl_se?

2) I need to create a zcl only for this new command? I would like to include it as one more command in ZCL_SE.


I even studied the example zcl manu spec, but with these doubts remain regarding the inclusion of new commands in zcl_se.

Thanks to anyone who can help me with these questions,

  • Sorry, but I am struggling to understand your problem. What is the error you mention?

    Does zcl_SendCommand  return the ZInvalidParameter from:

       epDesc ​​= afFindEndPointDesc (srcEP); 
       if (NULL == epDesc​​) 
       {
         return (ZInvalidParameter); // EMBEDDED RETURN 
       }

    If so then you need to use the same SrcEP as the one you registered.

    Regards, TC.

     

     

  • Thanks for the feedback!
    Yes, the error is within the routine return ZInvalidParameter in zclSendCommand. I'm stating the command the same endpoint 0x09, but I'm also having this error.


    Sorry, but that would get me this question: Can I add new commands in zcl_se cluster?

    Thank you,

  • Vanessa Borba said:
    Sorry, but that would get me this question: Can I add new commands in zcl_se cluster?

    I do not see how this would help with this issue. If 

    afFindEndPointDesc (srcEP); 

    is returning ZInvalidParameter, then it is because you have not called:

      epDesc = osal_mem_alloc( sizeof ( endPointDesc_t ) );
      if ( epDesc )
      {
        // Fill out the endpoint description.
        epDesc->endPoint = simpleDesc->EndPoint;
        epDesc->task_id = &zcl_TaskID;   // all messages get sent to ZCL first
        epDesc->simpleDesc = simpleDesc;
        epDesc->latencyReq = noLatencyReqs;
    
        // Register the endpoint description with the AF
        return afRegister( epDesc );

    With the same end point number.

    But to answer your question, technically yes, but why would you want to do this? You should copy an existing cluster command in zcl_se.c change it to suit your need and set the manufacturer specific bit.

    Regards, TC.