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

Get serial IO from evaluation kit nRF51422 via the Segger debug interface

Have you also wondered how to get serial IO (UART) with nRF51422-EK via the Segger debug interface?

[list=1] []Plug Eval kit in the USB port. []In Windows open "device manager" and read the port number from "Ports (COM & LPT)" under "JLInk CDC UART Port (COM16)". My system uses COM16 but this could be different in other setups. []Open a serial port terminal program or similar application on the PC and set the proper port nr, baud-rate, RTS/CTS, bits and parity which match the values in the target. (default in examples is 38400 baud, no RTS/CTS, no parity, 8bits). []Run the Target application on nRF51422-EK.

[/list] Note that the printf(), puts() functions are discarding return values from underlying uart I/O call's, so back-pressure is not working even if RTS/CTS is enabled. This can show up as garbled-up data. To avoid this, use the functions from the underlying app_uart.c and act according to the return values.

As I understand, it is possible with app_uart.c to have the nRF51x22 to power down and sleep-wait when CTS back pressure is signalling that the host is busy and can take no more data. I did not get this to work however. Setting APP_UART_FLOW_CONTROL_LOW_POWER in comm_params, then no data is sent from nRF51x22. This could have many reasons and I bailed out reviewing the app_uart_init() code as this is rather complicated. I know the serial adapter works with RTS/CTS in other applications (not using Segger debug port but one from FTDI). If others have had APP_UART_FLOW_CONTROL_LOW_POWER to work I would like to hear about it. The application is not using softdevice.

I wrote this note because the nRF51422-EK user manual, does not explain how to actually connect to the UART from the host, and a search in Keil documentation for "UART" or "Serial" gives an overwhelming number of hits. Surely one of them will be the right I just did not find it.

May I suggest that NS updates the nRF51422-EK user-manual with this vital piece of information or did I overlook something obvious?

  • This is a very good how-to, but since you have posted the answer as a question, it shows up as unanswered. I therefore post this answer mostly to get it out of that list, and I'll also mark the discussion as resolved, without accepting an answer explicitly.

    For the future, it would be nice if such how-tos were posted as an answer to a question, for exmample posted by yourself or as an anonymous user, just to follow the structure a little nicer and make things easier to find again. :-)

  • Ok - got it. Maybe you should put a clarifying note about the "rules of the game" in the "About" or some place like this, or you will have to explain this more often. Just a suggestion.

    ´For this particular case: I encourage you to update the documentation.

  • Yes, making such a guide is most definitely something we'll try to do, we just haven't quite found out how to do it UI-wise.

    Anyway, I've posted the request for more documentation internally, so it can be fixed for a future release. Thanks for letting us know, and not least, thank you very much for the write-up! I see I forgot to do that in my initial reply!

  • Ole Morten, Concerning the user guide for this forum: The quick way is to just add a paragraph to the About menu. And perhaps rename it to "User Guidelines" - or add this as a further menu of itself in addition to documentation. The About title smells like "contact-information" stuff. Sorry this is way off topic but I dont want to start a new topic for this.

  • If I add a printf statement to my code (and include <stdio.h> so it compiles) it kills BLE.

    Can someone at NS enlighten us on the recommended ways of debugging our applications?

    Keil's source-level debugger kind of works, but not really. It tells me all of my variables are out of scope.

    If there isn't a console out on this thing, then we're kind of screwed.

    Can we get an official how-to on debugging? Or, maybe it exists and I just missed it?

Related