cancel
Showing results for 
Search instead for 
Did you mean: 

Zigbee End Device Loosing Connection in Sleepy Mode

user5
Associate II

Hey,

im developing a zigbee sleepy end device. The device is supposed to periodically send sensor values (max length of 512bytes) read via I2C to the coordinator using the custom cluster. I use the HW_TS to trigger the sensor readings and sending the message. After a few messages (~8-20) the sleepy end device messages start to not arrive in time or at all and out of order, ending with the end device hanging up and being removed from the network by the coordinator.

Errors.JPG

What I have tried:

  • Disabling sleepy mode -> resolves the issue, but not acceptable due to energy consumption
  • Using the SE Messaging Cluster with burst messages -> no change
  • Using fastPolling -> as expected, no change
  • Playing around with interrupt priorities, especially sysTick Timer set to highest prioity. My current setup:
    nvic.JPG

    I would appreciate any advice on what might cause this issue or what else I could try to avoid wrongly timed/garbled messages from the SEDs!

    Best regards
1 ACCEPTED SOLUTION

Accepted Solutions
Ouadi
ST Employee

Hi @user5,

From the logs attached, it seems that the device is removed from the network by the parent as it is no more active ( no keepalive messages),

From my understanding, the sensor values read from I2C are sent manually to the coordinator over ZigBee, in this case, the application should manage zb requests timing properly and make sure to wait for a response callback to avoid any unexpected behavior on the stack side.

Please note that the best approach for such application is to configure the attribute as a reportable with a defined period or only on change, this allows to manage timing and the sleep mode as well accurately.

Best regards,

Ouadi

View solution in original post

10 REPLIES 10
Ouadi
ST Employee

Hi @user5,

From the logs attached, it seems that the device is removed from the network by the parent as it is no more active ( no keepalive messages),

From my understanding, the sensor values read from I2C are sent manually to the coordinator over ZigBee, in this case, the application should manage zb requests timing properly and make sure to wait for a response callback to avoid any unexpected behavior on the stack side.

Please note that the best approach for such application is to configure the attribute as a reportable with a defined period or only on change, this allows to manage timing and the sleep mode as well accurately.

Best regards,

Ouadi

Is there examples or guidance on how to setup attribute reporting on custom clusters?

user5
Associate II

On the server side it gives me error ZCL_STATUS_UNREPORTABLE_ATTRIBUTE for:

ZbZclAttrStringWriteLong(zigbee_app_info.custom_ls_client, ZCL_CUSTOM_LS_ATTR, teststr);

On the client side I get ZCL_STATUS_TIMEOUT for:
APP_ZIGBEE_ReportConfig() if i set report.dst.nwkAddr = 0xFFFF;
If report.dst.nwkAddr = 0x0000; its successful. Why?

Can I get more documentation on how to configure a custom cluster with attribute reporting?

Ouadi
ST Employee

If the attribute is not configured as a reportable, you will get the status ZCL_STATUS_UNREPORTABLE_ATTRIBUTE as you mentioned. 

You will find more details on the attribute reporting following this Wiki page link: Attribute Reporting 

The implementation is the same for a custom cluster or a standard cluster. 

Regards,

Ouadi

user5
Associate II

I tried to add a custom attribute:

 

static const struct ZbZclAttrT ZclTemp_AttrList[] = {
{
MY_ZCL_DEV_LS, ZCL_DATATYPE_STRING_LONG_CHARACTER,
ZCL_ATTR_FLAG_REPORTABLE | ZCL_ATTR_FLAG_WRITABLE,
0, // custom size
NULL, // callback
{0, 0}, //no value range
{5, 10}
}
};

but when adding it via

ZbZclAttrAppendList(zigbee_app_info.custom_ls_client,ZclTemp_AttrList, ZCL_ATTR_LIST_LEN(ZclTemp_AttrList));

i get ZCL_STATUS_INVALID_DATA_TYPE.

What can I do to make the custom string attribute reportable or add a new reportable string attribute?

 

 

The parameter custom size is missing in your definition of ZclTemp_AttrList that should not be null as follow : 

/**
 * The structure used to initialize a ZCL attribute when calling ZbZclAttrAppendList.
 */
struct ZbZclAttrT {
    uint16_t attributeId; /**< The attribute ID */

    enum ZclDataTypeT dataType;
    /**< The attribute data type (ZCL_DATATYPE_UNKNOWN if last entry) */

    ZclAttrFlagT flags; /**< Attribute flags (e.g. writeable, reportable, etc) */

    unsigned int customValSz;
    /**< A custom size is required if the data type is one of:
     *    ZCL_DATATYPE_STRING_OCTET,
     *    ZCL_DATATYPE_STRING_CHARACTER,
     *    ZCL_DATATYPE_STRING_LONG_OCTET,
     *    ZCL_DATATYPE_STRING_LONG_CHARACTER,
     *    ZCL_DATATYPE_ARRAY,
     *    ZCL_DATATYPE_STRUCT,
     *    ZCL_DATATYPE_SET,
     *    ZCL_DATATYPE_BAG
     *
     * A custom size is also required if both customRead and customWrite callbacks
     * are provided and ZCL_ATTR_FLAG_PERSISTABLE is set.
     *
     * The maximum size is the length returned by ZbZclClusterGetMaxAsduLength() or
     * the cluster's maxAsduLength parameter. It should not exceed
     * ZB_APS_CONST_MAX_FRAG_SIZE. */

Best regards,

Ouadi 

user5
Associate II

Hi, thanks for the patience.

I was able to setup a new reportable custom ls attribute and write to it successfully.

Now I am trying to orientate on the Zigbee_TempMeas_Client_Router/Zigbee_TempMeas_Server_Coord examples with the difference, that Client is Coordinator and Server are the sleepy end devices.

 

I didnt change the examples naming for testing:
I made my coordinator execute APP_ZIGBEE_ReportConfig with report.dst.nwkAddr = 0x0000;, which is successful and execute APP_ZIGBEE_Read_Temp_Attribute with readReq.dst.nwkAddr = 0xFFFF;. Unfortunately, APP_ZIGBEE_Temp_Meas_Read_cb returns "[TEMP MEAS] Error, No attribute read", expect for the first time, the end device connects to the coordinator. What setting might I be messing here?


Any help possible?