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

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [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:

    Source Code

    1. T20FC 007:482 JLINK_IsHalted() returns FALSE (0000ms, 0627ms total)
    2. T20FC 007:482 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 0627ms total)
    3. T20FC 007:483 JLINK_IsHalted() returns FALSE (0000ms, 0627ms total)
    4. T20FC 007:483 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 0627ms total)
    5. T20FC 007:484 JLINK_IsHalted() returns FALSE (0000ms, 0627ms total)
    6. T20FC 007:484 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 0627ms total)
    7. T20FC 007:484 JLINK_ReadMemU32(0xE0001004, 0x0001 Items, ...) -- CPU_ReadMem(4 bytes @ 0xE0001004) - Data: E9 1A 3E 01 returns 1 (0001ms, 0628ms total)
    8. T20FC 007:485 JLINK_IsHalted() returns FALSE (0001ms, 0629ms total)
    9. T20FC 007:486 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 0628ms total)
    10. T20FC 007:486 JLINK_IsHalted() returns FALSE (0001ms, 0629ms total)
    11. T20FC 007:487 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 0629ms total)
    12. T20FC 007:487 JLINK_IsHalted() returns FALSE (0001ms, 0630ms total)
    Display All


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

    Towards the end of the log, it changes to:

    Source Code

    1. T20FC 064:829 JLINK_IsHalted() returns FALSE (0000ms, 3207ms total)
    2. T20FC 064:829 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3207ms total)
    3. T20FC 064:829 JLINK_IsHalted()
    4. ***** Error: Communication timed out: Requested 4 bytes, received 0 bytes ! returns ERROR (0000ms, 3207ms total)
    5. T20FC 064:830 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3207ms total)
    6. T20FC 064:830 JLINK_IsHalted() returns ERROR (0237ms, 3444ms total)
    7. T20FC 065:067 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3207ms total)
    8. T20FC 065:067 JLINK_IsHalted() returns ERROR (0000ms, 3207ms total)
    9. T20FC 065:067 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0001ms, 3208ms total)
    10. T20FC 065:070 JLINK_IsHalted() returns ERROR (0000ms, 3208ms total)
    which then continues to:

    Source Code

    1. T20FC 066:293 JLINK_IsHalted() returns ERROR (0000ms, 3208ms total)
    2. T20FC 066:293 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3208ms total)
    3. T20FC 066:294 JLINK_IsHalted() returns ERROR (0000ms, 3208ms total)
    4. T20FC 066:294 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3208ms total)
    5. T20FC 066:295 JLINK_IsHalted() returns ERROR (0000ms, 3208ms total)
    6. T20FC 066:295 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3208ms total)
    7. T20FC 066:296 JLINK_IsHalted() returns ERROR (0000ms, 3208ms total)
    8. T20FC 066:296 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000) returns 0 (0000ms, 3208ms total)
    9. T20FC 066:296 JLINK_ReadMemU32(0xE0001004, 0x0001 Items, ...) returns -1 (0000ms, 3208ms total)
    10. T20FC 066:397 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP) returns 0x00 (0000ms, 3208ms total)
    11. T20FC 066:424 JLINK_Close() (0009ms, 3217ms total)
    12. T20FC 066:424 (0009ms, 3217ms total)
    13. T20FC 066:424 Closed (0009ms, 3217ms total)
    Display All
    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: 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?