I am migrating sdk 15.2 to 15.3. Everything works fine, except the nrf logging. Currently, I am using RTT configuration, with default backend enabled. The code is simple:
// Initialize SDK Logger.
Things odd is that: the log is dumped in a quite slow speed. It acts like, the logging buffer stored in rnf52840 chip. Without event triggered, they are not dumped into RTT viewer. That is to say, the log is dumped in a very deferred way. The latest logs are always not shown in RTT viewer.
BTW, other code is the same, with usbd enabled and also BLE. The functional thing works fine.
The same code works well under sdk 15.2, with the logging is dumped immediately.
Since I can not find a way to debug it, would you please give me some suggestions on this? A list of the nrf_log changes in sdk 15.3 would be fine. I attached my sdk_config.h
Due to the Easter holiday you will have to expect a delay in replies, sorry for the inconvenience!
I have dug a little, and might have found a solution to your slow RTT logging. It may be cause by the fact that Segger needs to search for the RTT block in RAM after a reconnect. I also noticed that idle_state_handle() is only processing one log entry before entering idle, instead of flushing the entire log buffer. Could you try changing the idle_state_handle to this and see if it improves the RTT speed?
static void idle_state_handle(void)
static int cnt = 0;
if(NRF_LOG_PROCESS() == false)
Also, the fix to the issue awneil suggested, is to do it like it is done in other examples which sleeps, calling NRF_LOG_PROCESS() repeatedly until it returns fall before going to sleep.
Simonr said:the fix to the issue awneil suggested, is to do it like it is done in other examples which sleeps, calling NRF_LOG_PROCESS() repeatedly until it returns fall before going to sleep
But isn't that what nine-fox is doing with this:
/* Handle background and debug events one by one, go to sleep when done. */
Yes of course. Sorry about that!