Hi,
The followings are more like an observation rather than a question..
We just upgraded to SDK 14, and realized that some of the RTT logs were mysteriously disappeared. We tried with and without NRF_LOG_DEFERRED, played with buffer sizes, but still experienced the same: chunks of logs were completely skipped. One would not expect loosing logs for eg. NRF_LOG_DEFERRED=0
, but it happens..
All logs were appearing when we were stepping in the debugger (and with the SDK 12.2 we used before)
It turned out that in nrf_log_backend_rtt.c
there is a SEGGER_RTT_WriteNoLock
with some logic around it to prevent blocking. The problem with that, is if the Segger buffer is full, the log contents will be simply discarded (from the log buffers too!), and even subsequent NRF_LOG_FLUSH
calls will not display them.
Our current solution was to remove the followings:
if (processed == 0)
{
// If RTT is not connected then ensure that logger does not block
watchdog_counter--;
if (watchdog_counter == 0)
{
break;
}
}
This has the price that it might block the caller, but at least we see the logs.
Just wondering if there is a better way to approach this...