Zigbee Communication with Network Coordinator with Light Switch

Hi,

Am Implementing Zigbee on NRF52840 chip with help of VS Code.

Zigbee Stack : 2.5.2

I configured nrf52840 DK as Zigbee network coordinator and another custom made board which having nrf52840 configured as Zigbee light switch.

I Established connection and created Binding between both. But am not able to communicate with Light Switch from Coordinator through ZCL Commands.

Please find the attached document which i tried in shell command.

1) How to establish communication between network coordinator with end device or router using Zigbee.

please guide me to solve the issue.

2) What is the Traffic Key Zigbee coordinator Example using ? where can we change (API To change traffice Key) it?

I: nRF5 802154 radio initialized
*** Booting nRF Connect SDK v2.5.2 ***
I: Starting ZBOSS Coordinator example
I: ZBOSS Coordinator example started


uart:~$ E: Zigbee shell endpoint: 1 is not registered.
I: Production configuration is not present or invalid (status: -1)
I: Zigbee stack initialized
I: Device started for the first time
I: Start network formation
I: Unimplemented signal (signal: 54, status: 0)
I: Network formed successfully, start network steering (Extended PAN ID: f4ce365044756cb7, PAN ID: 0xb435)
I: Unimplemented signal (signal: 54, status: 0)
I: Allow pre-Zigbee 3.0 devices to join the network
I: Network steering started

  bdb                clear              device             devmem
  flash              help               history            kernel
  nbr                nrf_clock_control  resize             retval
  sensor             shell              version            zcl
  zdo
uart:~$ bdb role set zc
role: wrong parameter count
role - Set/get role.
Subcommands:
  zc   :Set Coordinator role.
  zed  :Set End Device role.
  zr   :Set Router role.
uart:~$ bdb role
zc
Done
uart:~$ bdb start
Done
uart:~$ I: Unimplemented signal (signal: 54, status: 0)
I: Allow pre-Zigbee 3.0 devices to join the network
I: Network steering started
I: Network steering finished
I: Unimplemented signal (signal: 54, status: 0)
I: Network steering finished
I: nRF5 802154 radio initialized
*** Booting nRF Connect SDK v2.5.2 ***
I: Starting ZBOSS Coordinator example
I: ZBOSS Coordinator example started


uart:~$ E: Zigbee shell endpoint: 1 is not registered.
I: Production configuration is not present or invalid (status: -1)
I: Zigbee stack initialized
I: Device started for the first time
I: Start network formation
I: Unimplemented signal (signal: 54, status: 0)
I: Network formed successfully, start network steering (Extended PAN ID: f4ce365044756cb7, PAN ID: 0x7a66)
I: Unimplemented signal (signal: 54, status: 0)
I: Allow pre-Zigbee 3.0 devices to join the network
I: Network steering started
bdb start
Done
uart:~$ I: Unimplemented signal (signal: 54, status: 0)
I: Allow pre-Zigbee 3.0 devices to join the network
I: Network steering started
bdb roI: Device update received (short: 0x9153, long: f4ce369e3f3451ab, status: 1)
lI: New device commissioned or rejoined (short: 0x9153)
I: Joining period extended.
eI: Device authorization event received (short: 0x9153, long: f4ce369e3f3451ab, authorization type: 1, authorization status: 0)
I: Unimplemented signal (signal: 54, status: 0)

  bdb                clear              device             devmem
  flash              help               history            kernel
  nbr                nrf_clock_control  resize             retval
  sensor             shell              version            zcl
  zdo
uart:~$ zdo match_desc 0xfffd 0xfffd 0x0104 1 0 0
Sending broadcast request.

src_addr=9153 ep=1
uart:~$ zdo ieee_addr 9153
f4ce369e3f3451ab
Done
uart:~$ zdo eui64
f4ce365044756cb7
Done
uart:~$ zdo mgmt_bind 9153
[idx] src_address      src_endp cluster_id dst_addr_mode dst_addr         dst_endp
Total entries for the binding table: 0
Done
Done
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 2 0 3 0
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 2 0 3I: Network steering finished
zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 I: Network steering finished
I: Unimplemented signal (signal: 54, status: 0)
zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 0x0000 9153
Done
uart:~$ zdo mgmt_bind 9153
[idx] src_address      src_endp cluster_id dst_addr_mode dst_addr         dst_endp
[  0] f4ce369e3f3451ab        1       0000           003 f4ce365044756cb7      010
Total entries for the binding table: 1
Done
uart:~$ zcl attr read 9153 1 0x0000 0x0104 0
Error: Request timed out
uart:~$ zdo match_desc 0xfffd 0xfffd 0x0104 1 0 0
Sending broadcast request.

src_addr=9153 ep=1
Done
uart:~$ zcl attr read 9153 1 0x0000 0x0104 0x00 0x21 0x0F
read: wrong parameter count
read - Send Read Attribute Zigbee command.
       Usage: read <h:dst_addr> <d:ep> <h:cluster> [-c] <h:profile> <h:attr_id>
       -c switches the server-to-client direction.
       h: is for hex, d: is for decimal.
uart:~$ zcl attr write 9153 1 0x0000 0x0104 0x00 0x21 0x0F
Error: Request timed out
uart:~$ I: Enter identify mode
zdo nwk_addr f4ce365044756cb7
Error: Network address request timed out
uart:~$ zdo match_desc 0xfffd 0xfffd 0x0104 1 0 0
Sending broadcast request.

src_addr=9153 ep=1
Done
uart:~$ zdo match_desc 0xfffd 0xfffd 0x0104 1 0 0I: Find and bind target finished (status: 0)
zdo simple_desc_req 9153 1
Sending broadcast request.

src_addr=9153 ep=1
uart:~$ zdo simple_desc_req 0x9153 1
src_addr=0x9153 ep=1 profile_id=0x0104 app_dev_id=0x104 app_dev_ver=0x0 in_clusters=0x0000,0x0003 out_clusters=0x0003,0x0005,0x0004,0x0006,0x0008 
Done
Done
uart:~$ zdo cmd f4ce369e3f3451ab 1 0x0008 -p 0x0104 0x00 -l 0affff
zdo - ZDO manipulation.
Subcommands:
  active_ep        :Send active endpoint request.
                    Usage: active_ep <h:16-bit destination_address>
  simple_desc_req  :Send simple descriptor request.
                    Usage: simple_desc_req <h:16-bit destination_address>
                    <d:endpoint>
  match_desc       :Send match descriptor request.
                    Usage: match_desc <h:16-bit destination_address>
                    <h:requested address/type> <h:profile ID> <d:number of input
                    clusters> [<h:input cluster IDs> ...] <d:number of output
                    clusters> [<h:output cluster IDs> ...] [-t | --timeout
                    d:number of seconds to wait for answers]
  nwk_addr         :Resolve EUI64 address to short network address.
                    Usage: nwk_addr <h:EUI64>
  ieee_addr        :Resolve network short address to EUI64 address.
                    Usage: ieee_addr <h:short_addr>
  eui64            :Get/set the eui64 address of the node.
                    Usage: eui64 [<h:eui64>]
  short            :Get the short address of the node.
  bind             :Create/remove the binding entry in the remote node.
  mgmt_bind        :Get binding table (see spec. 2.4.3.3.4)
                    Usage: <h:short> [d:start_index]
  mgmt_leave       :Perform mgmt_leave_req (see spec. 2.4.3.3.5)
                    Usage: mgmt_leave <h:16-bit dst_addr> [h:device_address
                    eui64] [--children] [--rejoin]
                    --children - Device should also remove its children when
                    leaving.
                    --rejoin - Device should rejoin network after leave.
  mgmt_lqi         :Perform mgmt_lqi request.
                    Usage: mgmt_lqi <h:short> [d:start index]
uart:~$ zdo
zdo - ZDO manipulation.
Subcommands:
  active_ep        :Send active endpoint request.
                    Usage: active_ep <h:16-bit destination_address>
  simple_desc_req  :Send simple descriptor request.
                    Usage: simple_desc_req <h:16-bit destination_address>
                    <d:endpoint>
  match_desc       :Send match descriptor request.
                    Usage: match_desc <h:16-bit destination_address>
                    <h:requested address/type> <h:profile ID> <d:number of input
                    clusters> [<h:input cluster IDs> ...] <d:number of output
                    clusters> [<h:output cluster IDs> ...] [-t | --timeout
                    d:number of seconds to wait for answers]
  nwk_addr         :Resolve EUI64 address to short network address.
                    Usage: nwk_addr <h:EUI64>
  ieee_addr        :Resolve network short address to EUI64 address.
                    Usage: ieee_addr <h:short_addr>
  eui64            :Get/set the eui64 address of the node.
                    Usage: eui64 [<h:eui64>]
  short            :Get the short address of the node.
  bind             :Create/remove the binding entry in the remote node.
  mgmt_bind        :Get binding table (see spec. 2.4.3.3.4)
                    Usage: <h:short> [d:start_index]
  mgmt_leave       :Perform mgmt_leave_req (see spec. 2.4.3.3.5)
                    Usage: mgmt_leave <h:16-bit dst_addr> [h:device_address
                    eui64] [--children] [--rejoin]
                    --children - Device should also remove its children when
                    leaving.
                    --rejoin - Device should rejoin network after leave.
  mgmt_lqi         :Perform mgmt_lqi request.
                    Usage: mgmt_lqi <h:short> [d:start index]
uart:~$ zdo active_ep 0x9153
src_addr=9153 ep=1 
Done
uart:~$ zcl cmd f4ce369e3f3451ab 1 0x0008 -p 0x0104 0x00 -l 0affff
Error: Request timed out
uart:~$ zdo ping f4ce369e3f3451ab 30
zdo - ZDO manipulation.
Subcommands:
  active_ep        :Send active endpoint request.
                    Usage: active_ep <h:16-bit destination_address>
  simple_desc_req  :Send simple descriptor request.
                    Usage: simple_desc_req <h:16-bit destination_address>
                    <d:endpoint>
  match_desc       :Send match descriptor request.
                    Usage: match_desc <h:16-bit destination_address>
                    <h:requested address/type> <h:profile ID> <d:number of input
                    clusters> [<h:input cluster IDs> ...] <d:number of output
                    clusters> [<h:output cluster IDs> ...] [-t | --timeout
                    d:number of seconds to wait for answers]
  nwk_addr         :Resolve EUI64 address to short network address.
                    Usage: nwk_addr <h:EUI64>
  ieee_addr        :Resolve network short address to EUI64 address.
                    Usage: ieee_addr <h:short_addr>
  eui64            :Get/set the eui64 address of the node.
                    Usage: eui64 [<h:eui64>]
  short            :Get the short address of the node.
  bind             :Create/remove the binding entry in the remote node.
  mgmt_bind        :Get binding table (see spec. 2.4.3.3.4)
                    Usage: <h:short> [d:start_index]
  mgmt_leave       :Perform mgmt_leave_req (see spec. 2.4.3.3.5)
                    Usage: mgmt_leave <h:16-bit dst_addr> [h:device_address
                    eui64] [--children] [--rejoin]
                    --children - Device should also remove its children when
                    leaving.
                    --rejoin - Device should rejoin network after leave.
  mgmt_lqi         :Perform mgmt_lqi request.
                    Usage: mgmt_lqi <h:short> [d:start index]
uart:~$ zcl ping f4ce369e3f3451ab 30
Error: Request timed out after 9900 ms.
uart:~$ zdo mgmt_bind 9153
[idx] src_address      src_endp cluster_id dst_addr_mode dst_addr         dst_endp
[  0] f4ce369e3f3451ab        1       0000           003 f4ce365044756cb7      010
Total entries for the binding table: 1
Done
uart:~$ zdo cmd f4ce369e3f3451ab 1 0x0008 -p 0x0104 0x00 -l 0affff
zdo - ZDO manipulation.
Subcommands:
  active_ep        :Send active endpoint request.
                    Usage: active_ep <h:16-bit destination_address>
  simple_desc_req  :Send simple descriptor request.
                    Usage: simple_desc_req <h:16-bit destination_address>
                    <d:endpoint>
  match_desc       :Send match descriptor request.
                    Usage: match_desc <h:16-bit destination_address>
                    <h:requested address/type> <h:profile ID> <d:number of input
                    clusters> [<h:input cluster IDs> ...] <d:number of output
                    clusters> [<h:output cluster IDs> ...] [-t | --timeout
                    d:number of seconds to wait for answers]
  nwk_addr         :Resolve EUI64 address to short network address.
                    Usage: nwk_addr <h:EUI64>
  ieee_addr        :Resolve network short address to EUI64 address.
                    Usage: ieee_addr <h:short_addr>
  eui64            :Get/set the eui64 address of the node.
                    Usage: eui64 [<h:eui64>]
  short            :Get the short address of the node.
  bind             :Create/remove the binding entry in the remote node.
  mgmt_bind        :Get binding table (see spec. 2.4.3.3.4)
                    Usage: <h:short> [d:start_index]
  mgmt_leave       :Perform mgmt_leave_req (see spec. 2.4.3.3.5)
                    Usage: mgmt_leave <h:16-bit dst_addr> [h:device_address
                    eui64] [--children] [--rejoin]
                    --children - Device should also remove its children when
                    leaving.
                    --rejoin - Device should rejoin network after leave.
  mgmt_lqi         :Perform mgmt_lqi request.
                    Usage: mgmt_lqi <h:short> [d:start index]
uart:~$ zcl cmd f4ce369e3f3451ab 1 0x0008 -p 0x0104 0x00 -l 0affff
Error: Request timed out
uart:~$ zdo simple_desc_req 0x9153 10
Error: Simple descriptor request failed
uart:~$ zdo simple_desc_req 0x9153 1
src_addr=0x9153 ep=1 profile_id=0x0104 app_dev_id=0x104 app_dev_ver=0x0 in_clusters=0x0000,0x0003 out_clusters=0x0003,0x0005,0x0004,0x0006,0x0008 
Done
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 3 
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 3 0
Error: Incorrect destination network address for the request
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 2 3 0
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 2 0 3 0
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 2 0 3 0
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 3 0 0
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 3 0 
Error: Incorrect destination network address for the request
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 3
on: wrong parameter count
on - Create bind entry.
     Usage: on <h:source_eui64> <d:source_ep> <h:destination_addr>
     <d:destination_ep> <h:source_cluster_id> <h:request_dst_addr>
uart:~$ zdo bind on f4ce369e3f3451ab 1 f4ce365044756cb7 10 0x0003 9153
Done
uart:~$ zdo mgmt_bind 9153
[idx] src_address      src_endp cluster_id dst_addr_mode dst_addr         dst_endp
[  0] f4ce369e3f3451ab        1       0000           003 f4ce365044756cb7      010
[  1] f4ce369e3f3451ab        1     0x0003           003 f4ce365044756cb7      010
Total entries for the binding table: 2
Done
uart:~$ zcl attr read 9153 1 0x0003 0x0104 0
Error: Request timed out
uart:~$ zcl attr write 9153 1 0x0003 0x0104 0x00 0x21 0x0F
Error: Request timed out
uart:~$ 
uart:~$ 
uart:~$ 

  • Hi, 

    1. Could you use Zigbee: Shell to run as coordinator to test?

    2. See this post.

    Regards,
    Amanda H.

  • hi,

    Thank you for your feedback.

    1. I configured Zigbee Shell example Proj.conf as follows.

    //CONFIG_ZIGBEE_ROLE_ROUTER = y

    CONFIG_ZIGBEE_ROLE_COORDINATOR = y

    Does i need to modify anything else in source code ?

    Because i tried to steering and device is not connecting with it.

    2. Can u tell by default which key it is using in Network Coordinator Sample?

    3. I like to ask regarding Attribute Type and Attribute ID .

    is it generating dynamically or pre-configured?

    when coordinator generate or receive or know attribute id and type of end device cluster.

    how can i know attribute id and type of end device ?

    Regards,

    Nikhil.

  • Hi, 

    1.

    NikhilVV said:
    Does i need to modify anything else in source code ?

    No. See the Testing

    NikhilVV said:
    2. Can u tell by default which key it is using in Network Coordinator Sample?

    What do you mean by the "key"? Could you elaborate in more detail?

    NikhilVV said:

    3. I like to ask regarding Attribute Type and Attribute ID .

    is it generating dynamically or pre-configured?

    when coordinator generate or receive or know attribute id and type of end device cluster.

    how can i know attribute id and type of end device ?

    Zigbee Attribute Types and Attribute IDs are pre-configured and not generated dynamically. They are defined in the Zigbee Cluster Library (ZCL) and are used to identify specific attributes within a cluster. For example, in the Zigbee dimmable light level control attribute reporting, the Attribute ID for the On/Off cluster is ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID and for the Level Control cluster, it's ZB_ZCL_ATTR_LEVEL_CONTROL_CURRENT_LEVEL_ID. These are predefined in the ZCL and used to set or get the attribute values.

    Here is an example of setting the attribute values: 

    https://github.com/nrfconnect/sdk-nrf/blob/v2.6.0/samples/zigbee/light_bulb/src/main.c#L412-L426 

    In the above code, ZB_ZCL_SET_ATTRIBUTE is a macro used to set the attribute value. The parameters include the endpoint, cluster ID, role, attribute ID, attribute value, and a flag to indicate if the attribute is reportable.

    -Amanda H.

  • Hi Amanda,

    Thank you for quick response.

    a)

    In shell Sample code i did the same but End Device is not joining to the network.

    following the steps i did.

    1. In proj.config changed 

    //CONFIG_ZIGBEE_ROLE_ROUTER = y

    CONFIG_ZIGBEE_ROLE_COORDINATOR = y

    2. builded and flashed the code.

    3. changed role to ZC  .. bdb role zc

    4. bdb start ..

    Started coordinator
    Done

    (Extended PAN ID: f4ce365044756cb7, PAN ID: 0x1205)

    5. bdb legacy enable.

    6. waited for joining device.

    7. after steering finished tried again bdb start.

    8 bdb short 

    0000

    done.

    9. ping 0000 10

    Ping time: 3 ms
    Done
    [00:01:59.551,086] <inf> zigbee.eprxzcl: Received ZCL command (0): src_addr=0x0000(short) src_ep=10 dst_ep=10 cluster_id=0xbeef profile_id=0x0104 cmd_dir=0 common_cmd=0 cmd_id=0x02 cmd_seq=0 disable_def_resp=1 manuf_code=void payload=[abababababababababab] (0)
    [00:01:59.552,734] <inf> zigbee.eprxzcl: Received ZCL command (1): src_addr=0x0000(short) src_ep=10 dst_ep=10 cluster_id=0xbeef profile_id=0x0104 cmd_dir=0 common_cmd=0 cmd_id=0x01 cmd_seq=0 disable_def_resp=1 manuf_code=void payload=[cdcdcdcdcdcdcdcdcdcd] (1)

    b) In Network coordinator we Enabled Shell and tried same and end device is connecting to coordinator and binded cluster 0x0000. but when we tried

    zcl attr read 9153 1 0x0000 0x0104 0

    Error: Request timed out

    c) Also tried with Network Coordinator (Shell Enabled)  with another( Custom Made , NOT NRF) device which is configured as router.

    That moment also Router joined and Binded with coordinator.

    we tried zcl attr read and still getting time out. (In shell) 

    We monitored the traffic between coordinator and router we noticed that when NRF request for reading attribute , Router sends read response and NRF not showing the response data.

    is coordinator sample enabled read response printing ? if not how to get and print the data.

    Please refer attached screen shot.

     d) Regarding KEY.

    The KEY i mentioned in previous post is Network Key.

    In coordinator sample code which network is used ?

    E) Can i add cluster in coodinator / shell sample or should i use template sample?

    kindly provide the guidance to add cluster in coordinator side.

    zigbee SDK 2.5.2

    Toolchain 2.5.2

    VSCode

    thanks,

    Nikhil

  • hi Amanda,

     A) Currently am able to read basic attribute from zigbee device using shell sample.

    Thank you for your guidance.

    Later i will reuse the payload read from Zigbee device to pass to uart buffer.

    B) Regarding KEY.

    The KEY i mentioned in previous post is Network Key.

    In Shell sample code which network is used ?

    C) Can i add custom cluster shell sample or should i use template sample?

    kindly provide the guidance to add cluster in coordinator side.

    Am referring following Link to declare cluster. 

    https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.thread_zigbee.v3.0.0%2Fusing_zigbee__z_c_l.html&anchor=att_declaration

    thanks,

    Nikhil

Related