1

Debug UART with SDK 7.1

tj1988 gravatar image

asked 2014-12-03 05:54:32 +0100

updated 2014-12-03 08:48:20 +0100

I just switched over from SDK v6 to SDK v7.1 (installed via those Keil Packs). The UART has suddenly stopped working (via Segger USB COM port) and I can no longer see any debug console output. It's just giving me garbage characters.

I'm using the NRF51822 on the PCA10001 reference design.

Is this a known issue? If I wanted to 'start over' in providing a console output, how would I go about enabling UART debug console output over the Segger COM port? I've already searched the forum and have been unable to resolve this.

I also tried following the SDK instructions for Debug, but that didn't work either. http://developer.nordicsemi.com/nRF51...

38400 bps, 8N1, no parity, no flow control. Changed the bps to 115200, same settings, no change. No matter what settings I change I still get garbage characters.

Thanks.

edit retag flag offensive close delete report spam

Comments

5 answers

Sort by ยป oldest newest most voted
5
cpignol gravatar image

answered 2014-12-06 02:51:41 +0100

Found a solution for the UART problem.

Stop using app_trace_init and app_trace_log (deselect app_trace in pack routine selection) import from ble_app_hrs_printf the routine retarget.c

#include <stdio.h>
#include <stdint.h>
#include "simple_uart.h"
#include "nordic_common.h"
#include "nrf51.h"
#include "nrf51_bitfields.h"
#include "boards.h"**

struct __FILE { int handle; /* Add whatever you need here */ };
FILE __stdout;
FILE __stdin;

void retarget_init(void)
{
    simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, HWFC);
}

int fputc(int ch, FILE * p_file) 
{
    simple_uart_put((uint8_t)ch);
    return 0;
}

/**
 *@}

 **/

Then use retarget_init(); to initialize the UART and printf to output message. With this setup the baudrate is 38400 no parity no flow control.

This works with PCA10001 (COM3) and PCA10028 (COM6).

Claude

edit flag offensive delete publish link more

Comments

Thank you!!

jt ( 2014-12-11 03:25:51 +0100 )editconvert to answer

I'm currently having the same problem, but Keil packs is requiring that I include app_trace_init and log because I'm using the BLE device manager library, which requires them. Any solutions/way around this to get retarget and printf working again?

Seth ( 2015-03-11 16:43:12 +0100 )editconvert to answer

Thanks for the tip! I was just running into this when upgrading from SDK 6.

The big question is "why"? What has broken?

Here's the default HRS example's output with device_manager output turned on:

                                                   [DMDe[DM]: Dedx[DM]:c[DM][DM:y[DM]: DeA [DM] t
Jerod ( 2015-05-22 20:29:48 +0100 )editconvert to answer
4
woja gravatar image

answered 2014-12-08 11:49:09 +0100

damien5606 gravatar image

updated 2015-02-12 00:32:48 +0100

Hello, You have to check which kind of app_uart you have linked to your project. App_trace requires app_uart_fifo.c.

edit flag offensive delete publish link more
0
cpignol gravatar image

answered 2014-12-04 08:12:16 +0100

damien5606 gravatar image

updated 2015-02-12 00:32:46 +0100

Hi,

I am also using SDK7.1 with the new nRF6824 (nRF51 Development kit), When I try to use app_trace_init and app_trace_log via Segger USB COM I get the first character of each app_trace_log call. app_trace_log("Test\r\n") will print T. I am using PuTTY 115200bps 8 bits no parity no HWFC. Thanks

edit flag offensive delete publish link more
0
Stian gravatar image

answered 2014-12-04 10:51:24 +0100

damien5606 gravatar image

updated 2015-02-12 00:32:47 +0100

What do you mean with "switched over"? Are you trying to port your existing application over to SDK 7.1, or did you just start with a fresh example from SDK 7.1?

edit flag offensive delete publish link more
0
tj1988 gravatar image

answered 2014-12-19 02:23:05 +0100

damien5606 gravatar image

updated 2015-02-12 00:32:49 +0100

I'm porting my existing application to SDK 7.1. I just got the new NRF51 dev kit (was using PCA10001), so I'll be doing a more major port in the coming week to that + new SDK.

Wojciech - thanks, didn't know that, will give that a shot

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower

Stats

Asked: 2014-12-03 05:54:32 +0100

Seen: 2,011 times

Last updated: des. 06 '14