nRF5 SDK v17.0.2
Wireless UART Example
This information applies to the nRF52840 SoC only.

This example demonstrates the usage of the IEEE 802.15.4 MAC library.

You can use the Wireless UART example to transmit and receive data between two nodes in a simple point-point wireless network. Both nodes have addresses defined at compile-time and are referred to as first and second devices. There are 2 versions of this example:

Example overview

Both of these devices work in exactly the same way, but their short addresses are different.

The devices operate in event-driven manner and their finite state machines are specified in the fsm.c. Operation of each device consists of two main parts:

Incoming packets - UART

When a byte from UART is received, the device creates a MAC Common Part Layer (MCPS) Data request to the other device and includes the received information as a MAC Service Data Unit (MSDU - data payload). Then, the device waits until a confirmation of this request is received. If the confirmation status field contains an error, the device retries the request until a successful status is received.

Incoming packets - radio

The incoming radio frames are stored in a queue. When this queue is filled or when the previous UART transmission is completed, the device pops the next frame from the queue and puts its MSDU payload into the UART output buffer.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\802_15_4\wireless_uart

LED assignments:

Testing

  1. Build and program a development board with the Wireless UART application. You can find the relevant project file in one of the following folders, depending on if you want to use raw or secure communication: <InstallFolder>\examples\802_15_4\wireless_uart\raw\first or <InstallFolder>\examples\802_15_4\wireless_uart\secure\first.
  2. Start a terminal emulator like PuTTY and configure it according to the following parameters:
    • Serial port number - use the one that was assigned to the development board by the operating system. You can refer to board installation instructions for information on how to find this number.
    • Baud rate - 38400
    • Data bits - 8
    • Parity - None
    • Stop bits - 1
    • Flow control - RTS/CTS
      Note
      The flow control setting is crucial for correct operation of the application. These hardware pins are used by the device to control data congestion and loss due to sporadic failures on the wireless link.
  3. Repeat steps 1 and 2 with another development board using the project file in one of the following folders (use the version corresponding to the one you used on the first board): <InstallFolder>\examples\802_15_4\wireless_uart\raw\second or <InstallFolder>\examples\802_15_4\wireless_uart\secure\second.
  4. Initiate the transmission by typing some data in the terminal or by sending a small file over the wireless link.
    Note
    Besides the user payload, each wireless frame holds an 8-bit application layer counter. This allows the Wireless UART application to ensure that no data frames are lost during transmission.

Documentation feedback | Developer Zone | Subscribe | Updated