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

CLI UART + NUS

Hello,

I'm trying to make CLI working with UART and BLE (NUS) backend simultaneously. Starting point is CLI example from SDK 14. What should I enable in sdk_config.h and how shuould I intialize CLI with UART and NUS in my app? In ble_app_cli CLI NUS is working alongside with RTT backend. How can I use UART instead of RTT?

Parents
  • I think you can modify this example:

    examples\ble_peripheral\experimental\ble_app_cli

    Baically you need to change RTT to UART (you can base on this example: \examples\peripheral\cli as it uses both RTT and UART)

  • This is CLI part of my app:

    #define CLI_EXAMPLE_LOG_QUEUE_SIZE (4)
    NRF_CLI_UART_DEF(m_cli_uart_transport, 0, 64, 16);
    NRF_CLI_BLE_UART_DEF(cli_ble_uart, &m_gatt, 64, 32);
    NRF_CLI_DEF(m_cli_uart, "ub_dongle:~$ ", &m_cli_uart_transport.transport, '\r', CLI_EXAMPLE_LOG_QUEUE_SIZE);
    NRF_CLI_DEF(m_ble_cli, "cli_ble:~$ ", &cli_ble_uart.transport,, '\r', CLI_EXAMPLE_LOG_QUEUE_SIZE);
    

    On ble connection:

    nrf_cli_ble_uart_config_t config = { .conn_handle = m_conn_handle };
    err_code = nrf_cli_init(&m_ble_cli, &config, true, true, NRF_LOG_SEVERITY_NONE);
    APP_ERROR_CHECK(err_code);
    APP_ERROR_CHECK(nrf_cli_task_create(&m_ble_cli));
    

    On ble disconnection:

    (void)nrf_cli_uninit(&m_ble_cli);
    
Reply
  • This is CLI part of my app:

    #define CLI_EXAMPLE_LOG_QUEUE_SIZE (4)
    NRF_CLI_UART_DEF(m_cli_uart_transport, 0, 64, 16);
    NRF_CLI_BLE_UART_DEF(cli_ble_uart, &m_gatt, 64, 32);
    NRF_CLI_DEF(m_cli_uart, "ub_dongle:~$ ", &m_cli_uart_transport.transport, '\r', CLI_EXAMPLE_LOG_QUEUE_SIZE);
    NRF_CLI_DEF(m_ble_cli, "cli_ble:~$ ", &cli_ble_uart.transport,, '\r', CLI_EXAMPLE_LOG_QUEUE_SIZE);
    

    On ble connection:

    nrf_cli_ble_uart_config_t config = { .conn_handle = m_conn_handle };
    err_code = nrf_cli_init(&m_ble_cli, &config, true, true, NRF_LOG_SEVERITY_NONE);
    APP_ERROR_CHECK(err_code);
    APP_ERROR_CHECK(nrf_cli_task_create(&m_ble_cli));
    

    On ble disconnection:

    (void)nrf_cli_uninit(&m_ble_cli);
    
Children
No Data
Related