Topic

FAQ
Login Register
TLSR8258 - ZigBee, multiple enpoints problem
Jul 18, 2022 07:13

/

A

/A

I have the following endpoint registration:

/* Register ZCL specific cluster information */

zcl_register(LIGHT_ENDPOINT1, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);
zcl_register(LIGHT_ENDPOINT2, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);
zcl_register(LIGHT_ENDPOINT1_2, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);


When I compile and run the firmware, I have only endpoints LIGHT_ENDPOINT1 and LIGHT_ENDPOINT2 working.

Endpoint LIGHT_ENDPOINT1_2 is not received/processed!


I have decided to change the order of registration of endpoints:


/* Register ZCL specific cluster information */


zcl_register(LIGHT_ENDPOINT1_2, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);

zcl_register(LIGHT_ENDPOINT1, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);
zcl_register(LIGHT_ENDPOINT2, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);



And now, only LIGHT_ENDPOINT1_2 and LIGHT_ENDPOINT1 work.

Endpoint LIGHT_ENDPOINT2 doesn t work!


Another problem is that only 1 (first registered endpoint) works with level control)!


Why only 2 endpoints work for ON/OFF control?

Why only 1 endpoint works for Level Control?

Can I have more than 2 endpoints registered?


Edit:

I did some more checking.

I have modified function zcl_register so it return 0 or 1 depending on the result:

_CODE_ZCL_ u8 zcl_register(u8 endpoint, u8 clusterNum, zcl_specClusterInfo_t *info) {

  zcl_specClusterInfo_t *p = info;

  for(u32 i = 0; i < clusterNum; i++){

    if(p->clusterRegisterFunc){

      if(p->clusterRegisterFunc(endpoint, p->manuCode, p->attrNum, p->attrTbl, p->clusterAppCb) == ZCL_STA_INSUFFICIENT_SPACE){

         return 0;

     }

   } p++;

 }

 return 1;

}


And in my project changed to:

/* Register ZCL specific cluster information */

u8 result;

result = zcl_register(LIGHT_ENDPOINT1_2, LIGHT_CB_CLUSTER_NUM1_2, (zcl_specClusterInfo_t *)g_LightClusterList1_2);

if(result == 0){

 led_on(LED1);

} else{

 led_off(LED1);

}

result = zcl_register(LIGHT_ENDPOINT1, LIGHT_CB_CLUSTER_NUM1, (zcl_specClusterInfo_t *)g_LightClusterList1);

if(result == 0){

 led_on(LED2);

 } else{

 led_off(LED2);

}

result = zcl_register(LIGHT_ENDPOINT2, LIGHT_CB_CLUSTER_NUM2, (zcl_specClusterInfo_t *)g_LightClusterList2);

if(result == 0){

 led_on(LED3);

} else{

 led_off(LED3);

}


The result is:

After the fist call to zcl_register - result = 1 Success!

After second call to zcl_register - result = 0 ZCL_STA_INSUFFICIENT_SPACE

After third call to zcl_register - result = 0 ZCL_STA_INSUFFICIENT_SPACE


So what is going on with this?


1 replies
wes58 [Author] Jul 19, 2022 14:29
0
/A

Issue solved!

I have found that in the function zcl_registerCluster(), there is the following code:

  if(zcl_vars.clusterNum >= ZCL_CLUSTER_NUM_MAX){

    return ZCL_STA_INSUFFICIENT_SPACE;

  }

So, I was getting ZCL_STA_INSUFFICIENT_SPACE because of ZCL_CLUSTER_NUM_MAX.

ZCL_CLUSTER_NUM_MAX is defined in the stack_cfg.h, and in the example was set to 11. Increasing this value, fixed the problem with zcl_register for 3 endpoints that I had!

So now ON/OFF commands and level control works for all endpoints