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

undefined reference to `zigbee_logger_eprxzcl_ep_handler'

Hello, 

I've been trying to use Zigbee Endpoint Logger for the light_bulb and light_switch sample. But I can't make it work. I've been looking through the quetions on this website and I found this, I have the same problem as this person, I've been waiting for an answer but it has been many days and there is no reply, I have a deadline for this task and have to finish this in three days. I was hoping that maybe I could get an answer faster by creating another question and also help the otther person get a faster answer. (I'm also using nRF5340DK)

I apoloigize for being unpatient, I hope you can help us solving this problem.

Thank you beforehand.

Best Regards

Mihsa

Parents
  • Hi Mihsa,

    I tested this just now and managed to get the endpoint logging to work by doing the following steps:

    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)

    If you have followed these steps and you are still getting errors, please let me know and I will investigate further. I was only able to test this on nRF52 DKs for now, so I do not know if using a nRF5340 DK might cause problems.

    Best regards,

    Marte

  • Hello, thank you for the reply,

    I also added these

    CONFIG_ZIGBEE_LOGGER_EP=y
    CONFIG_ZIGBEE_LOGGER_EP_LOG_LEVEL_INF=y

    into prj_nrf5340dk_nrf5340_cpuapp.conf also. now it works.

    But, the value that I am interested in is the RSSI value, but in the output you showed me and the one I also got, there is no RSSI value.

    Because according to this, it should be possible to get the value of RSSI. 

    What do I do to get RSSI value?

    Please give me an example of how to write the code too, I've been trying to find the RSSI value in the code but I cannot find it. 

    I hope you can help me. 

    Best Regards

    Mihsa

  • Hi,

    I am glad to hear that it works now! I did not think about having to add the configs to prj_nrf5340dk_nrf5340_cpuapp.conf as well, so thank you for informing me of that. Since it worked I replied to the case you mentioned with the steps, adding the part about prj_nrf5340dk_nrf5340_cpuapp.conf as well.

    Yes, I see from the link that the log line there gives RSSI. I do not know where that is from, because by looking at the logger module in zigbee_logger_eprxzcl.c, I do not see anything related to RSSI. The handler that creates the log, zigbee_logger_eprxzcl_ep_handler(), does not contain this. From the log in the link, RSSI should be between profile_id and cmd_dir, which is around line 200 in the file in NCS v1.5.1 on github here, but it is not.

    You can use the function zb_zdo_get_diag_data() to get RSSI value. An example of the function in use is as follows:

    zb_uint8_t lqi, rssi;
    zb_zdo_get_diag_data(0x0000, &lqi, &rssi);

    If you want this in the log you will have to add it yourself in zigbee_logger_eprxzcl_ep_handler(). You can do so by calling the function as above (just remember to use the correct short address you want to get the RSSI value of) and print RSSI by adding the following where you want it among the prints in the zigbee_logger_eprxzcl_ep_handler()  (for example between profile_id and cmd_dir as in the link):

    status = snprintf(
    	log_message_curr,
    	log_message_end - log_message_curr,
    	" rssi=%d", rssi);
    PRV_ADVANCE_CURR_LOG_MESSAGE_PTR(status);

    Best regards,

    Marte

  • Hello, Thank you so much for you help, 

    I can now see the RSSI value =)

    The value that is being display is the value 0 - 255, but I'm more interested in getting the value in dB, is there a function for that or do you know a way for me to convert?

    Also, is there a way for me to set signal strength for Zigbee?

    Best regards 

    Mihsa 

  • Hi Mihsa,

    You can use the function nrf_802154_dbm_from_energy_level_calculate() to convert energy measured in 0-255 to dBm:

    zb_uint8_t lqi, rssi;
    int8_t rssi_dbm;
    zb_zdo_get_diag_data(0x0000, &lqi, &rssi);
    rssi_dbm = nrf_802154_dbm_from_energy_level_calculate(rssi);

    You can try to use the function nrf_802154_tx_power_set(power) to set the transmit (TX) power. This will affect the signal strength. It takes in the parameter power, which is of the type int8_t, and it is the transmit power in dBm.

    Best regards,

    Marte

Reply
  • Hi Mihsa,

    You can use the function nrf_802154_dbm_from_energy_level_calculate() to convert energy measured in 0-255 to dBm:

    zb_uint8_t lqi, rssi;
    int8_t rssi_dbm;
    zb_zdo_get_diag_data(0x0000, &lqi, &rssi);
    rssi_dbm = nrf_802154_dbm_from_energy_level_calculate(rssi);

    You can try to use the function nrf_802154_tx_power_set(power) to set the transmit (TX) power. This will affect the signal strength. It takes in the parameter power, which is of the type int8_t, and it is the transmit power in dBm.

    Best regards,

    Marte

Children
No Data
Related