[ABANDONED] Target Connection Has Been Lost - but why?

  • While debugging, I am getting 'Target connection has been lost' after a while:

    The trouble is, the debugger then closes immediately - so all the RTT debug output, etc, up to that point is lost.

    How can I retain this information to see where, exactly, the problem is occurring?

    Or get more information on why, exactly, the connection drops?

    It makes it very hard to debug when the debugger just disappears completely & throws away all evidence!

    The standalone RTT Viewer gives no indication when a connection is lost - so that's no help.

  • OK, so I found the option to enable a J-Link Log file.

    In the log file, I see this pattern repeating:

    which, I guess, is the J-Link polling for RTT data?

    Towards the end of the log, it changes to:

    Code
    T20FC 064:829 JLINK_IsHalted()  returns FALSE (0000ms, 3207ms total)
    T20FC 064:829 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)  returns 0 (0000ms, 3207ms total)
    T20FC 064:829 JLINK_IsHalted()
      ***** Error: Communication timed out: Requested 4 bytes, received 0 bytes !  returns ERROR (0000ms, 3207ms total)
    T20FC 064:830 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)  returns 0 (0000ms, 3207ms total)
    T20FC 064:830 JLINK_IsHalted()  returns ERROR (0237ms, 3444ms total)
    T20FC 065:067 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)  returns 0 (0000ms, 3207ms total)
    T20FC 065:067 JLINK_IsHalted()  returns ERROR (0000ms, 3207ms total)
    T20FC 065:067 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)  returns 0 (0001ms, 3208ms total)
    T20FC 065:070 JLINK_IsHalted()  returns ERROR (0000ms, 3208ms total)

    which then continues to:

    I guess this at least gives a record of the time at which the connection was lost - though it doesn't seem to have anything to tie this into what the code was actually doing at the time.

    Can you tell anything from this log?

  • Hmmm ... now a new behaviour:

    The RTT trace has stopped, the Target has restarted - but the J-Link is still showing as 'Connected' so the SES Debug view is still there, but doing nothing.

    BTW

    This is SES 3.40 and a Nordic nRF52832.

    It's only started since recent code changes - but what could my code be doing that would break the debug connection and/or stop the RTT trace ?

  • Hello,

    Thank you for your inquiry.
    Usually a connection drops when a target does an illegal memory access and crashes or when the target goes to sleepmode or executes a WFI.
    Is one of these points possible for your setup?

    Best regards,
    Nino

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

  • Thanks for the reply.

    Use of sleep mode hasn't changed, so that leaves the illegal memory access.

    That is possible; is there a way to catch it - rather than the debugger just "disappear" completely without trace?

    But shouldn't illegal memory access be caught as a Hard Fault?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!