Hi
I need a CLI over RTT on an existing project. I believe that I have extracted all the required bits from the CLI example. I dont need history, UART, USB or anything else, I dont need built in commands, at the moment I have just one single custom command. I don't need NRF log. I want the simplest solution here. Before I pull all my hair out, I was hoping someone could take a look at my code and tell me what is going on!
static void test(nrf_cli_t const * p_cli, size_t argc, char **argv) { SEGGER_RTT_WriteString(0, "test\n"); } NRF_CLI_CMD_REGISTER(test, NULL, "TestCmd", test); NRF_CLI_RTT_DEF(m_cli_rtt_transport); NRF_CLI_DEF(m_cli_rtt, "rtt_cli:~$ ", &m_cli_rtt_transport.transport, '\n', 4); void main(void) { ret_code_t err_code; err_code = app_timer_init(); APP_ERROR_CHECK(err_code); err_code = nrf_cli_init(&m_cli_rtt, NULL, true, true, NRF_LOG_SEVERITY_INFO); APP_ERROR_CHECK(err_code); ret_code_t ret = nrf_cli_start(&m_cli_rtt); APP_ERROR_CHECK(ret); SEGGER_RTT_WriteString(0, "App Started\n"); while(1) { nrf_cli_process(&m_cli_rtt); } } }
You'll note my very simple project. In the PUTTY RTT window, I can see the text 'App Started', but there is no prompt, and if I type 'test' nothing happens.
Any ideas??
Thanks, Nigel
My sdkconfig.h has a load of copy/paste thus:
#ifndef NRF_CLI_ENABLED #define NRF_CLI_ENABLED 1 #endif #ifndef NRF_CLI_ECHO_STATUS #define NRF_CLI_ECHO_STATUS 1 #endif // <o> NRF_CLI_PRINTF_BUFF_SIZE - Maximum print buffer size. #ifndef NRF_CLI_PRINTF_BUFF_SIZE #define NRF_CLI_PRINTF_BUFF_SIZE 23 #endif // <e> NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver //========================================================== #ifndef NRFX_CLOCK_ENABLED #define NRFX_CLOCK_ENABLED 1 #endif // <o> NRFX_CLOCK_CONFIG_LF_SRC - LF Clock Source // <0=> RC // <1=> XTAL // <2=> Synth // <131073=> External Low Swing // <196609=> External Full Swing #ifndef NRFX_CLOCK_CONFIG_LF_SRC #define NRFX_CLOCK_CONFIG_LF_SRC 1 #endif // <o> NRFX_CLOCK_CONFIG_IRQ_PRIORITY - Interrupt priority // <0=> 0 (highest) // <1=> 1 // <2=> 2 // <3=> 3 // <4=> 4 // <5=> 5 // <6=> 6 // <7=> 7 #ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY #define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6 #endif // <o> NRF_CLI_CMD_BUFF_SIZE - Maximum buffer size for a single command. #ifndef NRF_CLI_CMD_BUFF_SIZE #define NRF_CLI_CMD_BUFF_SIZE 128 #endif // <o> NRF_CLI_ARGC_MAX - Maximum number of parameters passed to the command handler. #ifndef NRF_CLI_ARGC_MAX #define NRF_CLI_ARGC_MAX 12 #endif #define NRF_CLI_RTT_ENABLED 1 #define NRF_CLOCK_ENABLED 1 #define NRF_CLI_HISTORY_ENABLED 1 // <o> NRF_CLI_HISTORY_ELEMENT_SIZE - Size of one memory object reserved for CLI history. #ifndef NRF_CLI_HISTORY_ELEMENT_SIZE #define NRF_CLI_HISTORY_ELEMENT_SIZE 32 #endif // <o> NRF_CLI_HISTORY_ELEMENT_COUNT - Number of history memory objects. #ifndef NRF_CLI_HISTORY_ELEMENT_COUNT #define NRF_CLI_HISTORY_ELEMENT_COUNT 8 #endif #define NRF_CLI_RTT_TERMINAL_ID 0 #define NRF_CLI_RTT_TX_RETRY_CNT 1 #define NRF_CLI_RTT_TX_RETRY_DELAY_MS 1 #define NRF_LOG_BACKEND_SERIAL_USES_RTT 1 // <o> NRFX_CLOCK_CONFIG_IRQ_PRIORITY - Interrupt priority // <0=> 0 (highest) // <1=> 1 // <2=> 2 // <3=> 3 // <4=> 4 // <5=> 5 // <6=> 6 // <7=> 7 #ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY #define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6 #endif