May I ask, what's the change of nrf_log in sdk 15.3?

Hi,

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.

APP_ERROR_CHECK(NRF_LOG_INIT(app_timer_cnt_get));

NRF_LOG_DEFAULT_BACKENDS_INIT();

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. 

environment:

j-link 6.40

win7

sdk15.3

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

Thanks

sdk_config.h

Parents
  • Hi

    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) 
        {
            nrf_pwr_mgmt_run();
            NRF_LOG_INFO("EI: %d\n\r",cnt++);
        }
    }

    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.

    Best regards,

    Simon

Reply
  • 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 is doing with this:

        /* Handle background and debug events one by one, go to sleep when done. */
        do
        {
        }
        while (NRF_LOG_PROCESS());
    
        if (run_power_saving) 
        {
            mgmt_run();
        }
    

    ?

Children