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

Cannot find nRF5340DK in Wireshark (using Sniffer for 802.15.4)

Hello,

I am trying to measure the RSSI value of the Zigbee communikation on nRF5340DK.

Right now I have programmed light_buld into one of the DK and light_switch into the other and they are working fine. 

I have followed the instruction for downloading nRF Sniffer for 502.15.4(Wireshark and Python too) but I cannot find anything on Wireshark.

To be honest, I am not very sure how this works. Is it even possible to use the sniffer on a nRF5340DK to begin with?

I also need help with getting the RSSI value. Is there any other way to get RSSI value than just by using the sniffer? If there is, how can I do that??

Best Regards 

Michey

Parents
  • Hi,

    The nRF Sniffer for 802.15.4 required either a nRF52840 DK or a nRF52840 dongle as harware, the easiest and cheapest way is to use the dongle for setting up the sniffer. The sniffer software is not supported on nRF5240DK yet.

    You can also use the Zigbee endpoint logger as a replacement of the nRF Sniffer for 802.15.4 when using the nRF5340DK. Enabling the Zigbee enpoint logger ligbrary with the Zigbee light bulb sample allows it to log on/off commands received from the Zigbee light switch, so I think it will give you what you are looking for when working with the nRF5340 DK.

    You can read how to enable the Zigbee endpoint library logger in Kconfig following the documentation here:https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/zigbee/zigbee_logger_eprxzcl.html?highlight=rssi#configuration

    Best regards,

    Marjeris

  • Hi, thank you for the reply 

    I am not sure in what way I can get the RSSI value by using Zigbee endpoint logger. Could you explain more on how I get the RSSI value? 

    And regarding the endpoint logger, I have to write this in the code:

    ZB_AF_REGISTER_DEVICE_CTX(&your_device_ctx);
    ZB_AF_SET_ENDPOINT_HANDLER(your_ep_number, zigbee_logger_eprxzcl_ep_handler);

    Should I use "&dimmable_light_ctx" as my "&your_device_ctx"?

    However, I do not know what "your_ep_number" and "zigbee_logger_eprxzcl_ep_handler" should be.

    Is "your_ep_number"  the number of endpoints that i want to have? (in my case, its just 1 right?)

    and is "zigbee_logger_eprxzcl_ep_handler" just "zigbee_logger_eprxzcl_ep_handler"

    Best Regards,

    Michey

Reply
  • Hi, thank you for the reply 

    I am not sure in what way I can get the RSSI value by using Zigbee endpoint logger. Could you explain more on how I get the RSSI value? 

    And regarding the endpoint logger, I have to write this in the code:

    ZB_AF_REGISTER_DEVICE_CTX(&your_device_ctx);
    ZB_AF_SET_ENDPOINT_HANDLER(your_ep_number, zigbee_logger_eprxzcl_ep_handler);

    Should I use "&dimmable_light_ctx" as my "&your_device_ctx"?

    However, I do not know what "your_ep_number" and "zigbee_logger_eprxzcl_ep_handler" should be.

    Is "your_ep_number"  the number of endpoints that i want to have? (in my case, its just 1 right?)

    and is "zigbee_logger_eprxzcl_ep_handler" just "zigbee_logger_eprxzcl_ep_handler"

    Best Regards,

    Michey

Children
  • Hi,

    Sorry for the late reply. When the function zigbee_logger_eprxzcl_ep_handler() is called as a callback bound to endpoint via ZB_AF_SET_ENDPOINT_HANDLER() it should produce a log line that includes the RSSI reading.

    your_ep_number is the specific endpoint for which you want to register a cluster command handler. For example for the light bulb sample the device endpoint is defined as:

    /* Device endpoint, used to receive light controlling commands. */
    #define HA_DIMMABLE_LIGHT_ENDPOINT      10
    

    In the light bulb sample the device context is already registered in main():

    	/* Register dimmer switch device context (endpoints). */
    	ZB_AF_REGISTER_DEVICE_CTX(&dimmable_light_ctx);

    Do you still have problems implementing the zigbee_logger_eprxzcl_ep_handler() function?

    Best regards,

    Marjeris

  • Hello, thank you for the reply!

    The problem I have now is that zigbee_logger_eprxzcl_ep_handler() function should have an argument which is a reference to zigbee buffer holding received zcl command to be logged. But I do not know where to find this argument. 

    if i write like this:

    ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler());

    i get the error :
    too few arguments to function 'zigbee_logger_eprxzcl_ep_handler'

    and if i write like this (with no paratheses):

    ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler);

    I get the error:
    undefined reference to 'zigbee_logger_eprxzcl_ep_handler'

    I've also written:

            ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler(bufid));

    in zcl_device_cb function and zboss_signal_handler and got the error:
    undefined reference to 'zigbee_logger_eprxzcl_ep_handler'

    I have followed the instruction given here

    Another questions is, will the log line be printed out in the same ways as other logs? Will I be able to see them the normal way in Termite or PuTTY?

    Best regards

    Michey 

  • Hi,

    Have you followed the steps before calling ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler);?

    And are you calling ZB_AF_SET_ENDPOINT_HANDLER after registering your device context with ZB_AF_REGISTER_DEVICE_CTX but before starting the Zigbee stack?

    I may need some time to try to enable the endpoint handler myself to be able to help you better. I will try to come back to you tomorrow fter trying to configure this myself. Thanks for your patience.

    Best regards,

    Marjeris

  • Hello, 

    Have you followed the steps before calling ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler);?

    By this, do you mean these?

    1. Enable the library by setting the CONFIG_ZIGBEE_LOGGER_EP Kconfig option.

    2. Define the logging level for the library by setting the CONFIG_ZIGBEE_LOGGER_EP_LOG_LEVEL Kconfig option. See Zephyr’s logger options for more information.

    3. Include the required header file include/zigbee/zigbee_logger_eprxzcl.h into your project.

    1. and 2. I enable by writing

    #Configuring Zigbee endpoint logger
    CONFIG_ZIGBEE_LOGGER_EP=y
    CONFIG_ZIGBEE_LOGGER_EP_LOG_LEVEL=LOG_LEVEL_INF

    in the prj.conf file in light_bulb folder, it is the correct thing to do right?

    3. I included

    #include <zigbee/zigbee_logger_eprxzcl.h>

    in the main source code. 

    And are you calling ZB_AF_SET_ENDPOINT_HANDLER after registering your device context with ZB_AF_REGISTER_DEVICE_CTX but before starting the Zigbee stack?

    this is how the code look like if I write the handler in the main function:

    void main(void)
    {
    	int blink_status = 0;
    
    	LOG_INF("Starting ZBOSS Light Bulb example");
    
    
    	/* Initialize */
    	configure_gpio();
    
    	/* Register callback for handling ZCL commands. */
    	ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb);
    
    	/* Register dimmer switch device context (endpoints). */
    	ZB_AF_REGISTER_DEVICE_CTX(&dimmable_light_ctx);
    	
    	//To be able to use endpoint
        ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler);
            
    
    	bulb_clusters_attr_init();
    	level_control_set_value(dev_ctx.level_control_attr.current_level);
    
    	/* Start Zigbee default thread */
    	zigbee_enable();
    
    	LOG_INF("ZBOSS Light Bulb example started");
    
    	while (1) {
    		dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
    		k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
    	}
    }
    
     

    and I get different errors depending on if I put parantheses efter zigbee_logger_eprxzcl_ep_handler or not (as I mentioned above). 

    This might not be the same topic but do you know how many bytes are being sent from light_switch to light_bulb when I press the button on the light_switch so that the led lights up on light_bulb?

    Thank you for helping me and I look forward to your answer tomorrow.

    Best Regards 

    Michey 

  • Hi Michey,

    I am sorry for the delayed response. Marjeris is out of office right now, so I will answer this case.

    The description for enabling the endpoint logger is not clear on what exactly the required steps are, so I will try to explain everything you need to add to get it to work. I have tested this using a nRF52840 DK and was able to get endpoint logging to work. The steps are:

    In prj.conf set:

    CONFIG_ZIGBEE_LOGGER_EP=y
    CONFIG_ZIGBEE_LOGGER_EP_LOG_LEVEL_INF=y

    In main.c add the following header file:

    #include <zigbee/zigbee_logger_eprxzcl.h>

    The device context is already registered in both the light bulb and light switch samples, so you do not have to register this, but you must set the endpoint with:

    ZB_AF_SET_ENDPOINT_HANDLER(ep_number, zigbee_logger_eprxzcl_ep_handler);

    Remember to change ep_number to the endpoint of your application. In the case of the light switch this is LIGHT_SWITCH_ENDPOINT, and the light bulb is HA_DIMMABLE_LIGHT_ENDPOINT. It is important to add the endpoint handler before you start the Zigbee stack, so I would suggest adding it directly after the device context registration. So in the case of the light bulb, it should look like:

    /* Register dimmer switch device context (endpoints). */
    ZB_AF_REGISTER_DEVICE_CTX(&dimmable_light_ctx);
    ZB_AF_SET_ENDPOINT_HANDLER(HA_DIMMABLE_LIGHT_ENDPOINT, zigbee_logger_eprxzcl_ep_handler);

    I did not make any other changes besides these, and I was able to see the On/Off commands received on the light bulb as such:

    I: Received ZCL command (0): src_addr=0x52a0(short) src_ep=1 dst_ep=10 cluster_id=0x0006 profile_id=0x0104 cmd_dir=0 common_cmd=0 cmd_id=0x01 cmd_seq=0 disable_def_resp=1 manuf_code=void payload=[] (0)

    I have not been able to test this on nRF5340 DK unfortunately, but a customer was able to get that to work in this case by also adding the following to prj_nrf5340dk_nrf5340_cpuapp.conf:

    CONFIG_ZIGBEE_LOGGER_EP=y
    CONFIG_ZIGBEE_LOGGER_EP_LOG_LEVEL_INF=y

    Regarding your second question, when you press the button, you send a Zigbee Cluster Library (ZCL) command, either an On command or an Off command. The On/Off commands do not have any payload, so they are sent using ZB_ZCL_SEND_CMD, which is a macro for sending a command with empty payload. Since the ZCL payload is empty, only the ZCL header will be sent. You can find the size and format of this in the Zigbee Cluster Library specification, but I will also add it here:

    Size in bits 8 0/16 8 8
    Field Frame control Manufacturer code Transaction sequence number Command identifier

    The manufacturer code field is only included in the ZCL frame if the manufacturer specific sub-field of the frame control field is set to 1. If not, this field can be ignored. So the command will be either 3 or 5 bytes, depending on whether you have the manufacturer code frame or not. For more information about the sub-fields of the different ZCL header fields, you can check out the ZCL spec, specifically the chapter called "General ZCL Frame Format".

    Best regards,

    Marte

Related