[SOLVED] Simultaneous SWOviewer and GDB Server connection

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

  • [SOLVED] Simultaneous SWOviewer and GDB Server connection

    Dear Segger Support

    I updated my pretty old JLink Windows software to the new version V6.34h.
    Now I discovered a problem with opening the SWOViewer while connected to the target via GDB Server.

    Internal Error "NET_WriteRead(): USB communication not locked"



    What am I doing wrong? Do you have any solution for that?

    Regards
    Kevin
  • Hello Kevin,

    Thank you for your inquiry.
    When using SWO Viewer in parallel with other software that connects to the target device make sure that first the GDB Server is connected, then launch SWO Viewer with the correct CL options defining CPU speed and device at least.
    After that setup you should see SWO output as expected.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hello Kevin,

    Thank you for confirmation, the issue was reproducible with one of our test setups for the CL version.
    We will investigate this further.
    In the meantime could you try the non CL version. Is that working instead?
    You can still pass the same CL commands to the non CL version e.g. -device STM32F427VI -cpufreq 16000000

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hi Kevin,

    Does the following workaround work with the GUI version?
    *Open SWOViewer in GUI mode without any CL params (do not have any target device connections open in parallel)
    *Select your device
    *Press OK
    *Close SWOViewer
    *Start debug session with your IDE
    *Open SWOViewer in GUI mode in parallel
    * Device and clock speed should be preselected
    * Just press OK without any other steps

    Do you still get a crash that way? If we do it that way it works in parallel.
    The first 4 steps are not necessary for further sessions once SWOViewer remembers your settings once.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hello Kevin,

    Quick update. We found the source of the issue and it will be fixed with next J-Link software release.
    To stay up to date with our software releases we suggest subscribing to our notification list: segger.com/notification/subscribe.php?prodid=7

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hi again,

    I installed the new version V6.40.
    The changes say:

    - JLinkSWOViewer: When SWOViewer waslaunched with CL options and another connection to the target device wasalready active e.g. debug session in IDE, SWOViewer would crash. Fixed.
    - JLinkSWOViewerCL: When SWOViewer waslaunched with CL options and another connection to the target device wasalready active e.g. debug session in IDE, SWOViewer would crash. Fixed.


    But the problem still exists.



    Regards,
    Kevin
  • Hello Kevin,

    We tried to reproduce the issue using our IDE Embedded Studio in parallel with SWOViewer CL and everything was working without any issues.
    Also launching GDBServer first and then SWOViewer again worked without any error.
    What are the CL parameters you are using?
    For comparison we used the following ones on a STM32F407 target:

    Source Code

    1. -device STM32F407VE -cpufreq 16000000 -swofreq 8000000
    Did you specify all three values?

    May I suggest moving away from GDB based debug software and use a proper debug software like Ozone? segger.com/products/development-tools/ozone-j-link-debugger/
    Ozone works multi platform and with any popular Arm compiler output. So you can build your project with the toolchain of your choice and then debug it in Ozone.
    Ozone also has SWO printf build in so you would not have to have running multiple tools in parallel.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hi,

    we don't want to use two different programs for developing. Some developers can not even deal with one ide.

    Back to the problem:

    I tested it with the non CL versions of GDB Server and SWO Viewer.

    I launch the GDBServer with options

    Source Code

    1. -select USB -device STM32F427VI -endian little -if SWD -speed 4000 -noir -LocalhostOnly

    Then connected the SWOViewer and selected the device etc at the config window.


    I just found out that it seems to be a Race condition...
    The problem persisted with about 2 out of 10 attempts.


    Best regards,
    Kevin
  • Hello Kevin,

    KBro wrote:

    we don't want to use two different programs for developing. Some developers can not even deal with one ide.
    This is exactly why Ozone was developed. So you only need to use the IDE for building.
    Everything else is standardized in Ozone. So your developers always have the same debug environment, does not matter which toolchain/compiler you are using for your project to generate the output. That way if you change the IDE in a future project the debug environment still stays the same.

    KBro wrote:

    Then connected the SWOViewer and selected the device etc at the config window.
    This won't work. Quote from current SWOViewer section in J-Link manual:
    "Should you have a target connection already open e.g. a
    debug session in your IDE we recommend defining the parameters device name, CPU clock
    frequency and SWO clock frequency via CL to avoid connection errors."

    So you would need to launch SWOViewer CL or GUI version the following way:

    Source Code

    1. JLinkSWOViewer.exe -device STM32F427VI -cpufreq <target device cpu speed> -swofreq <wanted SWO frequency>

    If you launch the SWOViewer with CL do you still see the error message?

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hi Nino,

    SEGGER - Nino wrote:

    This is exactly why Ozone was developed. So you only need to use the IDE for building.
    It would still be two programs to handle, an ide and ozone. Currently they are only using one.

    SEGGER - Nino wrote:

    This won't work. Quote from current SWOViewer section in J-Link manual:
    "Should you have a target connection already open e.g. a
    debug session in your IDE we recommend defining the parameters device name, CPU clock
    frequency and SWO clock frequency via CL to avoid connection errors.
    Sry my mistake, I did not pass the CPU clock.

    It's a bit strange that all possible params have to be passed to a program with a gui via cl but it works that way.

    Thanks a lot.

    Best regards,
    Kevin
  • Hello Kevin,

    Great to hear that you are up and running again.

    KBro wrote:

    It's a bit strange that all possible params have to be passed to a program with a gui via cl but it works that way.
    This is unfortunately currently needed as SWO handling got more and more "not standard" by many devices we support which lead to some incompatibilities with how J-Link handles connections to the target device.
    In future we plan on changing the way J-Link handles multiple connections to the target which will remove any issues related to this so you can use the SWOViewer with parallel connections just like you would when SWOViewer is running solo.

    KBro wrote:

    It would still be two programs to handle, an ide and ozone. Currently they are only using one.
    Yes and no. Right now you need additional software to display SWO. Want Tracing as well? Additional software. Power Profiling? Additional software.
    This all is already implemented in Ozone. So any project setup in your company would be "any IDE + Ozone" where the Ozone config could be shared among different projects.
    (Also Ozone can be used free of charge with a J-Link Plus or higher)
    Anyhow, as the initial request has been answered this thread will be closed now.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/