[SOLVED/OR] How does SWO Viewer measure the core frequency?

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

  • Hi,

    you can get it from J-Link Commander, by typing the command "testcspeed" or "testc".

    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,

    Regarding undocumented information, please refer to segger.com/support/technical-support/.
    In case you can tell us why you need this information, we can probably help you, but i would recommend to ask via mail and not in this public forum.

    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,


    What target device do you use?
    What is the core frequency reported by J-Link Commander?
    What core frequency did you expect?


    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.
  • I'm using a STM32F429 device.

    J-Link Commander says 180 MHz. This covers with my intention.

    But I face some strange effects with my application and want to be sure about the Freq.


    I'm on linux. there is no binary called "JLinkCommander". But "JLinkExe" seems to understand the same commands.
    How would I connect to a target via script mode?

    I want to have the core frequency printed on stdout.

    edit:
    hope this helps if someone wants to do the same:

    Source Code

    1. [developer@localhost ~]$ cat cpu_freq
    2. eoe 1
    3. testcspeed 0x20000000
    4. q



    Source Code

    1. [developer@localhost ~]$ /usr/local/bin/JLinkExe -device STM32F429VG -if swd -speed 6000 -CommanderScript cpu_freq
    2. SEGGER J-Link Commander V5.10k (Compiled Feb 9 2016 18:31:25)
    3. DLL version V5.10k, compiled Feb 9 2016 18:31:20
    4. Script file read successfully.
    5. Processing script file...
    6. J-Link Commander will now exit on Error
    7. J-Link connection not established yet but required for command.
    8. Connecting to J-Link via USB...O.K.
    9. Firmware: J-Trace Cortex-M Rev.3 compiled Sep 4 2015 18:16:12
    10. Hardware version: V3.10
    11. S/N: xxxxxxxxxxxxx
    12. License(s): RDI, FlashBP, FlashDL, JFlash, GDB
    13. Emulator has Trace capability
    14. VTref = 3.293V
    15. Target connection not established yet but required for command.
    16. Device "STM32F429VG" selected.
    17. Found SWD-DP with ID 0x2BA01477
    18. Found SWD-DP with ID 0x2BA01477
    19. Found Cortex-M4 r0p1, Little endian.
    20. FPUnit: 6 code (BP) slots and 2 literal slots
    21. CoreSight components:
    22. ROMTbl 0 @ E00FF000
    23. ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    24. ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    25. ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    26. ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    27. ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    28. ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    29. Cortex-M4 identified.
    30. Testing CPU clock frequency @ address 0x20000000...
    31. CPU running at 180051 kHz
    32. Script processing completed.
    Display All


    with some grep magic I get the CPU freq on stdout:

    Source Code

    1. [developer@localhost ~]$ /usr/local/bin/JLinkExe -device STM32F429VG -if swd -speed 6000 -CommanderScript cpu_freq | grep -oP '\d+(?= kHz)'
    2. 180051


    thanks

    The post was edited 5 times, last by pruesch ().

  • Hi,


    the concept of the measurement is as follows:
    • Download a small application to RAM (a simple loop, cycles per loop are known)
    • Let the application run for a fixed amount of time
    • Read back the number of times the loop has been completed
    • Restore the target RAM and registers
    We can now conclude the core freq from

    Source Code

    1. CoreFreq = (Number of loops * Cycles per Loop) / Time

    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,

    I'm on linux. there is no binary called "JLinkCommander". But "JLinkExe" seems to understand the same commands.
    JLinkExe == JLinkCommander
    How would I connect to a target via script mode?
    You can use the command "connect" or use "-autoconnect 1" as a command line parameter.
    I want to have the core frequency printed on stdout.
    JLink Commander is just a "helper tool" during development. If you need the core freg to stdout during development, i would suggest to use JLinkExe and parse the output, for example with grep. If you need a reliable application for production I would recommend the J-Link SDK (Part No 8.08.06 on the price list).

    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.
  • just a quick note:

    one has to be really careful on what memory address is specified for the "testcspeed" command in JLink Commander.
    for Freescale (NXP) devices there are different SRAM regions which are accessible differently for data and instructions.

    I was confused because I got a reading of half the frequency I was expecting.

    turns out, I was running the test in a suboptimal SRAM region (SRAM_U).

    The information in which memory region the speed test should be run is available in JLinkSWO Viewer.

    Suggestion: use this information in JLinkCommander when no address information is given.


    from cache.nxp.com/files/microcontrollers/doc/app_note/AN4745.pdf :
    The memory itself can be accessed in a single cycle, but because instruction accesses to the system bus incurs a one clock delay at the core, SRAM_U instruction accesses take at least two clocks.