[SOLVED] J-LINK, Target connection not established yet but required for command.

  • [SOLVED] J-LINK, Target connection not established yet but required for command.

    Hi,
    I try to download FW to my device via J-link. I use SWD interface.

    Sometimes I can not connect to target, but device can be selected.

    The log message is as follows

    Sometimes I can work well. It’s not stable.

    Let me describe the connection environment

    PC ⇒ J-link ⇒ wire (Dupont Line) ⇒ transfer board ⇒ wire (Dupont Line) ⇒ device

    Total length is about 60cm

    On the device side, the SWD path (swdio, swclk, gnd) are directly connect to the MCU.

    I don’t put series resistor or pull up/pull down resistors on the path.

    Source Code

    1. SEGGER J-Link Commander V6.22c (Compiled Dec 8 2017 15:40:14)
    2. DLL version V6.22c, compiled Dec 8 2017 15:39:39
    3. Script file read successfully.
    4. Processing script file...
    5. J-Link connection not established yet but required for command.
    6. Connecting to J-Link via USB...O.K.
    7. Firmware: J-Link EDU Mini V1 compiled Mar 3 2022 10:17:12
    8. Hardware version: V1.00
    9. S/N: 801003045
    10. License(s): GDB, FlashBP
    11. VTref = 3.299V
    12. Selecting SWD as current target interface.
    13. Selecting 10000 kHz as target interface speed
    14. Target connection not established yet but required for command.
    15. Device "KL520-WB" selected.
    16. Connecting to target via SWD
    17. Cannot connect to target.
    18. Target connection not established yet but required for command.
    19. Device "KL520-WB" selected.
    20. Connecting to target via SWD
    21. Cannot connect to target.
    22. Target connection not established yet but required for command.
    23. Device "KL520-WB" selected.
    24. Connecting to target via SWD
    25. Cannot connect to target.
    26. Target connection not established yet but required for command.
    27. Device "KL520-WB" selected.
    28. Connecting to target via SWD
    29. Cannot connect to target.
    30. Target connection not established yet but required for command.
    31. Device "KL520-WB" selected.
    32. Connecting to target via SWD
    33. Cannot connect to target.
    34. Unknown command. '?' for help.
    35. Unknown command. '?' for help.
    36. Unknown command. '?' for help.
    37. Unknown command. '?' for help.
    38. Unknown command. '?' for help.
    39. Unknown command. '?' for help.
    40. Unknown command. '?' for help.
    41. Unknown command. '?' for help.
    42. Unknown command. '?' for help.
    43. Unknown command. '?' for help.
    44. Unknown command. '?' for help.
    45. Unknown command. '?' for help.
    46. Unknown command. '?' for help.
    47. Unknown command. '?' for help.
    48. Script processing completed.
    49. Type "connect" to establish a target connection, '?' for help
    50. J-Link>connect
    51. Device "KL520-WB" selected.
    52. Connecting to target via SWD
    53. Cannot connect to target.
    54. J-Link>
    Display All
    My question is how to improve connection reliability? Can someone give me advice?

    Furthermore, in the case of failure,
    1. I try to use an oscilloscope to measure the waveform. When I put the oscilloscope on the clk, I can download the FW normally. The input capacitance of the oscilloscope is 3.9pF.
    2. Base on list 1, I put 3.9pf on GND and close to the receiver side. It works fine.I don't know why 3.9pf improves connection reliability. Maybe someone can teach me. thanks.
    3. I download FW with a short line. It works fine. But my requirement is to download firmware using long lines.
    Thanks a lot.
  • Hi,
    Thank you for your inquiry.
    "Device xxx selected." just means that the device was found in the DLL database.
    It does not mean that the J-Link connected to the device.
    As the log messages show, the connection always fails.

    I would highly suggest to check the signal integrity of your setup and the related cables.
    Sometimes lowering the target interface speed does also help.

    Does connection work when connecting to the device directly, with out any "in the middle" things?
    J-Link <-> Device
    instead of

    Grissom wrote:

    PC ⇒ J-link ⇒ wire (Dupont Line) ⇒ transfer board ⇒ wire (Dupont Line) ⇒ device

    BR
    Fabian
    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.
  • I would highly suggest to check the signal integrity of your setup and the related cables.
    Sometimes lowering the target interface speed does also help.
    => I have checked again. The situation is the same as before.
    1. I try to use an oscilloscope to measure the waveform. When I put the oscilloscope on the clk, I can download the FW normally. The input capacitance of the oscilloscope is 3.9pF.
    2. Base on list 1, I put 3.9pf on GND and close to the receiver side. It works fine.I don't know why 3.9pf improves connection reliability. Maybe someone can teach me. thanks.
    3. I download FW with a short line. It works fine. But my requirement is to download firmware using long lines.


    Does connection work when connecting to the device directly, with out any "in the middle" things?
    => No, I have the transfer board in the middle before connecting to the Device. Under such conditions, using a short line will work fine

    I would also like to ask about the layout
    1. If there are many turntables in the middle, will it have an effect?
    2. Do SWCLK and SWDIO need impedance control?
    3. Do SWCLK and SWDIO need to be isolated from GND?


    Thank you for your reply.
    Grissom

    The post was edited 1 time, last by Grissom ().

  • Hi,
    If a J-Link does not support a certain Interface speed it will use the highest available.
    However, I would suggest to lower it even further, like 500 kHz.

    IF it works with an oscilloscope connected, this also points in the direction of a signal integrity issue.

    BR
    Fabian
    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.