Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Disabling UART RX issues

I am experience some for me strange behavior with UART0 on a nrf52832. Let me explain:

First I initialize the UART using:

APP_UART_FIFO_INIT(...)

with parameters setup to match my requirements. I assume this done on UART0 since there is no parameter specifying the UART instance. After initialization the UART is enabled, but I don't want the RX to be enabled from start so I disabled it using this:

static nrf_drv_uart_t m_uart = NRF_DRV_UART_INSTANCE(0);

nrf_drv_uart_rx_disable(&m_uart); (which I can see actually sends the TASKS_STOPRX command to the UART).

Right after calling nrf_drv_uart_rx_disable(&m_uart), I receive an UART interrupt in my APP_UART_CALLBACK_HANDLER with type APP_UART_DATA_READY and data = 0. Why is that so (I see the EVENTS_RXTO is asserted but that shouldn't generate a APP_UART_DATA_READY interrupt).

Also after having disabled the RX I wouldn't expect the RX to be able to receive data on UART RX. However it just keeps handling incoming data on the UART RX generating APP_UART_DATA_READY  interrupts. This is not what I expected after disabling the UART RX. However calling app_uart_close(); instead, I don't get the APP_UART_DATA_READY interrupt and the UART RX is actually disabled as expected. What's the difference?

What's the the proper way of bringing the UART into sleep (low power mode). Is it enough to issue TASKS_STOPRX and TASKS_STOPTX commands?

I am using SDK14.0.

BR

Kim

Parents Reply Children
No Data
Related