This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ZCL Tunneling - RequestTunnel not received

I am trying to establish a tunnel from ZigBee client to ZigBee server on nRF52840 using "nRF5 SDK for Thread and Zigbee v4.1.0".

Starting with the examples "examples\zigbee\light_control\light_bulb" (server) and "light_switch" (client) a HA_DIMMABLE_LIGHT_ENDPOINT connection gets established.

Establishing a tunnel fails, the server does not even receive the RequestTunnel message (on ZB_ZCL_TUNNELING_SEND_REQUEST_TUNNEL)  though from my point of view, the server is set up correctly. Is there any example code available showing how to utilize ZigBee ZCL Smart Energy Tunneling?

This is how the server is set up:

#define TUNNELING_ENDPOINT_ID 11
#define TUNNELING_PROFILE_ID 0x10a
#define TUNNELING_DEVICE_ID 0x500
ZB_ZCL_DECLARE_TUNNELING_ATTRIB_LIST(tunneling_attr_list, &m_dev_ctx.tunneling_attr.close_tunnel_timeout);
zb_zcl_cluster_desc_t tunneling_clusters[]={
    ZB_ZCL_CLUSTER_DESC(ZB_ZCL_CLUSTER_ID_TUNNELING,
        ZB_ZCL_ARRAY_SIZE(tunneling_attr_list, zb_zcl_attr_t),
        tunneling_attr_list,
        ZB_ZCL_CLUSTER_SERVER_ROLE,
        MANUF_CODE)
};
zb_af_simple_desc_1_1_t simple_desc_tunnel={
    TUNNELING_ENDPOINT_ID,
    TUNNELING_PROFILE_ID,
    TUNNELING_DEVICE_ID,
    1, 0,
    1, 0,
    { ZB_ZCL_CLUSTER_ID_TUNNELING }
};
ZB_AF_DECLARE_ENDPOINT_DESC(tunneling_ep, TUNNELING_ENDPOINT_ID,
    TUNNELING_PROFILE_ID, 0, NULL,
    ZB_ZCL_ARRAY_SIZE(tunneling_clusters, zb_zcl_cluster_desc_t), tunneling_clusters,
    &simple_desc_tunnel,
    0, NULL, 0, NULL);
ZBOSS_DECLARE_DEVICE_CTX_2_EP(dimmable_light_ctx, dimmable_light_ep, tunneling_ep);
...
ZB_AF_REGISTER_DEVICE_CTX(&dimmable_light_ctx);
ZB_ZCL_CLUSTER_ID_TUNNELING_SERVER_ROLE_INIT();
ZB_AF_SET_ENDPOINT_HANDLER(TUNNELING_ENDPOINT_ID,
  zb_tunnel_endpoint_handler); // <---- zb_tunnel_endpoint_handler never gets invoked upon client RequestTunnel

How the client is set up:

#define TUNNELING_ENDPOINT_ID 11
#define TUNNELING_PROFILE_ID 0x10a
#define TUNNELING_DEVICE_ID 0x500
#define TUNNELING_PROTOCOL_ID 200
zb_zcl_cluster_desc_t tunneling_clusters[]={
    ZB_ZCL_CLUSTER_DESC(ZB_ZCL_CLUSTER_ID_TUNNELING,
        0, NULL,
        ZB_ZCL_CLUSTER_CLIENT_ROLE,
        TUNNELING_MANUF_CODE)
};
zb_af_simple_desc_1_1_t simple_desc_tunnel={
    TUNNELING_ENDPOINT_ID,
    TUNNELING_PROFILE_ID,
    TUNNELING_DEVICE_ID,
    1, 0,
    0, 1,
    { ZB_ZCL_CLUSTER_ID_TUNNELING }
};
ZB_AF_DECLARE_ENDPOINT_DESC(tunneling_ep, TUNNELING_ENDPOINT_ID,
    TUNNELING_PROFILE_ID, 0, NULL,
    ZB_ZCL_ARRAY_SIZE(tunneling_clusters, zb_zcl_cluster_desc_t), tunneling_clusters,
    &simple_desc_tunnel,
    0, NULL, 0, NULL);
ZBOSS_DECLARE_DEVICE_CTX_2_EP(dimmer_switch_ctx, dimmer_switch_ep, tunneling_ep);

static void tunnel_request(zb_bufid_t bufid)
{
    ZB_ZCL_TUNNELING_SEND_REQUEST_TUNNEL(bufid,
        m_device_ctx.bulb_params.short_addr,
        ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
        TUNNELING_ENDPOINT_ID,
        LIGHT_SWITCH_ENDPOINT, // <--- With TUNNELING_ENDPOINT_ID, tunnel_request_cb does not get invoked!
        TUNNELING_PROFILE_ID,
        ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
        tunnel_request_cb, // <---- tunnel_request_cb gets invoked!
        TUNNELING_PROTOCOL_ID,
        MANUF_CODE,
        ZB_FALSE,
        100);
}
...
ZB_AF_REGISTER_DEVICE_CTX(&dimmer_switch_ctx);
ZB_ZCL_CLUSTER_ID_TUNNELING_CLIENT_ROLE_INIT();
ZB_AF_SET_ENDPOINT_HANDLER(TUNNELING_ENDPOINT_ID, zb_tunnel_endpoint_handler);

Parents
  • Dear Edvin,

    first of all, the intent to use Tunneling is to run proprietary protocols over ZigBee for an existing application, which is its main use case. I haven't found any example doing so, yet. The ticket you refer to does Tunneling, though there can not be seen how server and client prepare their ZigBee clusters and endpoints, etc. There instead, request tunnel seems to run properly but problems arise later during data transfer.

    In my example, tunnel_request is called from a button handler (showing no error):

    static void buttons_handler(bsp_event_t evt)
    {
        zb_ret_t zb_err_code;
        switch(evt)
        {
            case BSP_EVENT_KEY_0:
                button = LIGHT_SWITCH_BUTTON_ON;
                {
    				zb_bufid_t bufid=zb_buf_get_out_func();
    			    zb_err_code=ZB_SCHEDULE_APP_ALARM(tunnel_request, bufid, 3*ZB_TIME_ONE_SECOND);
                    ZB_ERROR_CHECK(zb_err_code);
                }
                break;
    

    On server log some output appears upon the tunnel request, i.e. something seems to be received, though the server tunnel endpoint handler does not get invoked:

    <info> zboss:  01 00 00 00 DE AD 12 02|........
    <info> zboss:  F6 0E 38 00 29 08 EA 00|..8.)...
    <info> zboss:  03 00 00 00 0B 00 00 00|........

Reply
  • Dear Edvin,

    first of all, the intent to use Tunneling is to run proprietary protocols over ZigBee for an existing application, which is its main use case. I haven't found any example doing so, yet. The ticket you refer to does Tunneling, though there can not be seen how server and client prepare their ZigBee clusters and endpoints, etc. There instead, request tunnel seems to run properly but problems arise later during data transfer.

    In my example, tunnel_request is called from a button handler (showing no error):

    static void buttons_handler(bsp_event_t evt)
    {
        zb_ret_t zb_err_code;
        switch(evt)
        {
            case BSP_EVENT_KEY_0:
                button = LIGHT_SWITCH_BUTTON_ON;
                {
    				zb_bufid_t bufid=zb_buf_get_out_func();
    			    zb_err_code=ZB_SCHEDULE_APP_ALARM(tunnel_request, bufid, 3*ZB_TIME_ONE_SECOND);
                    ZB_ERROR_CHECK(zb_err_code);
                }
                break;
    

    On server log some output appears upon the tunnel request, i.e. something seems to be received, though the server tunnel endpoint handler does not get invoked:

    <info> zboss:  01 00 00 00 DE AD 12 02|........
    <info> zboss:  F6 0E 38 00 29 08 EA 00|..8.)...
    <info> zboss:  03 00 00 00 0B 00 00 00|........

Children
No Data
Related