JLink Commander "Unspecified error -1"

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

  • JLink Commander "Unspecified error -1"

    Hi,

    I've tried to program NXP LPC4357 via JLink Commander 4.90e and occasionally getting this error: Unspecified error -1
    Usually if I retry the process straight away, everything is fine and the process is successfully completed.
    What is this error and how to make the process more reliable?

    Here is what I am doing:
    1. Issue command to JLink Commander asking it to process a script:
    "C:\Program
    Files (x86)\SEGGER\JLink_V490e\JLink.exe" -CommanderScript
    c:\Flash\cf.jlink

    2. The script is very simple:
    device LPC4357_M4
    speed 1000
    r
    h
    erase
    loadbin C:\0\Test.hex, 0x1A000000
    exit

    3. Below is the log of situation when error occurs:

    C:\0>"C:\Program Files (x86)\SEGGER\JLink_V490e\JLink.exe" -CommanderScript c:\0
    \cf.jlink
    SEGGER J-Link Commander V4.90e ('?' for help)
    Compiled Sep 8 2014 18:46:42

    Script file read successfully.
    Updating firmware: J-Link V9 compiled Sep 5 2014 18:54:08
    Replacing firmware: J-Link V9 compiled Apr 15 2014 19:08:28
    Waiting for new firmware to boot
    New firmware booted successfully
    DLL version V4.90e, compiled Sep 8 2014 18:46:31
    Firmware: J-Link V9 compiled Sep 5 2014 18:54:08
    Hardware: V9.00
    S/N: ......
    Feature(s): GDB
    VTarget = 3.140V
    Info: TotalIRLen = 8, IRPrint = 0x0011
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: TPIU fitted.
    Info: ETM fitted.
    Found 2 JTAG devices, Total IRLen = 8:
    #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    #1 Id: 0x0BA01477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    Cortex-M4 identified.
    Target interface speed: 100 kHz
    Processing script file...

    Info: Device "LPC4357_M4" selected (1024 KB flash, 40 KB RAM).
    Reconnecting to target...
    Info: TotalIRLen = 8, IRPrint = 0x0011
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: TPIU fitted.
    Info: ETM fitted.
    Info: ETB present.

    Target interface speed: 1000 kHz

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    Info: LPC18xx/43xx reset: Halting CPU before performing reset...
    Info: LPC18xx/43xx reset: Halted CPU before reset.
    Info: Unknown LPC18xx/43xx bootloader variant. Halting after reset may fail.

    PC = 1A05040C, CycleCnt = 00000000
    R0 = 1A000000, R1 = 1A000000, R2 = 400F1FC0, R3 = 12345678
    R4 = 40045000, R5 = 1008000C, R6 = 00000000, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 10006090, MSP= 10006090, PSP= 00000000, R14(LR) = 10405B25
    XPSR = 41000000: APSR = nZcvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.

    Erasing device (LPC4357_M4)...
    Info: J-Link: Flash download: Total time needed: 3.431s (Prepare: 0.117s, Compar
    e: 0.000s, Erase: 3.302s, Program: 0.000s, Verify: 0.000s, Restore: 0.011s)
    Erasing done.

    Downloading file [C:\0\Test.hex]...Info: J-Link: Flash download: Total time ne
    eded: 106.449s (Prepare: 0.172s, Compare: 93.172s, Erase: 10.018s, Program: 0.00
    0s, Verify: 0.000s, Restore: 3.086s)
    Unspecified error -1


    Script processing completed.
  • Hi,

    a) Welcome to the forum
    b) This is *not* a support forum with claim to get support from engineers. It is mainly
    c) As you can see in other threads, it is not useless at all
    d) As a legitimate owner of a J-Link, you can reach support via: support@segger.com
    e) Did you give the current version (V4.92) a try?
    f) As this error says, it is a not specified one. It may be due to some unexpected behavior of the CPU on a low-level during the flash programming setup

    Info: Unknown LPC18xx/43xx bootloader variant. Halting after reset may fail.

    This struggles me a bit, since the reset for the LPC43 series is one of the most complex ones and if it works correctly, heavily depends on the ROM bootloader version in the LPC43.
    Unfortunately, these devices have a lot of silicon bugs regarding debugging, which makes it extremely complicated to be able to make them work correctly under all circumstances.

    Are you using an eval board or custom hardware?
    If custom hardware: Please check with an eval board, if you see the same behavior.
    Just to make sure that there is no problem with signal quality etc. on the hardware, that might lead to unstable functionality.

    How often does this issue come up? (1 of 10, 1 of 100, 1 of 1000 rounds)
    When contacting support you will probably also be asked for a reproduction scenario.
    We are not aware of any problems regarding flash programming for this device, so far and without a reproduction scenario it is almost impossible to fix such problems.


    - Alex
    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.
  • a) Thank you
    b) I've decided to join the forum after I couldn't find any other way to contact Segger for support.
    c) If you say so...
    d) Thanks, will do.
    e) No, I wasn't aware of this version. I will give it a go.
    f) The error seem to happen at the end of erase stage. The symptoms are:
    - The script runs as normal
    - The progress window (the one with three bars) appears on the screen and stays for several minutes but the progress bars aren't updated.
    - Then the progress window disappears and the script finishes with the Unspecified Error -1.
    g) I am using custom board and EmBest LPC4357-EVB board.
    h) The issue is fairly rare, 1 out of 10 (I guess; I didn't do any specific records). It normally happens when I decide to program a hex file which is totally different from what is already in flash. I never managed to come across this problem when reflashing the same file all over again.
  • f) The error seem to happen at the end of erase stage. The symptoms are:

    Sounds a bit like a timeout is occurring when erasing the last sector or similar...

    g) I am using custom board and EmBest LPC4357-EVB board.

    Does the issue occur on both hardwares?
    Did you check if the issue comes up more often if you increase the JTAG speed up to let's say 8 MHz or similar?

    h) The issue is fairly rare, 1 out of 10 (I guess; I didn't do any specific records).

    1 of 10 is not too bad. We sometimes have issues which come up 1 per 72 hours or something like that, which is a lot worse to reproduce. :)

    It normally happens when I decide to program a hex file which is totally different from what is already in flash. I never managed to come across this problem when reflashing the same file all over again.

    If you do not explicitly erase the flash before programming the same file again, J-Link will skip the programming process as it compares the flash contents first and detects that the contents already match.

    - Alex
    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 just ran a couple of hundreds tests with 4.92 and here are the findings:

    1. There are two type of failures:
    - Programming failure (as per my previous message)
    - Erase failure (see log below)

    Here is the log of the erase failure:
    C:\0>"C:\Program Files (x86)\SEGGER\JLink_V492\JLink.exe" -CommanderScript c:\0\
    cf3.jlink
    SEGGER J-Link Commander V4.92 ('?' for help)
    Compiled Sep 30 2014 09:33:51

    Script file read successfully.
    DLL version V4.92, compiled Sep 30 2014 09:33:42
    Firmware: J-Link V9 compiled Sep 29 2014 18:56:38
    Hardware: V9.00
    S/N:.....
    Feature(s): GDB
    VTarget = 3.156V
    Info: TotalIRLen = 8, IRPrint = 0x0011
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: TPIU fitted.
    Info: ETM fitted.
    Found 2 JTAG devices, Total IRLen = 8:
    #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    #1 Id: 0x0BA01477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    Cortex-M4 identified.
    Target interface speed: 100 kHz
    Processing script file...

    Info: Device "LPC4357_M4" selected (1024 KB flash, 40 KB RAM).
    Reconnecting to target...
    Info: TotalIRLen = 8, IRPrint = 0x0011
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: TPIU fitted.
    Info: ETM fitted.
    Info: ETB present.

    Target interface speed: 1000 kHz

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    Info: LPC18xx/43xx reset: Halting CPU before performing reset...
    Info: LPC18xx/43xx reset: Halted CPU before reset.
    Info: Unknown LPC18xx/43xx bootloader variant. Halting after reset may fail.

    PC = 1A04D63C, CycleCnt = 00000000
    R0 = 1A000000, R1 = 1A000000, R2 = 400F1FC0, R3 = 12345678
    R4 = 40045000, R5 = 1008000C, R6 = 00000000, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 10006040, MSP= 10006040, PSP= 00000000, R14(LR) = 10405B25
    XPSR = 41000000: APSR = nZcvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.

    Erasing device (LPC4357_M4)...

    ****** Error: Failed to prepare for programming.
    Failed to execute RAMCode for RAM check!
    ERROR: Erase returned with error code -1.


    Downloading file [C:\0\LFR_Engine.hex]...Info: J-Link: Flash download: Flash pro
    gramming performed for 3 ranges (335872 bytes)
    Info: J-Link: Flash download: Total time needed: 3.972s (Prepare: 0.173s, Compar
    e: 0.146s, Erase: 0.552s, Program: 3.010s, Verify: 0.010s, Restore: 0.079s)
    O.K.


    Script processing completed.
    2. The tests were run with both our own custom PCB and commercially available Embest LPV4357-EVB.
    There is no difference between the two failure-wise. The failure rate is very much the same for both.

    3. Changing speed to 8MHz did not solve the problem.

    4. The script has a command that forces erasing of the flash before programming. For example:
    device LPC4357_M4
    speed 8000
    r
    h
    erase
    loadbin C:\0\LFR_Engine.hex, 0x1A000000
    exit

    BTW, I captured progress bar during the failure mode. See attachment.
    Images
    • Scr2.png

      17.91 kB, 460×165, viewed 897 times
  • Hi,

    Would it be possible, to temporary get a hardware sample from you,
    that allows reproduction of the problem here?
    We would like to check where this issue comes from and what can be done to avoid it,
    but we were unable to reproduce the issue here, so far.


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

    While I can't send you our own proprietary board, I can probably send you the Embest LPC4357-EVB device.
    I can also send you the script but not .hex file (we need to set up NDA for this).
    Would that be sufficient?

    Please let me know your shipping address in case you would like to proceed.