This blog is to describe some data flow on the libuarte which is under the nRF5 SDK.

As the below, you can find the libuarte events on difference receive mode.

The official production release of the libuarte has released since SDK 16.0 or later.

For example, you set the libuarte DMA buffer to 255.

There are 3 cases.

Case 1)

If the length of RX data is exactly equal to 255, it would get the NRF_LIBUARTE_ASYNC_EVT_RX_DATA_DMA_MATCH.

Case 2)

If the length of RX data is less than 255 bytes, the system need to wait for the timeout and then it would get the RX_DATA_TIMEOUT.

Case 3)

if the length of RX data is more than 255 bytes (e.g. 300 bytes), the system would get two events (DATA_DMA_MATCH and RX_DATA_TIMEOUT) together.

Approach 1:

The very likely problem here is that the description in Low Power chapter is not followed:

They can refer to the nrfx_uarte_uninit() on how we are doing this in our driver:

Make sure they follow the same procedure in their uart driver.

If they are still not able to find the issue, then they may add the following to the end of uninit(), this will do a hard reset of the uarte0 and ensure it goes to default state:

*(volatile uint32_t *)0x40002000 = 0;
*(volatile uint32_t *)0x40002000;
*(volatile uint32_t *)0x40002000 = 1;

Approach 2:

we have a new and better fix that targets the issue more directly. You can simply add this to the beginning of the main function:

*(volatile uint32_t*)(0x4007AC84) = 0x00000002;

I add the example code on the SDK 16.0 (libuarte + ble_app_uart) together.