Overview : UART driver handling at nRF52

This blog is to describe how many difference approaches to use the UART driver on the nRF52 Series.

Background

Inside the nRF52 series product specification, there are two difference UART perpherals.

  • UART (Legacy) — similar to NRF51 series
  • UARTE (Enhance UART driver with Easy DMA).

All information Length of UARTE DMA can be found at SDK folder SDK\modules\nrfx\mdk.

ChipsetMaximum length of UARTE DMA (bit)
NRF5281010 (1024 bytes)
NRF5281114 (4096 bytes)
NRF528328 (256 bytes)
NRF5284016 (65536 bytes)

By using the UARTE, it needs to specify the length of EasyDMA. The RX received complete event would only be triggered if the number of received byte reaches the DMA length. Otherwise, the UARTE would be still in the data receiving window.

There are some discussions of UARTE on the Nordic Devzone.

In order to improve the flexibility of UARTE usage, an experimental driver LibUARTE is introduced inside the Nordic SDK. It uses the 2 x timers + PPI to trigger the timeout event as RXTO if the received data is not reached the MAXCNT on UARTE DMA.

https://devzone.nordicsemi.com/f/nordic-q-a/41215/general-libuarte-questions

Hardware configuration

2-Wire UART

uart 2 wire的图片搜寻结果
Standard 2-Wire UART connection

3-Wire UART

The INACTIVE notification is right after the radio goes inactive, regardless of the notification distance configured. In other words, the notification distance only applies to the ACTIVE signal, if enabled.

Note that the timings (ACTIVE notification distance, the phrase “right after the radio goes inactive”) refers to the instance where the software interrupt is set pending. The time you observe that the interrupt handler is executing may vary depending on the CPU activity at the different priority levels.

Tutorial how to use the radio notification

https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/radio-notification

Radio Notification can be used as the RADIO status at the nRF52 Series. When the Radio is active, external HOST MCU doesn’t allow to send the data. It is used to prevent the high priority interrupt (RADIO) to interrupt the UART interrupt which may cause some data lost particular by using the Legacy UART. This is a simple flow control.

4-Wire UART

Standard 4-Wire UART connection with HW flow control

6-Wire UART Connection

  • 2 Wire Standard UART + 4 extra wire proprietary flow control
RX Sequence at nRF52

Sequence of the RX (nRF52) as example

Step 1: if the MCU would like to send the data to nRF52, the TX data request pin is pulled down (active low) on request.

Current Consumption on the nRF52 DK board

Benchmark on the current consumption

  • Connectable Undirected Advertising
  • Advertising Payload = 25 bytes
  • TX Power = 0 dBm
  • VDD voltage = 3.0 with DCDC
  • Advertising interval = 1000 msec

Case 1 :

  • Add the app_uart (UARTE with DMA) enable
// <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer
//==========================================================

#ifndef UART_ENABLED
#define UART_ENABLED 1
#endif

// <q> UART_EASY_DMA_SUPPORT  - Driver supporting EasyDMA

#ifndef UART_EASY_DMA_SUPPORT
#define UART_EASY_DMA_SUPPORT 1
#endif

// <q> UART_LEGACY_SUPPORT  - Driver supporting Legacy mode

#ifndef UART_LEGACY_SUPPORT
#define UART_LEGACY_SUPPORT 1
#endif
Current consumption with UARTE with DMA ~ 1.3 mA

Case 2:

  • Add the app_uart (with legacy) enable
// <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer
//==========================================================

#ifndef UART_ENABLED
#define UART_ENABLED 1
#endif

// <q> UART_EASY_DMA_SUPPORT  - Driver supporting EasyDMA

#ifndef UART_EASY_DMA_SUPPORT
#define UART_EASY_DMA_SUPPORT 0
#endif

// <q> UART_LEGACY_SUPPORT  - Driver supporting Legacy mode

#ifndef UART_LEGACY_SUPPORT
#define UART_LEGACY_SUPPORT 1
#endif
Current consumption with UART (Legacy) ~ 3xx uA

One thought on “Overview : UART driver handling at nRF52

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.