Fail to connect to Segger J-Link Pro with Ethernet connection, using TCP/IP

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

  • Fail to connect to Segger J-Link Pro with Ethernet connection, using TCP/IP

    Hi,

    I've originally asked on connecting to the Segger J-Link Pro over TCP/IP on this thread
    -timeout parameter to JLinkGDBServer seems not working


    but the subject just dealt with my misunderstanding on GDBServer -timeout parameter. Now may be I have bigger misunderstanding on remote debugging with Segger J-Link Pro.

    So we got this Segger J-Link Pro, with Ethernet connection. It is connected to target, and it is connected to network, and configured with IP 10.69.4.251. It's up and running, as seems
    verified with local connection

    Now I'm connecting (trying to) remotely to it, and I'm having issues that JLinkGDBServer, or JLinkExe, refuse to connect to it, even though I seems can access it using other tools.

    I can connect to it using my browser - port 80 - and I can check it settings, network status, etc.. power on, off target voltage, etc.

    When I try with JLinkGDBServer:
    /opt/SEGGER/JLink/JLinkGDBServer -device VF6xx_M4 -IF JTAG -select ip=10.69.4.251, that just exists saying failed to connect. It's not even waiting much, seems tries way too fast (I thought -timeout would help ...wrong).


    Same with JLinkExe:

    J-Link>ip 10.69.4.251
    Connecting to 10.69.4.251
    Connecting to J-Link via IP...FAILED: Can not connect to J-Link via TCP/IP (10.69.4.251, port 19020)

    But, I can connect to that IP & port using other tools just fine, e.g. netcat:

    nc -v 10.69.4.251 19020
    Ncat: Version 7.40 ( nmap.org/ncat )
    Ncat: Connected to 10.69.4.251:19020.
    �)�/J-Link Pro V4 compiled 15:44:26 on Jul 10 2017


    As you can see connection is established and I get the J-Link Pro trace.

    So what is the story with the JLinkGDBServer and JLinExe ? Why do they refuse to connect here? ......

    They both only seems like when I'm connecting to localhost, with JLinkRemoteServer running locally and accessing my local USB JLink. Which is of course totally useless for me in this case ..

    Please help? ?(
  • Hi,


    let me summarize:
    The J-Link is connected via Ethernet to a network (and via USB for power).
    The PC is connected to the same network, with some switches in between, but no routers.

    This setup should work.
    We have many customers using J-Link PRO via Ethernet, some are using a 3-digit amount of J-Links.
    Therefore we should be able to get you up and running :).

    I can connect to it using my browser - port 80 - and I can check it settings, network status, etc.. power on, off target voltage, etc.

    Could you please post a screenshot of the "landing page"?

    How "far" (how many hops) is the the J-Link away?
    What is the round-trip-time (ping) to the J-Link?
    Does it work in a minimal setup? (PC and J-Link PRO connected to the same switch, connection via J-Link Commander)

    Best regards,
    Niklas
    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.
  • Hi Niklas,

    The PC is connected to the same network, with some switches in between, but no routers.
    No, PC is actually far away, connected to the network with that J-Link using VPN.

    I will get you the other info just now ..
  • This is another issue I'm having with it, but I think a separate issue:

    Seems, if more that one client connected to port 80 (webservice), it starts throwing this:

    503 Connection limit reached
    The max. number of simultaneous connections to this server reached.Please try again later.


    Does it only allow one webservice session, or is this configurable?

    Also, it may seem that, it does not like a port scan: after we've ran it some port scan client it _seems_ started replying 'max connections reached' on all ports.

    Anyway, that is on the side. .. I'm on getting information you requested.
  • SEGGER - Niklas wrote:

    Hi,


    let me summarize:
    The J-Link is connected via Ethernet to a network (and via USB for power).
    The PC is connected to the same network, with some switches in between, but no routers.

    This setup should work.
    We have many customers using J-Link PRO via Ethernet, some are using a 3-digit amount of J-Links.
    Therefore we should be able to get you up and running :).

    I can connect to it using my browser - port 80 - and I can check it settings, network status, etc.. power on, off target voltage, etc.

    Could you please post a screenshot of the "landing page"?

    How "far" (how many hops) is the the J-Link away?
    What is the round-trip-time (ping) to the J-Link?
    Does it work in a minimal setup? (PC and J-Link PRO connected to the same switch, connection via J-Link Commander)

    Best regards,
    Niklas

    Hi Niklas,
    I got info you wanted, and more.

    First thing we did is to restart it (plug/unplug), because it seems went for a walk with that max number of connections ...

    After that, I was able to access it through webpage again, see picture attached as you requested. (Landing page).

    The pings:

    ping 10.69.4.251
    PING 10.69.4.251 (10.69.4.251) 56(84) bytes of data.
    64 bytes from 10.69.4.251: icmp_seq=1 ttl=56 time=347 ms
    64 bytes from 10.69.4.251: icmp_seq=2 ttl=56 time=344 ms
    64 bytes from 10.69.4.251: icmp_seq=3 ttl=56 time=343 ms
    64 bytes from 10.69.4.251: icmp_seq=4 ttl=56 time=344 ms
    64 bytes from 10.69.4.251: icmp_seq=5 ttl=56 time=345 ms
    64 bytes from 10.69.4.251: icmp_seq=6 ttl=56 time=347 ms
    64 bytes from 10.69.4.251: icmp_seq=7 ttl=56 time=344 ms
    64 bytes from 10.69.4.251: icmp_seq=8 ttl=56 time=348 ms
    64 bytes from 10.69.4.251: icmp_seq=9 ttl=56 time=356 ms
    64 bytes from 10.69.4.251: icmp_seq=10 ttl=56 time=344 ms
    64 bytes from 10.69.4.251: icmp_seq=11 ttl=56 time=344 ms

    NOTE: sometimes is clean, but it can be 8 - 10 % loss too.

    I have verified using Remote Desktop that I'm able to connect to it from with-in the Co's network using SeggerGDBServer, and it starts & serves.

    However, remotely / from my remote workstation, even though I get further than before (restart helped ..), SeggerGDBServer fails to connect, here are some traces:

    1. --------------------------------------------------------------------------

    SEGGER J-Link GDB Server V6.18 Command Line Version
    JLinkARM.dll V6.18 (DLL compiled Aug 3 2017 16:21:09)
    Command line: -device VF6xx_M4 -IF JTAG -select ip=10.69.4.251
    ....

    Connecting to J-Link...
    J-Link is connected.


    *** J-Link V6.18 Error ***
    IP communication error. Connection closed !
    *** J-Link V6.18 Error ***

    Firmware: J-Link Pro V4 compiled Jul 24 2017 17:06:05
    Hardware: V4.00
    ...

    Checking target voltage...
    Connecting to target failed. Connected correctly?
    GDB Server will be closed...
    Shutting down...
    Could not connect to target.
    Please check power, connection and settings.

    2. --------------------------------------------------------------------------


    ....
    Connecting to J-Link...

    *** J-Link V6.18 Error ***
    IP communication error. Connection closed !
    *** J-Link V6.18 Error ***

    ERROR: Communication timed out: Requested 96 bytes, received 0 bytes !
    J-Link is connected.
    Firmware: J-Link Pro V4 compiled Jul 24 2017 17:06:05
    Hardware: V4.00
    S/N: xxxxxxxxxxx
    Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    Checking target voltage...
    Connecting to target failed. Connected correctly?
    GDB Server will be closed...
    Shutting down...
    Could not connect to target.
    Please check power, connection and settings.

    3. --------------------------------------------------------------------------


    Connecting to J-Link...
    J-Link is connected.


    *** J-Link V6.18 Error ***
    IP communication error. Connection closed !
    *** J-Link V6.18 Error ***
    .....


    --- --------------------------------------------------------------------------


    From when I tried connecting to it from with-in the Co's network, I got connected on first attempt.

    So it may seems SeggerJLink/GDBServer is too sensitive for connection quality? (Not possible to increase response timeout ? ...)

    Images
    • landingpage_segger.jpg

      123.7 kB, 1,889×487, viewed 631 times
  • I have tried using Segger's remote server with tunneling, that fails too.

    Please see the screenshot attached. This is from running both - tunneling server, and client - on same PC, within the Co's network..

    (Note: I still think fixing the IP errors / timeout issues without Segger's tunneling mode should be preferred ... why have a tunneling proxy server in-between? It's already going to be slow )

    ;(
    Images
    • segger_tunneling_mode.jpg

      182.05 kB, 1,499×616, viewed 639 times
  • Hi,

    NOTE: sometimes is clean, but it can be 8 - 10 % loss too [..] So it may seems SeggerJLink/GDBServer is too sensitive for connection quality? (Not possible to increase response timeout ? ...

    I am sorry, but the direct connection via Ethernet is intended for use in a local network, ideally with a delay of <1ms or 1-5ms in a bigger network.
    VPN & ping of > 100ms (300ms in your case) will not work, I also asked engineering regarding this, it will not work.

    However, J-Link Remote server should work and the maintainer plans to provide a preliminary fixed version later today or tomorrow.


    Best regards,
    Niklas
    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.
  • Hi,


    the fix has been checked-in approx. 10 minutes ago and will be part of the next release, planned for release this evening.


    Best regards,
    Niklas
    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.
  • SEGGER - Niklas wrote:

    Hi,


    the fix has been checked-in approx. 10 minutes ago and will be part of the next release, planned for release this evening.


    Best regards,
    Niklas
    Niklas,

    Just tested your 6.20b tunneling, and the thing is still broken ..... Was this tested? One week waiting here, but latest release still broken ....

    See screeshot attached. Test tunneling server, client from _same_ PC. X(
    Images
    • segger_tunnel_failing_again.jpg

      153.17 kB, 787×799, viewed 731 times
  • Al'right, so I also re-tested by running JLInkRemoteServer in tunneling mode when J-Link is on local USB connection, not Ethernet, just in case that would be problem.

    But no, it's same result, with same error.



    ip tunnel:xxxxx
    Connecting to tunnel:xxxxxx
    Disconnecting from J-Link...O.K.
    Connecting to J-Link via IP...FAILED: Communication timed out: Requested 2 bytes, received 0 bytes !
    EMU_GetFirmwareString: Insufficient data read when trying to read the string length.
  • Hi,

    Nino was working on this but he is on vacation this week, I plan to jump in and take a look at this issue tomorrow afternoon.

    J-Link is on local USB connection, not Ethernet, just in case that would be problem.
    But no, it's same result, with same error.


    That is very odd.
    In my tests with the old version, USB via Remote Server was working, but Ethernet via Remote did not work.
    No both is broken, it does not work at all?


    Best regards,
    Niklas
    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.
  • Hi,

    One week waiting here,

    This is *not* a support forum, so there is absolutely no claim for support or even getting an answer directly from the engineers...

    I still think fixing the IP errors / timeout issues without Segger's tunneling mode should be preferred

    Again: J-Link PRO and Remote Server are designed to be used in a LAN(!).
    Timeouts, reaction times etc. all is designed for being used in a local network.
    Connecting from a machine outside of the network, via VPN etc. with huge(!) response times, to the J-Link is not part of this design concept.
    The Remote Server in tunneling mode is for such cases.

    I tested this with the following setups with V6.20b:
    J-Link Commander <-> RemoteServer (tunneling mode) <- USB <-> J-Link V10

    J-Link Commander <-> RemoteServer (tunneling mode) <- IP <-> J-Link PRO V4
    (The J-Link PRO was located in the same LAN as the PC that was running the J-Link Remote Server)

    Target: NXP Vybrid VF6xxx_M4

    Both cases worked perfectly. No problems reproducible.
    Screenshots from both sessions below.

    Best regards
    Alex

    V10:



    PRO:

    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.
  • SEGGER - Alex wrote:

    Hi,

    Connecting from a machine outside of the network, via VPN etc. with huge(!) response times, to the J-Link is not part of this design concept.
    The Remote Server in tunneling mode is for such cases.


    Alex Please re-read : I'm testing Segger's Remote Server in tunneling mode now .. As you noted, VPN too slow for Segger to handle in LAN mode.

    SEGGER - Alex wrote:


    I tested this with the following setups with V6.20b:
    J-Link Commander <-> RemoteServer (tunneling mode) <- USB <-> J-Link V10
    J-Link Commander <-> RemoteServer (tunneling mode) <- IP <-> J-Link PRO V4
    (The J-Link PRO was located in the same LAN as the PC that was running the J-Link Remote Server)
    Target: NXP Vybrid VF6xxx_M4
    Both cases worked perfectly. No problems reproducible.



    Yea ... I can may be reproduce your 'perfect' results only from home, when not behind corporate firewall. So in those lab-like conditions, it works .. But that's limited tunneling

    Otherwise, with corporate firewall or VPN, it does not work even in tunneling mode .. Errors with screenshots attached, and are all valid.
    My last test was with Remote Server using J-Link USB connection. Tunnel established, but trying to connect to that tunnel from same PC (or devboard, if using ARM version of the tools) failed.

    Your tests are limited I would say.


    So my regards.
  • Alex,

    Please check in your code: under what conditions these errors , as reported by J-Link commander in my trials (see previous pics attached), are printed out:

    - FAILED: Communication timed out: Requested 2 bytes, received 0 bytes !

    What is the timeout value in code? Is that configurable run-time? Is the error due to timeout or connection abort/drop (TCP pipe?)

    - EMU_GetFirmwareString: Insufficient data read when trying to read the string length ...

    This is result / cascading from previous error of timeout .?
  • Hi,

    Yea ... I can may be reproduce your 'perfect' results only from home, when not behind corporate firewall. So in those lab-like conditions, it works .. But that's limited tunneling


    Well the command still needed to travel from Home -> SEGGER Tunneling Server -> Home, therefore tunneling works in general both via USB and IP, correct?
    There is not much we can do regarding your corporate firewall.
    What ping did you have from home?

    What is the timeout value in code? Is that configurable run-time? Is the error due to timeout or connection abort/drop (TCP pipe?)

    When connecting via tunneling mode: multiple seconds. Should not be the issue.

    Best regards,
    Niklas
    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.
  • Ni Niklas,
    Well the command still to travel from Home -> SEGGER Tunneling -> Server, therefore tunneling works in general both via USB and IP, correct?
    Please explain a bit more here what you mean. The tunneling connection (as implemented by Segger's Remote Server) to Segger www server gets established from Remote Server, and it seems there is an accepted incoming connection that it reports.
    (Refer to my screenshots provided). If you refer to this as 'tunneling works' , then yes : the tunnel gets established as reported by Remote Server and J-Link connection to the tunnel using Segger's server.

    If that's so, then you would probably say Co's firewall does not block what's required to establish it, right? Of which I only saw one what's required : outgoing TCP connection to Segger's www server. Anything else required
    for tunneling mode .. ?

    So as you wrote yourself, tunneling gets established between Remote Server & J-Link (you wrote "works" ...), (and also I attest that Remote Server is connected Ok to J-Link & to target hw & communicates with it),
    why am I getting those J-Link errors? What is this due too ? There is only the single TCP pipe that gets established, correct (or do I need to see some Segger's doc.)?

    So if that pipe between the two pieces of Segger's software gets established and "works", where is the error coming from then?

    There is not much we can do regarding your corporate firewall.
    Fair enough, however:
    When connecting via tunneling mode: multiple seconds. Should not be the issue.
    That is strange as the J-Link error as I posted, says FAILED: Communication timed out: Requested 2 bytes, received 0 bytes !

    So Please provide some information on how to debug / trouble shoot this. Is the error dude to a set timeout, or because TCP connection was dropped / closed?

    ( I don't have the source . If you would like I can review it for Segger :thumbsup: )


    I saw somewhere in Segger's marketing material that Segger's J-Link is used by a team in Europe to test some hw in India, or vice versa. Distance wise, this is about right for my case, but network setup wise
    something is missing for us as we can't make this work.
  • Hi,

    Please explain a bit more here what you mean.


    Sorry, I edited this sentence multiple times and in the end I did not check it and it made less sense than intended.

    Let me rephrase it:
    This setup works:

    C Source Code

    1. Location: <<<-------------------------------- Your Home --------------------------------->>> <<<-- SEGGER Server -->>> <<<--------------------------- Your Home ---------------------------->>>
    2. Object: J-Link --IP--> J-Link Remote Server Application in tunneling mode --(home ISP)--> SEGGER tunneling Server --(home ISP)-->Target application (e.g. J-Link Commander or GDB Server)


    and this as well:

    C Source Code

    1. Location: <<<-------------------------------- Your Home --------------------------------->>> <<<-- SEGGER Server -->>> <<<--------------------------- Your Home ---------------------------->>>
    2. Object: J-Link --USB--> J-Link Remote Server Application in tunneling mode --(home ISP)--> SEGGER tunneling Server --(home ISP)-->Target application (e.g. J-Link Commander or GDB Server)


    So you have been able to reproduce a working Remote Server in tunneling mode(!), correct?

    This does not work for you:

    C Source Code

    1. Location: <<<--- Remote location --->>> <<<------------------------- Your company / workplace -------------------------->>> <<<-- SEGGER Server -->>> <<<---------------------------- Your company / workplace ---------------------------->>>
    2. Object: J-Link --IP--> --(ISP/VPN)--> J-Link Remote Server Application in tunneling mode --(Company ISP + Firewall)--> SEGGER tunneling Server --(Company ISP + Firewall)-->Target application (e.g. J-Link Commander or GDB Server)


    or did you try it like this?

    C Source Code

    1. Location: <<<------------------------------- Remote location -------------------------------->>> <<<-- SEGGER Server -->>> <<<---------------------------- Your company / workplace ---------------------------->>>
    2. Object: J-Link --USB or IP--> J-Link Remote Server Application in tunneling mode --(ISP)--> SEGGER tunneling Server --(Company ISP + Firewall)-->Target application (e.g. J-Link Commander or GDB Server)


    Please note that the J-Link remote server must be used in tunneling mode for your use case!
    If the "J-Link Remote Server Application in tunneling mode" is running on a computer at the remote location, can you connect via J-Link Commander from home?


    Best regards,
    Niklas
    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.
  • Hi Niklas,
    Please note that the J-Link remote server must be used in tunneling mode for your use case!

    Yes we established that :) Must set server to tunneling mode (using UseTunnel command flag )

    About what works, I can't seems quote those boxes you inserted, so I just copy&paste those scenarios below you wrote.

    1. J-Link --USB--> J-Link Remote Server Application in tunneling mode --(home ISP)--> SEGGER tunneling Server --(home ISP)-->Target application (e.g. J-Link Commander or GDB Server)

    That seems to work , but I only tested basic JLink connect and like, get firmware info command. No connection errors using JLinkExe, didn't try GDB Server.

    So the above 1. was a working tunneling mode usage scenario . Call it basic / Lab condition ....


    2. J-Link --IP--> J-Link Remote Server Application in tunneling mode --(home ISP)--> SEGGER tunneling Server --(home ISP)-->Target application (e.g. J-Link Commander or GDB Server)

    I haven't tried IP / Ethernet local JLink from home, as I only have J-Link Plus locally.


    Now, please pay attention to changes to your suggested setups for "your company" you listed, as they different to what I've tested and reported.

    3. Location: <<<--- Company / workplace --->>> <<<-------------------------Company / workplace -------------------------->>> <<<-- SEGGER Server -->>> <<<---------------------------- Company / workplace ---------------------------->>>
    Object: J-Link --IP--> --(ISP/VPN)--> J-Link Remote Server Application in tunneling mode --(Company ISP + Firewall)--> SEGGER tunneling Server --(Company ISP + Firewall)-->Target application (e.g. J-Link Commander or GDB Server)

    Note how I changed your scenario: in my tests, for accessing the client's Segger JLink, i'm testing at the moment __from inside the co's network___.
    To underline, both the target & Sergger J-Link Pro (in this case) , and the J-Link Remote server , AND the J-Link commander , are all being run inside the client's
    network.
    Similar to the Home tests: all from one place / one location.


    4. Location: <<<------------------------------- Company / workplace -------------------------------->>> <<<-- SEGGER Server -->>> <<<---------------------------- Company / workplace ---------------------------->>>
    Object: J-Link --USB or IP--> J-Link Remote Server Application in tunneling mode --(ISP)--> SEGGER tunneling Server --(Company ISP + Firewall)-->Target application (e.g. J-Link Commander or GDB Server)

    The 4 is only different from 3 in that I thought perhaps that Ethernet connection from Remote Server to J-Link causes problems, so I switched to USB.
    But with no luck , as I reported before, same errors with timeout / 0 bytes.

    So do you see that in principle , the Home setup 1. & 2. should be same as the client's setup / Company workspace tests. With exception that of course that is corporate network there... And that should have been irrelevant for the Segger's tunnel which goes through it.

    What of course I _need_ is , [ client's Company with running tunneling Server (country A) ] <----------> [ SEGGER Server (country B) ] <---------------> [ My home JLinkExe / GDBServer (country C) ]
    But there is no point even trying that if I can't get that tunnel working from within there Co... (but I have tried anyway ..... just takes longer as I'm countries away ... )

    If you need more information please ask.

    (Btw, it's a pity that Segger's J-Link internal server does not support remote TCP/IP with longer delays (not 1-10 ms you referred to .. ), as having a in-between server (Segger) does not improve latency ..)