nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

is there a way to write to Segger RTT logger directly (like a UART) without all the formatting etc?

I tried to deep dive through the macros, api abstractions and other layers but couldn't figure it out. The closest I got is this:

void debug_uart_print(const char * s)
{
    nrf_log_frontend_std_0(0, s);
}

but it doesn't do what I want. For some reason everything has this prepended.

00> <> CLOCK:  :

Parents
  • Hi,

    You can use the NRF_LOG_RAW_INFO(...) macro for logging a formatted string without any prefix or timestamp.

    It is also possible to write to RTT without using the logger library, by using the Segger RTT APIs directly. These are found in external\segger_rtt in the nRF5 SDK directory.

    Best regards,
    Jørgen

  • Please have a look at the Segger RTT documentation, and this blog post about debugging with RTT.

  • so in brief - in the SDK you only use one buffer, so BufferIndex should always be 0?

    Can you confirm this assumption please?

  • The number of RTT buffers are configured in the sdk_header.h file in the examples:

    //==========================================================
    // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer. 
    // <i> Note that either @ref NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
    // <i> or this value is actually used. It depends on which one is bigger.
    
    #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
    #define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
    #endif
    
    // <o> SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers. 
    #ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
    #define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
    #endif
    
    // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer. 
    #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
    #define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
    #endif
    
    // <o> SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Maximum number of downstream buffers. 
    #ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
    #define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
    #endif

    The RTT backend for NRF_LOG is hardcoded to use up buffer index number 0.

    Best regards,
    Jørgen

Reply
  • The number of RTT buffers are configured in the sdk_header.h file in the examples:

    //==========================================================
    // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer. 
    // <i> Note that either @ref NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
    // <i> or this value is actually used. It depends on which one is bigger.
    
    #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
    #define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
    #endif
    
    // <o> SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers. 
    #ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
    #define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
    #endif
    
    // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer. 
    #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
    #define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
    #endif
    
    // <o> SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Maximum number of downstream buffers. 
    #ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
    #define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
    #endif

    The RTT backend for NRF_LOG is hardcoded to use up buffer index number 0.

    Best regards,
    Jørgen

Children
No Data
Related