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

Unable to see uart logging from nRF51822 with ST-Link v2 and openOCD

I'm attempting to modify some open source software for an nRF51822 chip found here: https://github.com/reversebias/mitosis

In this code there are some debugging lines that use uart to print some things out. The lines that I am referring to are in this file: https://github.com/reversebias/mitosis/blob/master/mitosis-receiver-basic/main.c and they look like this:

            // debugging help, for printing keystates to a serial console
            /*
            for (uint8_t i = 0; i < 10; i++)
            {
                app_uart_put(data_buffer[i]);
            }
            printf(BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN " " \
                   BYTE_TO_BINARY_PATTERN "\r\n", \
                   BYTE_TO_BINARY(data_buffer[0]), \
                   BYTE_TO_BINARY(data_buffer[1]), \
                   BYTE_TO_BINARY(data_buffer[2]), \
                   BYTE_TO_BINARY(data_buffer[3]), \
                   BYTE_TO_BINARY(data_buffer[4]), \
                   BYTE_TO_BINARY(data_buffer[5]), \
                   BYTE_TO_BINARY(data_buffer[6]), \
                   BYTE_TO_BINARY(data_buffer[7]), \
                   BYTE_TO_BINARY(data_buffer[8]), \
                   BYTE_TO_BINARY(data_buffer[9]));   
            nrf_delay_us(100);
            */

When I uncomment this code to try to read the keystates that are being logged, nothing appears in my console, but I've noticed that the firmware runs much more slowly.

When I do this, I'm connecting an ST-Link v2 to the 3.3V, GND, SWDIO and SWDCLK pins of the NRF51822. I am using openOCD to open a debugging session, which allows me to flash the firmware to the nRF51822. I have no problem getting a debug session with OpenOCD or flashing the firmware. When I ground the GPIOs that should trigger the debug logs however,  I don't see anything in the openOCD session.

Am I looking in the right place for these log statements?

Other details: I'm on Ubuntu 18.04 and using the nordic SDK11.

Related