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_int_disable(serial_uart.instance.uart.p_reg, NRF_UART_INT_MASK_RXDRDY);



/* attempt to enable RX */

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


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`

  • There is only one interrupt handler, and it checks the hardware registers on any interrupt regardless of the source.

    In other words: The TX interrupt triggers the RX handling part.

    Workaround: Use different uart for TX (NRF52840) or use another source/peripherial to generate UART signals (e.g. PWM with DMA).