Can not restart UART RX after one error

When I get the first error in UART, the receiving of new characters stops (the transmittion continue working)

and I didn't find any solution to make RX (receiving characters) works again without CPU reset.

I create the error by disconnecting the UART cable and reconnecting it again.

the ERROR register is set to 1. thr ERRORSRC show framing and/or break error.

I tried to call: 

nrfx_uart_uninit(&m_uart0);

and the init the UART

void hal_init_uart(void)
{
   ret_code_t err_code;

   nrfx_uart_config_t uart_config = NRFX_UART_DEFAULT_CONFIG;

   uart_config.pseltxd = HAL_USART0_TX;
   uart_config.pselrxd = HAL_USART0_RX;

   err_code = nrfx_uart_init(&m_uart0, &uart_config, uart0_event_handler);
   if (NRFX_SUCCESS != err_code)
      NRFX_LOG_ERROR("%s nrfx_uart_init failed: %s", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
   APP_ERROR_CHECK(err_code);
}

I tried also to delete the error using

nrfx_uart_errorsrc_get(&m_uart0);

the error was cleared from ERROR and ERROORSRC registers, but stil after uart reinit , the charaters are not received.

the RX interrupt didn't occur. only transmit works,

Only cpu reset fix it, but I want to avoid unnecessary reset.

currently I fixed the problem by canceling the error interrupt by fixing the nrf_sdk function:  nrfx_uart_rx

nrf_uart_int_enable(p_instance->p_reg, NRF_UART_INT_MASK_RXDRDY /* |
NRF_UART_INT_MASK_ERROR */);

I realy want to find a way to reset the UART with no global CPU reset

Parents Reply Children
Related