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

NRF_LOG printing through RTT does not print

Hi,

I have just recently started to develop an NRF52832 chip with Keil uVision 5.

My setup is the following:

PCA10028 Development kit connected to Feather NRF52832 bluefruit LE with SWD cable to debug pins

SDK 12.3.0

I have managed to develop and flash to the chip successfully during the course of one week without problems, but I haven't managed to get printing to the J-Link RTT viewer to work yet.

I am using the NRF_LOG functions to print simple test strings but nothing shows up on the RTT viewer. What I've done so far:

- Modified the sdk_config.h: (NRF_LOG_BACKEND_SERIAL_USES_RTT 1 , and NRF_LOG_ENABLED 1)

- With the J-Link RTT viewer: connected to USB port of Development kit successfully (SWD 4000 kHz). See picture below.

- Flashed a simple blink program just for testing NRF_LOG functionality (blinking works as it should, but no printing):

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
NRF_LOG_INIT(NULL);
char string_on_stack[] = "stack";
NRF_LOG_INFO("%s",nrf_log_push(string_on_stack));
NRF_LOG_DEBUG("TESTING");
/* Configure board. */
bsp_board_leds_init();
uint32_t err_code;
while(true){
for (int i = 0; i < LEDS_NUMBER; i++)
{
NRF_LOG_INFO("%s",nrf_log_push(string_on_stack));
bsp_board_led_invert(i);
nrf_delay_ms(500);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have followed the SDK documentation and tutorials trying to troubleshoot the problem without success. I am a beginner so I suspect I am missing something trivial. 

  • Hi Erik, 

    First off, I would recommend you to use the latest SDK version (v15) if you are starting out your "developing adventure". 

    I would like you to add:

    Fullscreen
    1
    NRF_LOG_DEFAULT_BACKENDS_INIT();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    under the NRF_LOG_INIT() function. Also a good tip is to look at how other examples have integrated this, for example take a look at the log_init() function of the "ble_app_uart" example.

    Also remember that you have to increase the number of the NRF_LOG_DEFAULT_LEVEL  (in sdk_config.h) if you are going to print out "NRF_LOG_DEBUG" messages.

     


    Adding settings info for convenience: 

  • Hi Martin,

    Thank you for the quick response. I will try your suggestions out and return if I don't get them to work.

    Yes, will look through the examples and also possibly upgrade to the latest SDK version.

    I have the exact same RTT viewer settings as you. My All Terminals window is completely empty. Could that indicate something or is it normal? 

    Best regards,

    Erik

  • Hi Erik,

    Your terminal should have the RTT logs from your application if everything is set correctly.

    I would advise you to test out a application that we know works with RTT logging.

    Please use the "ble_app_uart" example from SDK v15 and flash it on your device to test it out.

     

  • Hi Erik !

    I was looking at this thread because i'm using Segger Embedded Studio with the same setup as yours (SDK 12.3.0 with PCA10028) and no log output was coming out from the TWI example i'm using. 

    I found in the file sdk_config.h at line 550 -> NRF_LOG_BACKEND_SERIAL_USES_RTT 0. I put it to 1 and it started printing logs on SES output terminal.

    Maybe if you're still using your setup you started with and you do this slight modification, it would start printing ???

    And Martin, a question for you. We can't use SDK v15 with PCA10028 right ? If I'm not mistaken, inside the documentation for each Softdevice in the infocenter, it is written for SDK 15.0.0 : 

    Supported boards:
    - PCA10040
    - PCA10040E (nRF52810 emulation on PCA10040)
    - PCA10056
    - PCA10059 (support in selected examples)
    - Dynastream's D52DK1 (only for ANT examples)

    So PCA10028 is not supported.
  • Hi Oliver,

    Yes, you are correct.

    The last SDK to support nRF51 series is the SDK version 12.3

1 2