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

Which SDK, examples need to download for the generic zigbee application for the 2 devices of nrf52840 dongle

Hi to all team,

I have two units of nrf52840 dongle with me.

I have to develop the generic application firmware where data send from one dongle(coordinator) is getting received by another dongle(Router/End Device) based on zigbee 802.15.4.

I have search the SDK from the nordic site but there i am getting confused because SDK i have found is for home automation based where coordinator is do commisioning.

So i have to need only SDK, examples which while programmed to nrf52840 dongle fulfills the concept of sending data from one dongle to other dongle based on zigbee.

So can anyone who has worked on this dongle, please let me know which soft-device, SDK and examples i have to download for these generic application from the nordic site.

Thanks & regards,

Ronak Jain  

  • Hi,

    The Zigbee examples in NCS (nRF Connect SDK) does not have support for the nRF52840 Dongle as of now, so it would be easiest to use the examples from nRF5 SDK for Thread and Zigbee. To download the SDK please go to nRF5 SDK for Thread and Zigbee download.

    You can see a list over the examples at the page Zigbee-only examples in our documentation. At the bottom of that page you will find a table showing which examples are supported on which devices, to see which examples you can use on your dongles.

    For your coordinator you should either use the Zigbee Light Coordinator from the light control example or the Zigbee CLI Agent example.The light coordinator is a very simple coordinator example which for now only has functionality for the network steering commissioning mechanism. The rest of the functionality you want your device to have, you will have to implement yourself. The CLI agent might be a better example to use. This example can be used as a coordinator or a router. If you want to use it as a coordinator, simply set the device role with "bdb role zc" before starting the network, as explained in the documentation of the example. With the CLI agent you can easily send messages to other devices using the CLI (command line interface) library. The list of supported CLI commands can be found in Zigbee CLI Reference.

    The examples you can use for your other device are the Zigbee Light Bulb example, the Zigbee Multi Sensor example, and the Zigbee CLI Agent example. The light bulb is a router, and acts as a light bulb. If you want to test out controlling the light bulb using the CLI agent (on the coordinator) you can read about how to do this in Using CLI to control lighting devices. The multi sensor example is programmed as an end device, and demonstrates how to use the the Temperature Measurement and Pressure Measurement clusters. The Zigbee CLI Agent example can, as I mentioned earlier, be used as both a coordinator and a router. So you can have this example on both devices, and set the device role as coordinator on one of them, while letting the other one be a router. You can then use CLI commands to send messages as explained above.

    Best regards,

    Marte

  • Hi,

    Thanks for the reply.

    Going through the reply, have following queries mentioned under the below cases.

    Case -1)  NRF52840 dongle have with me is PCA100059 board. 

    So if I  program the "nrf52840_xxaa_mbr_pca10059.hex" file of  Zigbee Light Coordinator from the light control example in my one NRF52840 dongle considering as a coordinator and load "nrf52840_xxaa_mbr_pca10059.hex" file from Zigbee light bulb example in another dongle considering as a router, than can you clear my below queries.

    A) can i able to see the data communication  between 2 dongle for data send receive? What kind of output i can able to see.

    B) If not than i can only able to see the network joining means that router device is joined with coordinator without any data send receive?

    C) To see the data send receive from coordinator(dongle 1) to router(dongle 2) or vice versa, i have to implement the logic right? If yes than what section i have to refer to use the api or function for zigbee data send receive.

    Case - 2) If I use Zigbee CLI agent example to download in nrf52840 dongle, than in that i have to configure all the board via uart utility right to configure it as a coordinator, start zigbee stack and other things.

    Thanks and regards,

    Ronak Jain

  • Hi,

    Case 1)

    The light coordinator only works as a coordinator, and commissions devices that want to join the network. So if you program the examples without making any changes to them, the only messages sent between the two devices will be the messages during joining, as well as Link Status messages periodically.

    If you want the coordinator to send other messages to the light bulb you will have to implement that yourself. If you just want to send a generic command you can use ZB_ZCL_SEND_COMMAND_SHORT. You will have to construct the packet and fill it with data, finish it, and then send it. You can take a look at the function generic_cmd_send in components/zigbee/cli/zigbee_cli_cmd_generic_cmd.c to see how this can be used. It would look something like this. You will have to set the different parameters to correspond with your message.

    zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer)
    ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp)
    ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), command_id);
    
    // Fill the packet data using one or more of the following primitives:
    // ZB_ZCL_PACKET_PUT_DATA8
    // ZB_ZCL_PACKET_PUT_DATA16
    // ZB_ZCL_PACKET_PUT_DATA32
    // ZB_ZCL_PACKET_PUT_DATA_IEEE
    // ZB_ZCL_PACKET_PUT_DATA_N
    ZB_ZCL_PACKET_PUT_DATA8(ptr, (data));
    
    ZB_ZCL_FINISH_PACKET(buffer, ptr);
    ZB_ZCL_SEND_COMMAND_SHORT(buffer,
                              addr,
                              dst_addr_mode,
                              dst_ep,
                              ep,
                              prof_id,
                              CLUSTER_ID,
                              cb);

    You can also send cluster specific commands. If you for example want to turn the light bulb on or off, you can send a On/Off command from the coordinator. You will have to implement the On/Off cluster on the coordinator in that case.

    ZB_ZCL_ON_OFF_SEND_REQ(buffer,
                           addr,
                           dst_addr_mode,
                           dst_ep,
                           ep,
                           prof_id,
                           dis_default_resp,
                           cmd_id,
                           NULL);

    When the light bulb receives a ZCL command, it will enter the callback function zcl_device_cb(). If you want to do something when receiving a command, you can add that functionality there, for the specific command.

    Case 2)

    You should find the explanations regarding this in the CLI Agent example documentation. After programming the example to the devices, you can use a terminal emulator, such as PuTTY or Termite, to use the CLI library. Use the following settings in the emulator:

    • 115200 bit/s
    • 8-bit-long word
    • no parity
    • 1-bit stop

    Then you can issue the commands in the documentation of the example and in the CLI reference to the device using the terminal emulator. To start the device as a coordinator issue the following commands:

    bdb role zc

    bdb start

    The first command will set the role as coordinator, and the second one will start the Zigbee network.

    For the router, you only need to call "bdb start", and the router will join the network if the coordinator has created the network and the network is open. The coordinator will keep the network open for 180 seconds at a time. If it has closed and you need to open it, you can do so by simply calling "bdb start" again. After this you can issue commands to your devices to send messages to the other device, using the commands in the documentation.

    Best regards,

    Marte

  • Hi Marte,

    Thanks for the reply.

    The purpose of developing the project is that we have to developed such a standard generic gateway(Coordinator) based on zigbee mesh topology so that if any device purchased from the market would be joined and operate by the coordinator easily.

    So to fulfil the above requirement can  u please give me the reply of my below query.

    1) which softdevice will be required for zigbee mesh topology as i am using for nrf52840 dongle hardware for this.

    2) which firmware is valid to use for coordinator from the below 2 points a & b? If a & b are not correct than pls let me know which example i have to used for preparing the coordinator firmware

         - a) One Single firmware i can implement taking the use of example of Zigbee Light coordinator alongwith the Zigbee light switch code portion in it? so that by this firmware coordinator can form the network, allow the multiple router/end device to join the network and also control the single or multiple bulb by sending command

         -b) Zigbee CLI Agent router example.

    3) For testing purpose use zigbee light bulb code as a end device which can join with the coordinator mesh network through pan id and than bulb is controlled through coordinator . 

    Thanks and regards,

    Ronak Jain

  • Hi,

    1)

    a)

    If what you want is a coordinator acting as a generic gateway and not doing a lot of additional things, or doing specific predefined things, then you should use the light coordinator from the light control example. This example already has the needed functionalities for working as a coordinator, and can form networks, open/close the network, permit devices to join the network, etc. If you have this example programmed on a device, the device will automatically start creating a network when it starts up, and it will open the network as part of this. In addition, you can open the network after it has closed with by pressing a button. On the Dongle, this will be the user configurable button SW1.

    If you want the coordinator to send specific commands in addition to simply being a coordinator/gateway, then you must add this to the example. If you want it to be able to for example control light bulbs, then you can use the relevant code from the light switch example for this. However, if this coordinator is just meant to be a generic gateway and only handle the network, then this is not needed.

    b)

    If you instead want your coordinator to not just handle the network, but also be able to operate all kinds of Zigbee devices and send different cluster commands and so forth, as it seems like from your description, then you will need to use something the user can interact with more than they can with the light coordinator now. If so, the CLI agent example might be a better starting point. The light coordinator is implemented according to Zigbee specifications, so it will be able to let devices join, and the devices can be controlled by other devices that are programmed to control that device (such as a light switch and a light bulb), but if you want the coordinator itself to control the devices, this will not be enough.

    There are a lot of different clusters in the Zigbee Cluster Library, and they all have different attributes and commands. You can see a list of clusters in our SDK in ZCL clusters. If you want to be able to control all kinds of Zigbee devices, your device will have to implement functionality for all these attributes and commands. Some of this is generic and common for all clusters, such as the commands to read or write attributes, configure attribute reporting and more, as you can see in ZCL commands shared by all clusters. However, the cluster commands are cluster specific, so if you for example want to send the command to turn off something, such as a light bulb, you will have to send the "Off command" from the ZCL On/Off cluster, which in our SDK is done with the macro ZB_ZCL_ON_OFF_SEND_OFF_REQ. Because of this you should use something with user interaction, and a device that can handle all sorts of commands. So this is where the CLI agent comes in, as the cli subsystem handles this. With this, you can issue CLI commands to the coordinator and tell it what to do, such as sending commands to another device in the network, for example to turn off the light.

    As the CLI agent example is now, you have to use either UART or a USB CDC device to communicate with the CLI agent, and you must send the commands as described in the CLI reference. However, you can create something to make this easier for the user to use, for example something to use on top of this, as long as the CLI commands are sent correctly to the device. Because of this, the device will need to be connected to something that can communicate with it using one or both of the two interfaces I mentioned. Also be aware that this example does not automatically set the coordinator role or start the network, so you will either have to do that by issuing CLI commands at start up, or add this in the code.

    2)

    Yes, you can use the light bulb example to test. The light bulb is a router by default, but you can change this role to end device if you want to. If the network is open, then the light bulb will join the network using network steering.

    Best regards,

    Marte

Related