Debug Skill

Advanced UART Driver (LibUARTE) on Nordic nRF5 SDK

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:
https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/uarte.html#concept_twi_low_power

They can refer to the nrfx_uarte_uninit() on how we are doing this in our driver:
https://github.com/NordicSemiconductor/nrfx/blob/a5397bea558fb4b6838081a22d1ee679289d7417/drivers/src/nrfx_uarte.c#L301

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.