Hi
I'm encountering a problem in UART communication with nrf51422 on a custom board over an FTDI USB-serial converter ic.
When I send a string > 40 chars from the terminal (Termite or any other), I get a UART_ERRORSRC_OVERRUN.
I'm using UART_FIFO_INIT, no flow control on SDK11.
uart_init:
#define UART_RX_BUF_SIZE 256
#define UART_TX_BUF_SIZE 256
static void uart_init(void)
{
uint32_t err_code;
uart_buf_index = 0;
memset(uart_buf_data, 0, UART_BUF_SIZE);
static const app_uart_comm_params_t comm_params =
{
.rx_pin_no = RX_PIN_NUMBER,
.tx_pin_no = TX_PIN_NUMBER,
.rts_pin_no = RTS_PIN_NUMBER,
.cts_pin_no = CTS_PIN_NUMBER,
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
.baud_rate = UART_BAUDRATE_BAUDRATE_Baud115200
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
uart_event_handler,
APP_IRQ_PRIORITY_LOW,
err_code);
APP_ERROR_CHECK(err_code);
}
uart_event_handler snipp:
switch (p_event->evt_type)
{
case APP_UART_DATA_READY:
while(app_uart_get(&rxByte) == NRF_SUCCESS){
uart_buf_data[uart_buf_index++] = rxByte;
}
if(rxByte == '\r' || rxByte == '\n'){
// command handling
}
if(found || invalid || (uart_buf_index == UART_BUF_SIZE)){
NRF_LOG_PRINTF("[TB] UART HANDLER CLEANUP\r\n");
memset(uart_buf_data, 0, sizeof(uart_buf_data));
uart_buf_index = 0;
break;
}
break;
case APP_UART_COMMUNICATION_ERROR:
if(p_event->data.error_communication & UART_ERRORSRC_OVERRUN_Msk) {
NRF_LOG_PRINTF("[TB ERR] APP_UART_COMMUNICATION_ERROR : %d >> UART_ERRORSRC_OVERRUN | [%d] %s\r\n", p_event->data.error_communication, uart_buf_index, uart_buf_data);
}
break;