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

Zigbee CLI default configuration

Hello,

I am developing a Zigbee coordinator with the nRF52840 DK and with the nRF52_SDK_for_Thread_and_Zigbee_v_4.1.0. I flashed the CLI example and everything works fine with it. I created a workspace folder where I copied the CLI example as a base for the development of my custom CLI.

I want to change the default configuration of the CLI but I struggle to understand how to do it.

1) How can I configure the application to enable logging for app and zigbee.report modules by default. So that the CLI client do not need to send `log enable info <module>`.
I thought that I could do it from the sdk_config.h file in the pca10056/blank/config folder but it doesn't work. The NRF_LOG_ENABLED is set to 1 by default.

2) How to set role to zc by default?

Best Regards,
Damien

Parents
  • Hi Damien,

    1. For logging you can check out NRF_LOG_INST_INFO, which is the macro used for logging the reports in the CLI example. You can see how this is done in that example by looking at the function print_attr_update() in zigbee_cli_cmd_attr_report.c, line 294. This macro itself is defined in nrf_log.h, which is the nrf_log module interface. In order to use this logging module, you must have logging enabled. You can find the configurations for this in sdk_config.h by searching for "nRF_Log". 
    2. If you want to set any default configurations for the Zigbee device, I would recommend taking a look at some of the other examples in the SDK, such as the light control example, as these things are configured by default in some of those examples.
      The role is set when you initialize the Zigbee stack with ZB_INIT(), which is called in main(). In the case where you want your device to be a coordinator you should use ZB_INIT("zc"). Please note that this function should be called before the stack is started with either zboss_start() or zboss_start_no_autostart(). An example of how this is done can be found on line 265 in light_coordinator.c. You should also include the following in your project, which can be found on lines 73-75 in light_coordinator.c:

    #ifndef ZB_COORDINATOR_ROLE
    #error Define ZB_COORDINATOR_ROLE to compile coordinator source code.
    #endif

    Best regards,

    Marte

Reply
  • Hi Damien,

    1. For logging you can check out NRF_LOG_INST_INFO, which is the macro used for logging the reports in the CLI example. You can see how this is done in that example by looking at the function print_attr_update() in zigbee_cli_cmd_attr_report.c, line 294. This macro itself is defined in nrf_log.h, which is the nrf_log module interface. In order to use this logging module, you must have logging enabled. You can find the configurations for this in sdk_config.h by searching for "nRF_Log". 
    2. If you want to set any default configurations for the Zigbee device, I would recommend taking a look at some of the other examples in the SDK, such as the light control example, as these things are configured by default in some of those examples.
      The role is set when you initialize the Zigbee stack with ZB_INIT(), which is called in main(). In the case where you want your device to be a coordinator you should use ZB_INIT("zc"). Please note that this function should be called before the stack is started with either zboss_start() or zboss_start_no_autostart(). An example of how this is done can be found on line 265 in light_coordinator.c. You should also include the following in your project, which can be found on lines 73-75 in light_coordinator.c:

    #ifndef ZB_COORDINATOR_ROLE
    #error Define ZB_COORDINATOR_ROLE to compile coordinator source code.
    #endif

    Best regards,

    Marte

Children
No Data
Related