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

How to enable blocking log output with RTT? - SDK15

Hello,

I want to be able to toggle blocking RTT output when using the log module.

Before in SDK13 I could just set SEGGER_RTT_CONFIG_DEFAULT_MODE to 2 in the sdk_config.h file. That doesn't seem to work anymore with the new logging module. I keep seeing these red logs saying "Logs dropped(x)" even though the mode is set to BLOCK. The whole point of having blocking output is that no logs are dropped.

How can I achieve this now? Thanks in advance for your support!

Parents
  • Hi Andy,

    Are you using deferred logging?

    Blocking at the RTT level seems to work. I have tested with the following simple code. I can see that there is no gap in the printed numbers even if I disconnect the RTT viewer for a period of time before reconnecting.

        while(true)
        {
            i++;
            NRF_LOG_INFO("%i", i);
            NRF_LOG_PROCESS();
        }

    However, the higher lever nrf_log module does not support blocking per se. So if you use deferred logging in a more realistic way, calling NRF_LOG_* multiple times before calling NRF_LOG_PROCESS(), you could fill up the nrf_log buffer. This is not the same as the RTT buffer, and is defined by NRF_LOG_BUFSIZE in sdk_config.h. Not using deferred logging should solve the issue in this case (though I have not tested).

     

     

  • Disabling deferred logging indeed solves the problem :) This wasn't an issue previously in SDK 13 though.

Reply Children
No Data
Related