[SOLVED] Can't get J-Trace to capture or breakpoint

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

  • [SOLVED] Can't get J-Trace to capture or breakpoint

    I'm finally attempting to use my J-Trace Cortex-M. No luck so far.

    The reference project seems to work. No problem. I can capture start, stop, and examine traces quite easily.

    My actual target board uses an STM32F746IG with a SYSCLK of 200 MHz. I've entered those into the project definition, pointed to the ELF file, and the project is created properly. I can see the source code in the window. Then, I configure trace to use the trace pins, and a 200 MHz CPU. I select a 4 bit width. Again, those inputs are accepted and saved to the project.

    Then, I set a Set Tracepoint(Start) on an early source line. No problem, I get the appropriate icon. Here's where things go wrong.

    If I Download and Reset Program, the Tracepoint icon disappears. When I attempt to restore it (right click), I get the message "J-Link API call failed: set tracepoint at 800FB6A. The traceclk to the probe is 8 MHz rather than 100 MHz.

    If instead of Download and Reset Program, I Attach to Running Program or Attach and Halt Program, I get the Cortex-M HardFault Exception Window with a 100 MHz traceclk. I'm delighted to see a nice, clean traceclk. However, since I was never able to establish that Tracepoint(Start) point, I have no trace data to see HOW I got to the HardFault.

    My sense is that I'm very close, as I can download the code, set a Tracepoint in the source window and (under some circumstances) get a 100 MHz traceclk. Perhaps I'm missing some important step to get the program kicked off with the trace enabled properly. I've haven't been able to capture a trace from the board yet.

    (The traceclk signal integrity looks quite good with a 1 GHz scope probe and the data lines are routed very similarly.)

    Suggestions?
  • Hello,

    Thank you for your inquiry.
    Please note that tracepoints are currently only supported for targets implementing an ETMv3.x.
    ETMv4 tracepoints are planned but not available yet.

    Is there as specific reason you are looking to use tracepoints?
    Please note that we offer a streaming trace probe as well which makes tracepoints essentially obsolete as you trace everything from the beginning of the application:
    segger.com/products/debug-probes/j-trace/

    If you are looking to upgrade your older J-Trace CM to a J-Trace Pro you can use our trade in program for that:
    segger.com/purchase/trade-in-program/


    Here are some additional reasons why it might be worth it to upgrade:

    wiki.segger.com/J-Trace_vs._J-Trace_PRO


    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, Nino. You've clarified a handful of items for me:

    1) I wasn't aware of the differences between ETMv3 and ETMv4. I also wasn't aware that the M7 core incorporated an ETMv4.
    2) I wasn't aware of the difference between a Breakpoint (TRACE_START) and a tracepoint. That helps me understand how to start my trace.
    3) I have a J-Trace PRO Cortex-M. Sorry I wasn't clear before. You recommended that upgrade to me a while back.

    So, it seems I need to set a Breakpoint at my code entry point (or very early in the code) and then set the Breakpoint Property to be TRACE_START. I could also set a Breakpoint TRACE_STOP in the Hardfault handler, which would conveniently stop my trace when I hit the error.

    Am I missing anything?
  • Hello,

    Thanks for clarifying.
    No need to set any Trace_Start or Stop points at all.
    Ozone will start and configure tracing automatically directly after debug start or reset.
    Also each time you continue from a regular breakpoint trace is restarted and reconfigured automatically.
    If your application encounters an error it will run to the fault handlers. But as you can see in the breakpoints window in Ozone the fault handlers are already breakpointed and Ozone and your target will halt if a fault is triggered (Ozone will also pop up additional information explaining the fault wiki.segger.com/Analyzing_Cortex-M_Faults_with_Ozone).

    So all you need to do is enable trace in Ozone settings, provide the target specific pex/JlinkScript file that handles the trace pin init (wiki.segger.com/Tracing_on_ST_STM32F746) and everything else should be working out of the box (just make sure your target application does not fiddle with the trace pin configuration).

    Can you confirm that trace is working as described?

    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.
  • Once again, thanks Nino.

    After very carefully modifying the .JLinkScript in the target that you linked to, I'm now able to capture traces. It's a real delight to see the trace off my custom board.

    There's a couple behaviors I don't understand yet, so I may have more questions. But for now, you've solved my issue.

    Thanks one more time.
  • Hello,

    Great to hear that you are up and running again.
    Please note that if your J-Trace Pro is still in valid support period (includes 1 year after purchase) we recommend to use our support form (see my signature) for your inquiries to have a guarantee that your questions will be answered.
    While we try to answer questions in this community forum where possible there is no guarantee that you will receive an answer here from staff.

    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.