Hi
I want to ask about the best way to handle a lot of incoming bytes via UART on the nRF52832 (SDK 15.0.0).
Unfortunately, the parsing of incoming data seems to be slower than the data coming in during bursts and the HWFC pins are not available.
Data is sent in bursts of up to 1349 bytes at a baudrate of 115200, although most communications will be significantly shorter.
Currently I'm using the serial library in IRQ mode (don't want to use DMA mode as it uses more power)(I also don't want to use polling mode, although I
didn't have the problem in polling mode). In the handler for the NRF_SERIAL_EVENT_RX_DATA event I'm doing nothing but copying the data to another
queue and starting a timer for processing.
uint8_t ch;
if (nrf_queue_read(p_serial->p_ctx->p_config->p_queues->p_rxq, &ch, sizeof(ch)) == NRF_SUCCESS)
{
uart_rx_queue_write(&ch, sizeof(ch));
if (!m_timer_running)
{
APP_ERROR_CHECK(app_timer_start(m_rx_timer, APP_TIMER_TICKS(15), NULL));
m_timer_running = true;
}
}
Then in the timer handler I'm reading data from the queue and try to parse it. (As I understand the app_timer interrupt priority is much lower
than the UART interrupt handler, and, thus, the interrupt handler should not be affected). Nevertheless, I receive UART overflow
error events.
I don't care whether I end up having to use the serial library, high level UART driver or low level UART HAL, but what is the preferred way to
avoid overflow errors? Again, the HWFC pins are not available, but if nothing else helps, I can define the protocol so that the sender
has to wait x milliseconds after sending each packet of 166 bytes if that is the only solution.