This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART interrupt event handling on SDK14.0.0

Hi

I have an application where I cannot use the FIFO buffers (HW or SW). Therefore I need an interrupt for each received byte. If I try to use the uart driver (nrf_drv_uart.c) I have problems enabling the RXDRDY event. Or more precise: If I enable the event, it will be forced disabled again after the first interrupt by the driver.

On the other hand, I have newer seen the RXTO event been triggered. Which I had expexted when the RXDRDY event is not enabled. The STARTRX task is not possible to start, and if I try to do it by using the debugger, it will be disabled again at once.

Following config is done in the sdk_config.h:

#define UART_ENABLED 1
#define UART_EASY_DMA_SUPPORT 0
#define UART_LEGACY_SUPPORT 1
#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 7
#define UART0_ENABLED 1
#define UART0_CONFIG_USE_EASY_DMA 0

And the initialization is done like this:

static void uart_init(void)
{
    uint32_t                     err_code;
    nrf_drv_uart_config_t const comm_params =
    {
        .pselrxd    = RX_PIN_NUMBER,
        .pseltxd    = TX_PIN_NUMBER,
        .pselrts   	= RTS_PIN_NUMBER,
        .pselcts   	= CTS_PIN_NUMBER,
        .hwfc 			= NRF_UART_HWFC_DISABLED,
        .parity   	= NRF_UART_PARITY_EXCLUDED,
        .baudrate   = NRF_UART_BAUDRATE_115200,	
        .p_context	= NULL			
    };

		err_code = nrf_drv_uart_init(&app_uart_inst, &comm_params, uart_event_handle);
    APP_ERROR_CHECK(err_code);
		nrf_drv_uart_rx_enable(&app_uart_inst);
}
Related