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

  • 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

  • Hi Marte,

    Thanks for your reply.
    About the logging, I checked and played around with the NRF_LOG_XXX macros, but I still need to enable modules from the client side in order to see the logs in the terminal. That is:
    - The CLI agent example is running on the nRF52840 DK
    - I connect to the serial port using minicom as a CLI client (on my computer)
    - I can use the CLI commands in minicom as expected (bdb role, bdb start, zdo, etc...)
    - BUT, In order to see the logs in minicom, I need to use the command "> log enable info app" to see logs using NRF_LOG_INFO(...), and the command "> log enable info zigbee.report"  to see logs using the NRF_LOG_INST_INFO(...) function.

    So, what I want is to be able to configure default enable/disable when the application is started, so that I don't need to use the "log enable ..." command on the client side.

    On the client side, before I enable any module log, I get this output:

    > log status
    module_name                              | current | built-in
    ----------------------------------------------------------
    CLOCK                                    | none    | none
    GPIOTE                                   | none    | none
    PRS                                      | none    | none
    RNG                                      | none    | none
    TIMER                                    | none    | none
    UART                                     | none    | none
    UARTE                                    | none    | none
    USBD                                     | none    | none
    app                                      | none    | info
    app_button                               | none    | none
    app_timer                                | none    | none
    app_timer.m_bsp_alert_tmr                | none    | none
    app_timer.m_bsp_button_tmr               | none    | none
    app_timer.m_bsp_leds_tmr                 | none    | none
    app_timer.m_cli_uart_transport_timer     | none    | none
    app_timer.m_detection_delay_timer_id     | none    | none
    app_timer.m_timer_0                      | none    | none
    app_usbd                                 | none    | none
    app_usbd_core                            | none    | none
    atfifo.m_req_fifo                        | none    | none
    balloc.log_mempool                       | none    | none
    balloc.m_cli_cdc_acm_cmd_hist_memobj     | none    | none
    balloc.m_cli_uart_cmd_hist_memobj        | none    | none
    cdc_acm                                  | none    | none
    cli_uart                                 | none    | none
    clock                                    | none    | none
    nrf_fstorage                             | none    | info
    pwr_mgmt                                 | none    | none
    queue.m_cli_cdc_acm_log_backend_queue    | none    | none
    queue.m_cli_uart_log_backend_queue       | none    | none
    queue.m_rand_pool                        | none    | none
    queue.m_rx_queue                         | none    | none
    rng                                      | none    | none
    sortlist                                 | none    | none
    zboss                                    | none    | info
    zigbee.cli                               | none    | info
    zigbee.eprxzcl                           | none    | info
    zigbee.ping                              | none    | info
    zigbee.report                            | none    | info
    >

    BR,
    Damien

  • Hi Damien,

    Someone did something similar a few years back. Could you try implementing it as described in this comment by Andreas? The function zb_zcl_put_default_reporting_info() is no longer a part of the library, but you should be able to use zb_zcl_put_reporting_info() instead. 

    Please let me know if this works for you or not.

    Best regards,

    Marte

  • Hi,

    I don't think this is what I am looking for since it is a function from ZBOSS, and I am looking for the general configuration in the SDK, that enables/disables a module to log on client side of the CLI (through UART). The link you sent is about zigbee reports and is not about the configuration I am looking for.

    I lost quite a lot of time so far on this, but couldn't find a solution. I will drop this configuration and simply send the log enable command from the client side instead.

    Thanks for your help so far.

    BR
    Damien

  • Hi Damien,

    I'm sorry, I misunderstood.

    I asked a colleague about this, in case you decide to try some more. According to them you'll have to define a nRF log submodule. You can check out these macros for logging on instance level, and then use NRF_LOG_INST_INFO for logging.

    Best regards,

    Marte

Related