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

  • 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