NRF52840 Zigbee CLI example but in code

Hello,

I am trying to configure a Zigbee coordinator as done in the CLI example (for example 'bdb role zc' and 'bdb start') to get data from the multi sensor example, but instead of doing this over the CLI, I am trying to achieve this in the code itself. I am quite lost on where to look for the API calls that the CLI interacts with. Could you guide me to the right documentation?

Thanks,

Sebastiaan

Parents
  • Hi Sebastiaan,

    Could you please specify what functionality you want?

    You can find the implementation of CLI commands in the files located in <SDK_ROOT>/components/zigbee/cli. The commands you mention can be found in zigbee_cli_cmd_bdb.c, for example the function cmd_zb_start() for the 'bdb start' command. You will see in the functions that the CLI library does a lot of additional things and checks which are not needed if you are to use the Zigbee functionality directly.

    If you want to implement coordinator functionality you can look at the Zigbee Light Coordinator from the Light Control example, which can be found in <SDK_ROOT>/examples/zigbee/light_control/light_coordinator. This is a simple coordinator with no additional functionality other than being a Zigbee coordinator.

    To set the coordinator role use the following:

    zb_set_network_coordinator_role(IEEE_CHANNEL_MASK);

    For the coordinator you must also set maximum children. This can for example be set to 10:

    zb_set_max_children(MAX_CHILDREN);

    To start the stack ('bdb start') you must use one of the zboss start functions, either zboss_start() or zboss_start_no_autostart(), depending on whether you want to initialize the radio and start commissioning, or if you want to delay commissioning.

    Best regards,

    Marte

  • Hello Marte, thanks for your reply!

    I am just trying to execute the CLI logic but in code

    So I want to have a coordinator that scans the devices in the network (from the multi sensor example the temperature and pressure sensors).

    I want to then bind and subscribe on those as done in the CLI example. Finally, I would like to print out the values received.

    Thanks,

    Sebastiaan 

  • Hi Marte,

    thanks for the explanation!

    I have a few questions:

    regarding your comment "Additionally, source endpoint and source address should be that of the multi sensor, and not of the coordinator."

    I think I implemented it correctly unless I misunderstood this comment?

    regarding the byte order of the 64-bit addresses in the memory:

    My initial thought (hardcoding) was that if my address was "0xf4ce36f7a5db776c", that 

    p_req->src_address[0] = 0xF4;
    ...
    p_req->src_address[7] = 0x6C;

    However, I see now that with the function below:

    zb_ieee_addr_t ieee_addr;
    zb_osif_get_ieee_eui64(ieee_addr);

    The byte order is

     

    p_req->src_address[0] = 0x6C;
    ...
    p_req->src_address[7] = 0xF4;

    Which one is the correct implementation?

    Thanks a lot for your help so far

    Sebastiaan

  • Hi Sebastiaan,

    The second byte order, starting with 0x6C and ending with 0xF4, is the correct one. The nRF 802.15.4 radio driver use little-endian for addresses, so the address should start with the least-significant byte. 

    Do you still get "Uninplemented signal (signal 21, status 0)" after using little-endian? If so, could you get a sniffer log of the behavior and upload it here as a pcap file? Please make sure to start the sniffer before starting the network so the sniffer has the network key. You can use nRF Sniffer for 802.15.4 to get a sniffer log if you have an additional nRF52840 DK or Dongle.

    Best regards,

    Marte

  • Hi Marte,

    Thank you for clarifying the byte-order. However, with the correct endianness, the bind still fails.

    I do have a third NRF52840DK which I can configure as a nRF sniffer. I looked at the installation guide, added the files to /extcap (Python file and .bat file), configured the preferences but I cannot find the extcap option for the nrf sniffer in WireShark itself. I am currently on a macOS Big Sur (M1). However, the installation guide is quite unclear for mac users.

    Best regards,

    Sebastiaan

  • Hi Sebastiaan,

    Then there is something else wrong with the command. Getting a sniffer log would be very helpful for figuring out what might be causing it.

    I am sorry about that. The guide under nRF Tools in the documentation has guides for installing on macOS as well: nRF Sniffer for 802.15.4. For installing the plugin in Wireshark you can check out Installing the nRF Sniffer capture plugin in Wireshark.

    Best regards,

    Marte

  • Hello Marte,

    I am trying the link you suggested. What I've done so far:

    • Flashed the third NRF52 development kit with the 'nrf802154_sniffer.hex' file.
    • Copied the nrf802154_sniffer.py into the Global Extcap path of WireShark (/Applications/Wireshark.app/Contents/MacOS/extcap)
    • Verified that the file can be ran and that the output is the same as the tutorial

    The response of running the python file is:

    extcap {version=0.7.2}{help=github.com/.../nRF-Sniffer-for-802.15.4}{display=nRF Sniffer for 802.15.4}
    control {number=6}{type=button}{role=logger}{display=Log}{tooltip=Show capture log}

    However, when I boot WireShark, the NRF extcap is not detected. Any idea what could be the cause?

    Thanks in advance,

    Sebastiaan

Reply
  • Hello Marte,

    I am trying the link you suggested. What I've done so far:

    • Flashed the third NRF52 development kit with the 'nrf802154_sniffer.hex' file.
    • Copied the nrf802154_sniffer.py into the Global Extcap path of WireShark (/Applications/Wireshark.app/Contents/MacOS/extcap)
    • Verified that the file can be ran and that the output is the same as the tutorial

    The response of running the python file is:

    extcap {version=0.7.2}{help=github.com/.../nRF-Sniffer-for-802.15.4}{display=nRF Sniffer for 802.15.4}
    control {number=6}{type=button}{role=logger}{display=Log}{tooltip=Show capture log}

    However, when I boot WireShark, the NRF extcap is not detected. Any idea what could be the cause?

    Thanks in advance,

    Sebastiaan

Children
Related