Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Logging to file?

I need to get quite a lot of logs and quite fast too. How do I do I get the logs into a file?

I tried with Segger RTT logger, but it tends to give up quite quickly. I heard rumors that the RTT logger and debug terminal in the Segger Embedded Studio don't like each other, and that tends to cause problems. How do I get to use only RTT logger and turn debug terminal logging off?

Or are there other means? There are no serial ports left to use.

  • Hi,

    Can you quantify "quite a lot" and "quite fast"?

    RTT logging to the Segger Embedded Studio debug terminal should usually work fine, at least in my experience.

    What J-Link programmer are you using, the one integrated on a DK?

    Is the use case here that you wish to run a debug session, but get the logging through RTT logger instead of through SES?

    Regards,
    Terje

  • RTT logging to the Segger Embedded Studio debug terminal should usually work fine

    Segger broke this - so it now requires a change in sdk_config.h to actually see the logs:

    Change NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to zero (default is 1)

  • Say, 5 hours of logging, 2 shortish text lines per 2.5 ms.

    And yes, running in debugger with the logs going to file. I tried with the Segger RTT logger with the logs also going to the debug terminal, but after a couple of seconds it looked like the Segger RTT logger had restarted itself, or something. The log files contained nothing, or just so10 to 20 lines of text. The log messages were more or less flooding on the debug terminal every time.

    I'm debugging a proprietary board through start52dk (debug out connector) ,and USB cable.

  • That is: about 16 kB per second, about 230 MB in all.

  • Hi,

    Right. I understand. I did not find a way for J-Link RTT Logger to connect to an existing session, but J-Link RTT Viewer can. The procedure to get the full log from a debug session is then:

    1. In SES, start a debug session (but do not start execution yet).
    2. In J-Link RTT Viewer, choose "Existing Session" in the configuration dialog for connecting to a target.
    3. In J-Link RTT Viewer, choose "Start Terminal Logging" from the "Logging" menu and choose your file name.
    4. In SES, start the execution (and do whatever debugging you would like.)
    5. When you are done, either "Stop Terminal Logging" in J-Link RTT Viewer, or end the debug session in SES. In either case the logging should stop.

    I did some testing with an nRF52832 DK, and I got way more than 16 kB/s from a test application logging some text and an increasing sequence number from an infinite loop. (It was consumed and logged at the speed sent from the DK.) I did not run it for long, though.

    Regards,
    Terje

Related