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

Log printing right before reset causes broken text over RTT

Used SDK: 15.2.0

Hello,

I want to print some debug messages over RTT after an error occured. After that I want to reset the system.

If I put the string into the que with NRF_LOG_INFO("Debug Text"), then forcing the log module to print out all the strings in buffer with NRF_LOG_FINAL_FLUSH(), then calling NVIC_SystemReset() to reboot the system will cause broken text output in J-Link RTT viewer. It seems that the NRF_LOG_FINAL_FLUSH() function does not block the code until all the text was sended out.

Including a delay before triggering the reset will solve the problem. But with various length of the debug messages, calling a fixed delay is not a well made solution. Also the documentation sais, that calling NRF_LOG_FINAL_FLUSH() is made for exactly this problem.

Do you know whats going wrong?

Thank you, Regards

Mr_BLE

Parents Reply
  • Thank you for answering!

    I tried both of your solutions, but none helped:

    The first messages on top are with a delay inserted and the following messages are with your soltions:

    - in sdk_config.h setting SEGGER_RTT_CONFIG_DEFAULT_MODE to "2" (BLOCK mode)

    - in sdk_config.h double the buffers SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN and SEGGER_RTT_CONFIG_BUFFER_SIZE_UP

    Do you have any others ideas?

    Thank you.
    Regards

Children
Related