Making sure that UARTE EasyDMA transactions are completed before going to System OFF

Hi,

This is a follow-up topic regarding proper SystemOFF/wakeup sequence.

Some time ago I posted this issue:

nRF52840 sometimes won't wake up. - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

The conclusion was:

"Before entering System OFF mode, all on-going EasyDMA transactions need to have completed. See peripheral specific chapters for more information about how to acquire the status of EasyDMA transactions"

I went through all the peripherals in the project to make sure this requirement is sorted out before going to System OFF.

However I'm a bit lost when it comes to UART.

I use uart0 with nordic,nrf-uarte driver in the device tree. This driver uses EasyDMA, unlike nordic,nrf-uart.

In the chosen node, uart0 is used for several things, such as log, shell, and others:

Fullscreen
1
2
3
4
5
6
7
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
zephyr,bt-c2h-uart = &uart0;
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Now I need either to make sure that no EasyDMA transaction is pending in the UART peripheral, or use non-EasyDMA driver.

Using non-EasyDMA driver might be an easy solution, but I'm afraid that the log throughput and overall performance will suffer.

On the other hand, I'm not sure what would the the proper way to stop UART.

I could use the low level nrfx driver API (nrfx_uarte_uninit), but I'm afraid that upper layer system services using UART will get upset.

So far, I did not find functions to completely disable shell and logs, not to mention the remaining 3 services that are listed in the chosen node. I will keep looking at it, but I thought that maybe somebody already faced this problem and worked out a solution.

I cannot afford taking a risk and neglect EasyDMA requirement, even though after exensive testing I don't face the SystemOFF/wakeup issue anymore. Do you have any suggestions?