I see this error when transmission starts and after this RX simply do not work. Even clearing error not helping.
Rx works fine when there is not any transfer done (firmware with only RX capability). But when Tx cimes in picture Rx do not work.
I see the NRFX_UART_EVT_ERROR is raised at the start of when I try TX.
After playing around a bit I see that returning from an IRQ handler is working quite well. I added `return` at line 12 and I am able to use Tx and Rx both in same firmware.
static void uart_irq_handler(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) { if (nrf_uart_int_enable_check(p_uart, NRF_UART_INT_MASK_ERROR) && nrf_uart_event_check(p_uart, NRF_UART_EVENT_ERROR)) { nrfx_uart_event_t event; nrf_uart_event_clear(p_uart, NRF_UART_EVENT_ERROR); NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRF_UART_EVENT_ERROR)); // @shubham return; nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); if (!p_cb->rx_enabled) { nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STOPRX); } event.type = NRFX_UART_EVT_ERROR; event.data.error.error_mask = nrf_uart_errorsrc_get_and_clear(p_uart); event.data.error.rxtx.bytes = p_cb->rx_buffer_length; event.data.error.rxtx.p_data = p_cb->p_rx_buffer; // Abort transfer. p_cb->rx_buffer_length = 0; p_cb->rx_secondary_buffer_length = 0; p_cb->handler(&event,p_cb->p_context); }
Is there any other way to handle this?
I do not know the consequences of returning from an IRQ handler in details. I will surely look into the code in more detail, If you guys know anything about this error. How to get this working without returning.