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

Segger Embedded Studio (SES) debug terminal fails to log some of the time.

I'm working on a few projects for for a smart home company. My machine is running Windows 10 and I'm on SES version 4.40. I'm using my dev board (a PCA10040) to program the products I am developing.

Rarely, when I go to run the program on the device after loading the code and reaching the start of main, I press play and the debug terminal has popped up but receives no data. My co-workers have seen this as well and all we do is reprogram the target and it works. I can work with that. However, one project I am working on, it has recently switched around to where it rarely shows the logs. I've gone back to other projects and they continue to load and log normally, but not this one. I've swapped dev boards and the hardware that I'm working on, but the problem remains the same. I've tested to verify that I can make no changes to the program and just wait and try after a little while, and it sometimes works. Quite often it does not still. I know the the application is running because I have tested device functionality and it works. The debug terminal launches, but it never shows data. I've tried connecting the RTT viewer from Segger too and I get the same result. I updated from SES 4.16 to 4.40 in the process and updated to the most recent J-Link drivers without any changes to this issue.

Still, every now and then it will log correctly. In my research to find a solution I encountered a few suggestions for making the logging work in later versions of SES after having done updates (mostly referencing this define "NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED"), but none of these seem to apply since it used to work and still works occasionally. Also adding in the fixes have not changed the issue. I think it's something in my project that fails to activate the output through the RTT, but I'm shooting in the dark. It's seems to be local to this project since none of the other projects are this difficult to make the debug terminal to log.

Where should I start looking?

Parents
  • Hi

    Please check your sdk_config.h file to see that the following defines are set to these values:

    // </h> 
    //==========================================================
    
    // </h> 
    //==========================================================
    
    // <h> nRF_Log 
    
    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 1
    #endif
    // <o> NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. 
    // <i> Size of the buffer is a trade-off between RAM usage and processing.
    // <i> if buffer is smaller then strings will often be fragmented.
    // <i> It is recommended to use size which will fit typical log and only the
    // <i> longer one will be fragmented.
    
    #ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE
    #define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
    #endif
    
    // <o> NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS - Period before retrying writing to RTT 
    #ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS
    #define NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 1
    #endif
    
    // <o> NRF_LOG_BACKEND_RTT_TX_RETRY_CNT - Writing to RTT retries. 
    // <i> If RTT fails to accept any new data after retries
    // <i> module assumes that host is not active and on next
    // <i> request it will perform only one write attempt.
    // <i> On successful writing, module assumes that host is active
    // <i> and scheme with retry is applied again.
    
    #ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_CNT
    #define NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 3
    #endif

    Can you confirm that your project settings are set to debug mode and not release? It might be that you generally run this project in release mode.

    Best regards,

    Simon

  • I checked the defines in sdk_config and those are all as the same except for NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE. Right now that is set to 1500. I have now tried it at 64 and also tried increasing it beyond 1500 to no avail. I just now attempted to increase NRF_LOG_BACKEND_RTT_TX_RETRY_CNT to 8 and there was no change. Also I have made sure that I am in debug mode and for good measure have compiled for release, run it and then done a clean recompile for debug and run it with no change as well.

Reply
  • I checked the defines in sdk_config and those are all as the same except for NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE. Right now that is set to 1500. I have now tried it at 64 and also tried increasing it beyond 1500 to no avail. I just now attempted to increase NRF_LOG_BACKEND_RTT_TX_RETRY_CNT to 8 and there was no change. Also I have made sure that I am in debug mode and for good measure have compiled for release, run it and then done a clean recompile for debug and run it with no change as well.

Children
No Data
Related