Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Example that logs over Segger RTT requiring no configuration changes by me

I'm trying to get debug output to appear in my Segger J-LINK SWO viewer (from an NR52840 SDK board with NRF5 v16) which I understand is a potentially complicated process; I've received nothing in the SWO viewer so far.  Do you have an example which sends debug output to Segger RTT by default, without me screwing anything up, i.e. all I have to do is make flash, just so that I can check that the connection and the Segger tools are good (not that there's much that can go wrong with them)?

FYI, in my sdk_config.h I have NRF_LOG_ENABLED 1,  NRF_LOG_BACKEND_RTT_ENABLED 1, NRF_LOG_BACKEND_UART_ENABLED 0NRF_LOG_DEFERRED 0 and NRF_LOG_DEFAULT_LEVEL 3 and in main.c I start with:

NRF_LOG_INIT(NULL);
NRF_LOG_DEFAULT_BACKENDS_INIT();

NRF_LOG_INFO("Hello world.\n");

In the Segger SWO viewer I've selected nRF52840_xxAA, let it measure the clock, selected channel 0, the green LED near the PCA10056 on the board is flashing regularly and I pressed the reset button on the board. Nada.

Oh, and I also have the defaults for the Segger RTT settings, i.e.:

#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0

Rob

  • Thanks for watching and understood on the other points.  I've made my default to do --chiperase --verify -r to reduce paranoia.  I've also moved those GPIOs of mine to 20, 21, 22 and 23 which seems safest.  My first run after a power-on/download still doesn't work proprly but the rest seem to work at the moment and, though there is still character loss, it is not huge.

    Thanks for all your persistent/consistent attention with this.  I will try SWO later and see if that is any better for me.  If I ever find out what the root cause is I will update this ticket.

    That's good for now, happy isolation!

  • I just wanted to make sure it wasn't a driver issue, so I repeated the tests on my end with JLink v6.64b, but it didn't seem to make any difference. The Segger project I used for test is attached below (extract to /examples/peripheral/ to build)

    blinky_logging.zip

    Stay safe!

Related