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
  • Meanwhile I managed to create a Wireshark nRF Sniffer log. There can be seen
    - t=50 s: Request Tunnel
    - t=51 s: Request Tunnel Response
    (- t=53 s: Client Transfer Data expected, RET_ERROR)
    (- t=55 s: Server Transfer Data expected, RET_ERROR)
    - t=57 s: Close Tunnel

    tunnel.pcapng

  • Hello,

    I am sorry for the late reply.

    Where is the RET_ERROR coming from? Do you see them in your log? What function or callback do they point you to?

  • RET_ERROR results from the calls of ZB_ZCL_TUNNELING_CLIENT_SEND_TRANSFER_DATA and ZB_ZCL_TUNNELING_SERVER_SEND_TRANSFER_DATA, respectively (client and server functions tunnel_send_transfer_data after tunnel is established).

    Client:

    <info> app: tunnel_request: 4
    <info> app: tunnel_request_cb: 4
    <info> app: zb_tunnel_endpoint_handler: 0
    <info> app: Tunneling request response: 72/0/0
    <info> app: Transfer data: 72/11
    <info> zboss: 07 00 00 00 DE AD 0A 02|........
    <info> zboss: D8 06 24 00 BD F8 30 01|..$...0.
    <info> zboss: DE AD 0E 02 B4 02 23 00|......#.
    <info> zboss: 7A 6E 7D 01 04 00 00 00|zn}.....
    <error> app: ERROR 1 [RET_ERROR] at ../../../main.c:393

    Server:

    <info> app: zb_tunnel_endpoint_handler: 0
    <info> app: Tunneling request: 200/3910/0
    <info> app: Tunneling request response
    <info> app: Transfer data: 72/11

    <info> zboss: 06 00 00 00 DE AD 0E 02|........
    <info> zboss: 47 0A 24 00 BB F8 05 02|G.$.....
    <error> app: ERROR 1 [RET_ERROR] at ../../../main.c:321

Reply
  • RET_ERROR results from the calls of ZB_ZCL_TUNNELING_CLIENT_SEND_TRANSFER_DATA and ZB_ZCL_TUNNELING_SERVER_SEND_TRANSFER_DATA, respectively (client and server functions tunnel_send_transfer_data after tunnel is established).

    Client:

    <info> app: tunnel_request: 4
    <info> app: tunnel_request_cb: 4
    <info> app: zb_tunnel_endpoint_handler: 0
    <info> app: Tunneling request response: 72/0/0
    <info> app: Transfer data: 72/11
    <info> zboss: 07 00 00 00 DE AD 0A 02|........
    <info> zboss: D8 06 24 00 BD F8 30 01|..$...0.
    <info> zboss: DE AD 0E 02 B4 02 23 00|......#.
    <info> zboss: 7A 6E 7D 01 04 00 00 00|zn}.....
    <error> app: ERROR 1 [RET_ERROR] at ../../../main.c:393

    Server:

    <info> app: zb_tunnel_endpoint_handler: 0
    <info> app: Tunneling request: 200/3910/0
    <info> app: Tunneling request response
    <info> app: Transfer data: 72/11

    <info> zboss: 06 00 00 00 DE AD 0E 02|........
    <info> zboss: 47 0A 24 00 BB F8 05 02|G.$.....
    <error> app: ERROR 1 [RET_ERROR] at ../../../main.c:321

Children
No Data
Related