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

MCU hanging due to Segger RTT log

I am using NRF52840 custom board and SEGGER RTT log for debugging.

I set the NRF_LOG_BACKEND_RTT_ENABLED 1 and NRF_LOG_ENABLED 1 

The following is a screenshot of my settings

I am able to have my debug log printing on RTT viewer. However, if I disconnect my device to J-Link debugger, the mcu keeps running for around 10 seconds and then stops.

Coincidentally, I found two ways seemed to resolve this issue.

1. decrease SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN to 16 

2. set NRF_LOG_BACKEND_RTT_ENABLED and NRF_LOG_ENABLED to 0

I have no idea what the correct setting should be.

Any help is appreciated.

Thank you!

  • Hi

    if I disconnect my device to J-Link debugger, the mcu keeps running for around 10 seconds and then stops.

     It is the nRF52840 you are referring to that keeps running, correct?

    I think the correct workaround would be to decrease the SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN (to 16) as this is what is used in most of our example projects. It might be that the MCU needs some time to go through the entirety buffer when this parameter is set too high.

    If you set the NRF_LOG_ENABLED to 0 are you able to see any log messages at all?

    Best regards,

    Simon

  •  It is the nRF52840 you are referring to that keeps running, correct?

         --> Yes, it was running but somehow it hanged after a few seconds. And nRF52840 would be normal after I reconnect to SEGGER RTT log again.

    If you set the NRF_LOG_ENABLED to 0 are you able to see any log messages at all?

        --> Yes, I can still see log printing even after setting it to 0

  • Hi

    Seeing any log messages after setting NRF_LOG_ENABLED to 0 in your project should not be possible. Can you tell me more about your setup, as what you're describing sounds impossible. Are you using an nRF52 DK as a debugger? Are you sure that you're rebuilding and flashing the edited example every time you make any changes?

    Also, what SDK example project is this based on? Are you able to recreate the behavior on a Development Kit?

    Best regards,

    Simon

Related