[SOLVED] JLink and debugger identification via USB + serial number, stop script execution if SN not found

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

  • [SOLVED] JLink and debugger identification via USB + serial number, stop script execution if SN not found

    Hi there,

    i'm using JLink.exe with the -CommanderScript option and the -SelectEmuBySN option in a test automation setup with multiple CPUs and multiple J-Links. Now, the selection via the serial number works fine. However, if only one debugger is plugged in (which could be the case sometimes), this debugger will be always chosen no matter what serial number i enter. I only get the line "Could not find emulator with USB serial number XXXXXXX", but the script will continue nonetheless. Is there a way to prevent this?
    I know i could use J-Link Pros with Ethernet, but would like to avoid this at the moment.

    Cheers,
    Alexander
  • Hi Alexander,

    if "exit on error" is active (command: "exitonerror 1" or command line param: "-ExitOnError"), J-Link Commander will try to connect to the specified J-Link and exit if it is not available.

    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 Niklas,

    thanks for your quick reply. This is exactly what i was looking for! Unfortunately it doesn't seem to work with JLink V4.98b. The script will continue to execute even if the SN was not found. I tried it with the current version of JLink, where it worked... I tried it with the command line options, as well as the commands "eoe 1" and "SelectEmuBySN 123" in the script file.
    So am i correct in the assumption, that i need a newer version of JLink than V4.98b or did i make a mistake?

    Source Code

    1. C:\Users\XXX\SVN3\XXX\trunk\Code\target\afe\afe_pressure>jlink deployment\flash_to_afe_release.jlink -ExitOnError 1 -SelectEmuBySN 174301931
    2. SEGGER J-Link Commander V4.98b ('?' for help)
    3. Compiled Apr 10 2015 20:16:11
    4. J-Link Commander will now exit on Error
    5. Script file read successfully.
    6. Could not find emulator with USB serial number 174301931.
    7. Processing script file...
    8. Device "ADUC7061" selected.
    9. Reconnecting to target...
    10. TotalIRLen = 4, IRPrint = 0x01
    11. Adaptive clocking not supported for selected CPU core. Only supported for -S cores.
    12. Auto JTAG speed: 8000 kHz
    13. Target interface speed: 8000 kHz
    14. Reset delay: 0 ms
    15. Reset type NORMAL: Using RESET pin, halting CPU after Reset
    16. Adaptive clocking not supported for selected CPU core. Only supported for -S cores.
    17. Auto JTAG speed: 8000 kHz
    18. PC: (R15) = 00000000, CPSR = 000000D3 (SVC mode, ARM FIQ dis. IRQ dis.)
    19. Current:
    20. R0 =00000000, R1 =00000000, R2 =00000000, R3 =00000000
    21. R4 =00000000, R5 =00000000, R6 =00000000, R7 =00000000
    22. R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    23. R13=00000000, R14=00000000, SPSR=00000010
    24. USR: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    25. R13=00000000, R14=00000000
    26. FIQ: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    27. R13=00000000, R14=00000000, SPSR=00000010
    28. IRQ: R13=00000000, R14=00000000, SPSR=00000010
    29. SVC: R13=00000000, R14=00000000, SPSR=00000010
    30. ABT: R13=00000000, R14=00000000, SPSR=00000010
    31. UND: R13=00000000, R14=00000000, SPSR=00000010
    32. Downloading file [output/release/AFE_pressure.bin]...
    33. **************************
    34. WARNING: CPU is running at very low speed (1032 kHz). Readback will be performed instead of CRC calc
    35. ulation.
    36. **************************
    37. J-Link: Flash download: Flash download into internal flash skipped. Flash contents already match
    38. J-Link: Flash download: Total time needed: 0.136s (Prepare: 0.044s, Compare: 0.082s, Erase: 0.000s,
    39. Program: 0.000s, Verify: 0.000s, Restore: 0.010s)
    40. O.K.
    41. Loading binary file output/release/AFE_pressure.bin
    42. Reading 12372 bytes data from target memory @ 0x00080000.
    43. Verify successful.
    44. Reset delay: 0 ms
    45. Reset type NORMAL: Using RESET pin, halting CPU after Reset
    46. Adaptive clocking not supported for selected CPU core. Only supported for -S cores.
    47. Auto JTAG speed: 8000 kHz
    48. Script processing completed.
    Display All


    Regards,
    Alex

    The post was edited 3 times, last by AlexanderL ().

  • Hi Alex,


    do I understand you correctly, that it works as expected (= Script file execution is stopped when J-Link with S/N is not found) with the current version, but not with 4.98b?
    If this is the case: Yes, you will need to use the current version (which everybody should do anyway :) )
    Is there anything you do not like about the current version compared to V4.98b?

    I remember that we improved the behavior of "exit on error" a few times after we introduced the command.

    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 Niklas,

    yes, exactly, it works, but not with the older version. There is nothing i dislike about the new version, it's just that we use 4.98b in our development environment. Since i need to change the scripts to work with the current version and the changed scripts won't work with the old version, all developers would have to update their software. I would like to avoid that. But i'm sure i'll find a workaround for this.

    Thank you very much for your help!

    Regards,
    Alex
  • Hi Alex,

    thanks for the feedback.
    Afair, not much changed regarding command files between V4.98 and V5.12 .
    The only major differences are:
    Since 5.10, you need to specify Target device, interface and speed (preferably in the command line parameters)
    Since 5.10, if the JTAG interface is used, specifying IRPre and DRPre is mandatory ("-JTAGConf <IRPre>,<DRPre>" as a command line parameter, "-JTAGConf -1,-1" for default)
    Since 5.10, we only connect to the target device if this is required by a given command or if "-autoconnect 1" is a command line parameter.

    The latest version before these changes is V5.02l:
    download.segger.com/Niklas/Setup_JLink_V502l.zip

    Please note that we do not provide support for old versions of the J-Link software.
    Therefore, if you need support for new devices or experience an issue caused by the J-Link software, you need to update to the newest version before we can help you.

    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.