nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
UART Example

Modules

 main.c
 UART Example Application main file.
 

Detailed Description

The UART Example project uses UART to communicate with a PC. It transmits and receives through the configured pins as serial device. The configured pins needs to be redirected to a COM port (or some terminal program like putty which can listen to this COM port through a terminal session). When the program start it will transmit "START: " through this serial device using simple_uart_putstring and this should be visible on the terminal. All typed characters on this terminal will be transmitted to this program through simple_uart_get and when an exit character 'q' or 'Q' is typed this program will end into an infinite loop after transmitting "EXIT!" on the new line of the terminal.

Note
This example is not just for COM ports but can be used for any UART connection, COM port redirection is for visual verification.
Setting the define ENABLE_LOOPBACK_TEST will assume that the TX_PIN_NUMBER is connected to RX_PIN_NUMBER and this example is used to test the loopback. In this case no com port can be used as the data flows from TX to RX and ERROR_PIN is set high for any loss of data.
Configure your terminal application for 38400 bauds, 8 data bits and 1 stop bit.

Setup

Connect the PCA10001 board to the PC using a USB cable, and find out which COM port it uses.

Testing

The UART Example Application can be tested as follows:

  1. Compile and program the application.
  2. Use a terminal program on your PC to connect to the PCA10001 board. 38400 bps, 8 data bits, 1 stop bit.
  3. The word 'Start:' should appear in the terminal.
  4. By pressing 'Q' or 'q', the program ends and the word 'Exit!' appears in the terminal.