[SOLVED] Using SWO with Ozone

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

  • [SOLVED] Using SWO with Ozone

    I have a J-Link EDU connected to an NXP MK20DX256XXX7 Cortex M4 MCU using SWO. If I run JLinkSWOViewer from the command line I am able to see the SWO output from my MCU, however, I would like to see this within Ozone, which I use for the rest of my debugging. Is this possible?

    If so, is it possible to do instruction tracing, code profiling and all that other good stuff from Ozone using SWO?
  • Hello Don,

    Thank you for your inquiry.

    If I run JLinkSWOViewer from the command line I am able to see the SWO output from my MCU, however, I would like to see this within Ozone, which I use for the rest of my debugging. Is this possible?


    You can activate SWO in Ozone by enabling it through Edit->Trace Settings...->Trace Source: SWO and leave Clocks on Auto.
    That way you will be able to do printf SWO debugging.

    If so, is it possible to do instruction tracing, code profiling and all that other good stuff from Ozone using SWO?

    Currently only basic printf SWO debugging is supported by Ozone. More advanced features are on the ToDo list.

    But we have our very own IDE Embedded Studio that does support advanced SWO tracing functions. Would that be an option for you?
    You can use it for free for evaluation purposes and see if it fits your needs. segger.com/products/development-tools/embedded-studio/
    A guide on how to enable SWO Tracing in Embedded Studio can be found here: wiki.segger.com/How_to_configure_Embedded_Studio_to_use_SWO

    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.
  • I tried the trace settings as per your instructions but no output appears in the terminal window, see attached. All I get is "TARGET RESET".
    Images
    • Screen Shot 2017-10-10 at 08.56.15.png

      216.09 kB, 774×1,174, viewed 804 times
    • Screen Shot 2017-10-10 at 08.55.31.png

      57.64 kB, 1,244×682, viewed 799 times
  • Hello Don,

    With what function are you outputting the SWO messages?
    Is it something CLion specific?

    For reference i created an example project for you that runs out-of-the-box on any MK20DX256XXX7 target board.
    Could you give it a try and see if you can see any output in the terminal with the example project?
    It will be available for download for at least 24 h here.

    I also included the Embedded Studio Project and Sources so you can give SWO Instruction trace and Code Profiling a try.

    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 very much for putting that together. I ran the elf file and saw the output "SWO-TEST" in the terminal window. It must be a problem with my code.

    It's not immediately obvious to me why JLinkSWOViewer displays my output and Ozone doesn't but since I have your source to diff against I can investigate further.

    I tried embedded studio with the supplied project, however, when I go to Debug->Go I get an error stating "Cannot determine SWO speed" (see attached)
    Images
    • Screen Shot 2017-10-10 at 12.28.07.png

      110.53 kB, 1,004×558, viewed 628 times
  • Hello Don,

    It's not immediately obvious to me why JLinkSWOViewer displays my output and Ozone doesn't but since I have your source to diff against I can investigate further.


    When does the SWOViewer Output data? When debugging from Ozone or when debugging from CLion?

    I tried embedded studio with the supplied project, however, when I go to Debug->Go I get an error stating "Cannot determine SWO speed" (see attached)


    This sounds strange. What J-Link are you using for the connection to the target and what Serial Number does your J-Link have?
    It looks like the SWO Speed I set in the project is to high for the J-Link you are using.
    You can edit that speed in the project options under: Target Trace-> SWO Baud Rate

    Currently 2 MHz are set. How to find out which speeds are supported by your J-Link please follow the instructions in this Wiki article: wiki.segger.com/How_to_configure_Embedded_Studio_to_use_SWO
    In section: Calculating the SWO speed

    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.
  • When does the SWOViewer Output data? When debugging from Ozone or when debugging from CLion?


    Neither, SWODataViewer only works when I run it from the command line and the MCU is not being debugged by any other software.

    Here's the output:

    Source Code

    1. Please enter the target CPU frequency (in Hz) or press to select a device for automatic CPU frequency detection.
    2. CPUFreq >
    3. Device > MK20DX256XXX7
    4. Target CPU (MK20DX256XXX7) is running @ 21027 kHz.
    5. Receiving SWO data @ 21493 kHz.
    6. Showing data from stimulus port(s): 0


    What J-Link are you using for the connection to the target and what Serial Number does your J-Link have?


    JLink EDU with s/n 260101749

    It looks like the SWO Speed I set in the project is to high for the J-Link you are using.
    You can edit that speed in the project options under: Target Trace-> SWO Baud Rate


    I set both the Trace Clock Speed and SWO Baud Rate to 21493000 Hz, then I could see the output in the Debug Terminal. Seems slightly odd that SWODataViewer can detect the CPU speed but Embedded Studio cannot but hey, it works!

    The post was edited 2 times, last by donturner ().

  • Hello Don,

    JLink EDU with s/n 260101749


    Ok with the EDU you should see no problems running SWO trace for most targets as it supports up to 30 MHz SWO speed.


    I set both the Trace Clock Speed and SWO Baud Rate to 21493000 Hz, then I could see the output in the Debug Terminal. Seems slightly odd that SWODataViewer can detect the CPU speed but Embedded Studio cannot but hey, it works!

    First, good to hear that you are up and running again. It is still weird thought that 2 MHz would not work correctly. Did you use the latest J-Link Software and Firmware?
    I just tested with a J-Link Plus(same hardware as the EDU) and had no problems whatsoever running with 2 MHz SWO baud rate.
    For reference i was using J-Link Software version V6.20e.

    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.