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

Debug UART with SDK 7.1

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. developer.nordicsemi.com/.../a00074.html

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.

Parents
  • 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

  • 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?

Reply Children
No Data
Related