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

Disable interrupts for RX

I want to disable and enable interrupts for Rx data, I tried following code to disable interrupt for rx and disable rx.
Also TX and RX pins are short, i.e. loopbacked. In short I do not want to receive data on RX.

 

/* attempt to disable RX */

nrf_uart_disable(serial_uart.instance.uart.p_reg);

nrf_drv_uart_rx_disable(&serial_uart.instance);
nrf_uart_int_disable(serial_uart.instance.uart.p_reg, NRF_UART_INT_MASK_RXDRDY);

nrf_uart_enable(serial_uart.instance.uart.p_reg);

///////////////////////////////////////////////////

/* attempt to enable RX */
nrf_uart_disable(serial_uart.instance.uart.p_reg); 

nrf_uart_int_enable(serial_uart.instance.uart.p_reg, NRF_UART_INT_MASK_RXDRDY);
nrf_drv_uart_rx_enable(&serial_uart.instance);

nrf_uart_enable(serial_uart.instance.uart.p_reg);

I am playing with sample code at `examples/peripheral/serial`.

But the above code does not work, code still flows through `NRF_DRV_UART_EVT_RX_DONE` part of `uart_event_handler` in `nrf_serial.c`

Related