Closed JohnHonai2255 closed 6 months ago
I'm not entirely sure what you are trying to do, and what you have done so far that hasn't worked. Can you elaborate a bit, please?
I was trying to change the Logitacker shell interface from USB to UART on the nrf dongle(PCA10059). I tried to change the logitacker code by taking reference from the cli uart example from the nRF5 SDK
The changes I made to main.c so far :
#define TX_PIN_NUMBER NRF_GPIO_PIN_MAP(1,0)
#define RX_PIN_NUMBER NRF_GPIO_PIN_MAP(0, 9)
// NRF_CLI_CDC_ACM_DEF(m_cli_cdc_acm_transport);
// NRF_CLI_DEF(m_cli_cdc_acm, g_logitacker_cli_name, &m_cli_cdc_acm_transport.transport, '\r', 20);
NRF_CLI_UART_DEF(m_cli_uart_transport, 0, 64, 16);
NRF_CLI_DEF(m_cli_uart,
g_logitacker_cli_name,
&m_cli_uart_transport.transport,
'\r',
4);
// changes inside main.c
int main(void){
// ret = nrf_cli_init(&m_cli_cdc_acm, NULL, true, true, NRF_LOG_SEVERITY_INFO);
// APP_ERROR_CHECK(ret);
nrf_drv_uart_config_t uart_config = NRF_DRV_UART_DEFAULT_CONFIG;
uart_config.pseltxd = TX_PIN_NUMBER;
uart_config.pselrxd = RX_PIN_NUMBER;
uart_config.baudrate = 30801920;
uart_config.hwfc = NRF_UART_HWFC_DISABLED;
nrf_cli_init(&m_cli_uart, &uart_config, true, true, NRF_LOG_SEVERITY_INFO);
// nrf_cli_start(&m_cli_cdc_acm);
ret = nrf_cli_start(&m_cli_uart);
APP_ERROR_CHECK(ret);
inside while(True){
// nrf_cli_process(&m_cli_cdc_acm);
nrf_cli_process(&m_cli_uart);
}
}
There shouldn't be a need to modify SDK headers (nrf_cli h
), but you have to carefully craft the config files for your custom board, iot include required libs during compilation.
Also there might be a need to use two UARTs iot deconflict 'uart_cli' and 'uart_logging'
Look through my custom board configs for MakerDiary MDK, adjust settings as required and carefully match them to your board:
https://github.com/RoganDawes/LOGITacker/tree/master/mdk/blank/config
Sorry for not being more helpful, still lacking the time to support this
From what I can see, MaMe82 used a Nordic library "mod_cli" to implement the command line interface. Looking through the files, there is a mod_cli/ directory, with files for Bluetooth, usb, and uart implementations.
At a guess, I'd suggest seeing where the nrf_cli_t p_cli is assigned, and seeing what would be required to change that from usb to uart.
The esb_illegalmod
and cli_mod
folders are copies from the nrf5 SDK, with required changes.
Tbh, I can't remember why I had to do changes to CLI implementation, but they shouldn't be "invasive" (needs diffing, to find out what I did back then).
To be sure, just include the correct libs in the Makefile for your board. Again, the Makerdiary MDK file could serve as example. It includes the cli_uart
lib (Makefiles for the 3 supported boards don't differ library-wise, but otherwise are tuned to the respective board)
https://github.com/RoganDawes/LOGITacker/blob/master/mdk/blank/armgcc/Makefile#L143
I was trying to port the Logitacker console into UART. I tried to alter the code in main.c, nrf_cli.h etc, taking reference to a UART example code (cli - with small changes) from nRF5_SDK_15.3.0_59ac345. But i was not able to get the uart.
It would be so great, if you could guide me.