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

  • 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: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

  • Hi,

    Regarding undocumented information, please refer to https://www.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: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

  • basically I want to know because I would like to judge if I can trust that reading.

    I'm in doubt if my controller is running at the correct frequency.

    Edited once, last by pruesch (April 6, 2016 at 11:34 AM).

  • 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: https://www.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:

    Code
    [developer@localhost ~]$ cat cpu_freq 
    eoe 1
    testcspeed 0x20000000
    q


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

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

    thanks

    Edited 5 times, last by pruesch (April 6, 2016 at 2:39 PM).

  • 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

    Code
    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: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

  • Hi,

    Quote

    I'm on linux. there is no binary called "JLinkCommander". But "JLinkExe" seems to understand the same commands.

    JLinkExe == JLinkCommander

    Quote

    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.

    Quote

    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: https://www.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 http://cache.nxp.com/files/microcon…note/AN4745.pdf :

    Quote

    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.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!