This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[Update Zigbee SDK] Problem when update from zigbee and thread 4.1.0 to zigbee and thread 4.2.0

Hi guys,

I have a question about migration guide from the old 4.1.0 thread and zigbee sdk to 4.2.0.

The story is that I have this project running 4.1.0 on my custom board with some bugs that seems to be fixed in 4.2.0 due to the release note. When I tried to update the SDK by pasting the new SDK in and then change SDK config as well as the makefile. For some more relevant context, the code I used as reference is the zigbee example light bulb to modify the project but after I successfully compile and flash the device, in zigbee_default_signal_handler I receive signal ID 22 which is the device can sleep signal but in the init system I have put it as router role. I also update the zigbee_helpers.c with

ZB_ERROR_CHECK(zb_zcl_set_backward_comp_mode(ZB_ZCL_AUTO_MODE));

ZB_ERROR_CHECK(zb_zcl_set_backward_compatible_statuses_mode(ZB_ZCL_STATUSES_ZCL8_MODE));

And as far as I know the this signal is only trigger when calling zb_sleep_now in the old SDK. So my question is that in the new SDK is there any part to be consider when init the system to not accidently trigger this behavior.

Thank you for any helps,

Best regards,

Tu

  • Hi Tu,

    Shouldn't this singal be processed by the following codes in zigbee_default_signal_handler function?

            case ZB_COMMON_SIGNAL_CAN_SLEEP:
            //NRF_LOG_INFO("zboss_signal_handler signal %d", sig);
                /* Zigbee stack can enter sleep state.
                 * If the application wants to proceed, it should call zb_sleep_now() function.
                 *
                 * Note: if the application shares some resources between Zigbee stack and other tasks/contexts,
                 *       device disabling should be overwritten by implementing one of the weak functions inside zb_nrf52840_common.c.
                 */
                zb_sleep_now();
                break;

    Best regards,

    Charlie

  • Hi Charlie,

    Well in the light bulb example, the device is a router so it will not process that signal but will put it in default case. If I remember correctly unless the device plays the role of a end device, it will never handle that signal.

    #ifdef ZB_USE_SLEEP
            case ZB_COMMON_SIGNAL_CAN_SLEEP:
                /* Zigbee stack can enter sleep state.
                 * If the application wants to proceed, it should call zb_sleep_now() function.
                 *
                 * Note: if the application shares some resources between Zigbee stack and other tasks/contexts,
                 *       device disabling should be overwritten by implementing one of the weak functions inside zb_nrf52840_common.c.
                 */
                zb_sleep_now();
                break;
    #endif
    

    As you can see the handle of this signal is only enable with ZB_USE_SLEEP is defined and that macro is only there if the device is ED as in the code below

    #ifdef ZB_ED_ROLE
    #define ZB_USE_SLEEP
    #endif
    

    So It does not really explain my question which is why in my void zboss_signal_handler(zb_bufid_t bufid) if I put the log there it will show that there are signal 22(ZB_SIGNAL_CAN_SLEEP) coming repeatedly, but when the signal is handled by zigbee_default_signal_handler , somehow the defaults handler ignore it.

    I want to know how to do it just to verify if this behavior is normal and if it will have any effect on the overall performance of the system.

    Looking forward to hearing from you,

    Best regards,

    Tu

  • Hi Tu,

    Here ZB_USE_SLEEP is defined in zb_vendor.h, so this router device will respond to the sleep signal. This can_sleep signal is related to the "Sleepy" End Device but "Sleepy" End Device is more than that.

    I got a more detailed explanation from our Zigbee development team:

    ZBOSS stack libraries used in v4.2 are built with a slightly different configuration. For example, ZBOSS stack can be put to sleep for every role, previously it was limited to End Devices only (End Devices are linked with _ed library variant and previously only this library was compiled with ZB_USE_SLEEP enabled).

    In principle, this can_sleep signal is used to inform that the stack has nothing to do for some time. ZBOSS has its own scheduler so it can calculate for how long it can "sleep". It's especially useful in NCS where there are other threads that may need some CPU time but have lower priority than zboss-thread.

    "Sleepy mode for End Device" is more than that. It changes how the device behaves in the network.As End Device, the device sends Data requests to the parent device with a fixed interval:
    When it's "sleepy", the device turns on its radio on regular basis to ask parent device about pending packets. Radio is turned off when there no more packets to receive or send.
    When it's not "sleepy", the radio is always on so the device can receive packets.
    "Sleepy" End Device is meant for battery-powered applications because it's optimized for low power consumption - radio is off for most of the time and application usually has little to process so the CPU can be halted (WFE/WFI to be precise) for longer periods of time.
    Best regards,
    Charlie
  • Thanks you for your answer it is good to know this behavior is nothing abnormal.

    The support team in Nordic never let me down. Thanks a lot

    Best regards

    Tu

Related