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

SEGGER RTT printf blocking mode dynamically

Hi guys,

is it possible to print in blocking mode by request?

I tried to use a return value from SEGGER_RTT_printf(0, "some text\n"); but the value is always the same independent of if it is printed to the console or not.

i also tried to

#undef SEGGER_RTT_CONFIG_DEFAULT_MODE

#define SEGGER_RTT_CONFIG_DEFAULT_MODE SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL

SEGGER_RTT_printf(0, "some text\n");

but nothing changed.

Is there a way or a function to check or wait for the FIFO to get empty and to be sure that the text will be printed?

I'm also ready for changing SEGGER_RTT files if needed.

Thanks

  • Hi,

    I recommend using the nrf_log module if you are doing logging. If you are seeing logs being dropped, then increase the NRF_LOG_BUFSIZE parameter in sdk_config.h

    I tried to use a return value from SEGGER_RTT_printf(0, "some text\n"); but the value is always the same independent of if it is printed to the console or not.

    I also see the same behavior with SEGGER_RTT_printf(). But with SEGGER_RTT_WriteString(), it returns 0 if the log is not printed to console. So you could maybe use that function instead. RTT is developed by Segger, so if you ask in their forum, they might be able to explain why SEGGER_RTT_printf() does not return 0.

Related