This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to get uart_example to work on NRF51822?

I am unable to see any uart print output when running the uart_example with NRF51822. I am able to see the program execute via the debugger, but have not seen any output. I have tried using it with and without the SoftDevice flashed, using the appropriate build target as required. I am using the nRF51822 development kit with the nRF6700 starter kit and have it setup following the quick start guidelines.

Are there additional steps I need to perform to get UART output enabled? From what I can tell from other posts on this forum, the output is expected to come across on the "JLink CDC UART Port"?

What are the exact settings I should be using in my serial terminal application? I have been using:

Baud rate: 38400 Data: 8 bit Parity: none Stop: 1 bit Flow Control: none (and also tried Xon/Xoff)

If it helps, I am using Tera Term on Windows 7 (x64).

Parents
  • If you're using the Development Kit, and flashing to that module, you need to connect a serial cable or USB-to-UART bridge to the serial port on the motherboard and also make sure that the appropriate pins of the nRF51822 (pin 15 and 16 by default) are connected to the RXD/TXD on P15. This is shown in section 2.9 in the nRFgo Starter Kit User Guide. Your UART settings seems correct for such setup.

    The J-Link CDC port you see is most likely the one that your development dongle exposes, so if you flash the pca10000 UART example to it, you should see UART data coming out of it. This port requires hardware flow control

Reply
  • If you're using the Development Kit, and flashing to that module, you need to connect a serial cable or USB-to-UART bridge to the serial port on the motherboard and also make sure that the appropriate pins of the nRF51822 (pin 15 and 16 by default) are connected to the RXD/TXD on P15. This is shown in section 2.9 in the nRFgo Starter Kit User Guide. Your UART settings seems correct for such setup.

    The J-Link CDC port you see is most likely the one that your development dongle exposes, so if you flash the pca10000 UART example to it, you should see UART data coming out of it. This port requires hardware flow control

Children
  • Thank you! That got me on the right track. I had some minor differences.

    Without any changes to the UART example that I have, the pin assignments are (taken from nrf6310.h included by the uart_example):

    #define RX_PIN_NUMBER 16 // UART RX pin number. #define TX_PIN_NUMBER 17 // UART TX pin number. #define CTS_PIN_NUMBER 18 // UART Clear To Send pin number. #define RTS_PIN_NUMBER 19 // Not used if HWFC is set to false

    For a nrf51822-DK (PCA10005) connected to a nrf6310, I connected P15's RXD and TXD to P2.0 and P2.1, respectively. I also connected P15's CTS and RTS to P2.2 and P2.3, respectively.

  • Off topic: What I can recommend is also to buy the (very cheap) Saleae logic analyzer. I was following devzone.nordicsemi.com/.../a00009.html as a good boy, but discovered in the end that I failed to set the baud rate right, e.g. 0x009D5000UL for 38400 baud. Not only can you see if you didn't switch TX and RX by accident. The automatic baud rate detection of the logic analyzer software can solve these problems in no time!

Related