I tried to use UART both for NRF_LOG and NRF_CLI. Now it's running but I had a problem that calling to nrf_cli_init caused fatal error 8 - INVALID_STATE.
When I commented out the NRF_LOG_DEFAULT_BACKENDS_INIT, the error disappeared and now both LOG and CLI are working.
Which settings do have enabled sdk_config.h? In the cli example in the SDK, UART for NRF_LOG and NRF_CLI co-exist. Could you compare you settings in sdk_confi.h with the settings in the cli example?
These are my setting from sdk_config.
NRF_LOG_BACKEND_UART_ENABLED 1NRF_LOG_BACKEND_UART_TX_PIN 6NRF_LOG_BACKEND_UART_BAUDRATE 2576384NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE 64
NRF_LOG_CLI_CMDS 1NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED 0NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL 3NRF_CLI_UART_CONFIG_LOG_ENABLED 0NRF_CLI_UART_CONFIG_LOG_LEVEL 3NRF_CLI_UART_ENABLED 1
The CLI example has the same settings except for the baud rate.
NRF_CLI_UART_xxx sets the settings for enabling logging in the CLI module. You will also need the following to enable the command line interface and the log module:
Enabling the settings NRF_CLI_LOG_BACKEND and NRF_LOG_CLI_CMDS are important to for the CLI module and the LOG module to co-exist.
I have also NRF_CLI_LOG_BACKEND enabled, just missed in the list in the previous reply. I'd like to remind that currently I can run both NRF_LOG and NRF_CLI but I had to comment out the NRF_LOG_DEFAULT_BACKENDS_INIT() macro and I am wondering why. And if this can cause some problems in the future.
nrf_cli_init is initializing UART driver and the same is doing macro NRF_LOG_DEFAULT_BACKENDS_INIT().
If you try to initialize already initialized driver you will have an error code message about invalid state.
When using CLI you don't need to call macro NRF_LOG_DEFAULT_BACKENDS_INIT() and you shall not expect any errors in the future related with this.