[SOLVED] Difficulty Programming LPC2478 MCU with JLink.exe

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

  • [SOLVED] Difficulty Programming LPC2478 MCU with JLink.exe

    Hello Community,

    I am having an issue programming a LPC2478 NXP ARM7 processor, while using JLink.exe version JLink_V698c.
    I have no issues using IAR Systems to program the processor.
    Below are the steps I took in the commander tool.
    Any help is greatly appreciated!

    Thank you!

    ************************************************************************************************

    SEGGER J-Link Commander V6.98c (Compiled Mar 16 2021 12:20:44)
    DLL version V6.98c, compiled Mar 16 2021 12:19:26

    Connecting to J-Link via USB...O.K.
    Firmware: J-Link ARM V6 compiled Jun 20 2012 19:43:26
    Hardware version: V6.00
    VTref=3.339V


    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Please specify device / core. <Default>: LPC2478
    Type '?' for selection dialog
    Device>
    Please specify target interface:
    J) JTAG (Default)
    TIF>
    Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
    JTAGConf>
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "LPC2478" selected.


    Connecting to target via JTAG
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4F1F0F0F, IRLen: 04, ARM7TDMI-S Core
    ARM7 identified.
    J-Link>s

    ****** Error: CPU is not halted
    J-Link>h
    Received 0 as core Id.
    Using DBGRQ to halt CPU
    PC: (R15) = 23600350, CPSR = 7FFFFFFF (System mode, THUMB FIQ dis. IRQ dis.)
    Current:
    R0 =23602360, R1 =7FFFFFFF, R2 =7FFFFFFF, R3 =7FFFFFFF
    R4 =7FFFFFFF, R5 =7FFFFFFF, R6 =7FFFFFFF, R7 =3FFFFFFF
    R8 =7FFFFFFF, R9 =3FFFFFFF, R10=7FFFFFFF, R11=3FFFFFFF, R12=7FFFFFFF
    R13=7FFFFFFF, R14=7FFFFFFF
    USR: R8 =7FFFFFFF, R9 =3FFFFFFF, R10=7FFFFFFF, R11=3FFFFFFF, R12=7FFFFFFF
    R13=7FFFFFFF, R14=7FFFFFFF
    FIQ: R8 =7FFFFFFF, R9 =7FFFFFFF, R10=7FFFFFFF, R11=7FFFFFFF, R12=7FFFFFFF
    R13=7FFFFFFF, R14=7FFFFFFF, SPSR=7FFFFFFF
    IRQ: R13=7FFFFFFF, R14=7FFFFFFF, SPSR=7FFFFFFF
    SVC: R13=7FFFFFFF, R14=7FFFFFFF, SPSR=7FFFFFFF
    ABT: R13=7FFFFFFF, R14=7FFFFFFF, SPSR=7FFFFFFF
    UND: R13=7FFFFFFF, R14=7FFFFFFF, SPSR=7FFFFFFF
    J-Link>loadfile "C:\Desktop\MyBoardFile.hex"
    Received 0 as core Id.
    Downloading file [C:\Desktop\MyBoardFile.hex]...

    ****** Error: Read memory error @ address 0xE01FC040, word access: Core error.
    Writing target memory failed.
    J-Link>r
    Reset delay: 0 ms
    Reset type NORMAL: Using RESET pin, halting CPU after Reset
    Failed to program ICE breaker before Reset, using default reset strategy.
    Resetting target using RESET pin
    Resetting TRST
    CPU no longer halted after stop via WP: DBGACK = 0, nMREQ = 0
    Resetting TRST
    CPU no longer halted after stop via DBGRQ: DBGACK = 0, nMREQ = 0
    J-Link>h
    PC: (R15) = 00000000, CPSR = 000000D3 (SVC mode, ARM FIQ dis. IRQ dis.)
    Current:
    R0 =00000000, R1 =00000000, R2 =00000000, R3 =00000000
    R4 =00000000, R5 =00000000, R6 =00000000, R7 =00000000
    R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=00000000, SPSR=00000010
    USR: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=00000000
    FIQ: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=00000000, SPSR=00000010
    IRQ: R13=00000000, R14=00000000, SPSR=00000010
    SVC: R13=00000000, R14=00000000, SPSR=00000010
    ABT: R13=00000000, R14=00000000, SPSR=00000010
    UND: R13=00000000, R14=00000000, SPSR=00000010
    J-Link>loadfile "C:\Desktop\MyBoardFile.hex"
    Received 0 as core Id.
    Downloading file [C:\Desktop\MyBoardFile.hex]...

    ****** Error: Failed to measure CPU clock frequency
    Write memory error @ address 0x40000000, word access: Memory access timeout.
    Could not detect CPU clock speed. Readback of test code downloaded into RAM failed.

    Unspecified error -1
    J-Link>
  • I increased the target speed and I was able to download the code file, but the software isn't functioning properly.
    I know there is code running on the board after the loadfile downloaded, because my speaker on the board beeps after pushing a button.
    However, my display is just showing random lines.

    ***Note: There is nothing wrong with the controls software or hardware and have been using IAR to download the code file for awhile. Recently been wanting to use the JLink Commander tool.***

    Should I be using loadbin instead of loadfile? Should I specify the address location?

    ************************************************************************************************
    SEGGER J-Link Commander V6.98c (Compiled Mar 16 2021 12:20:44)
    DLL version V6.98c, compiled Mar 16 2021 12:19:26

    Connecting to J-Link via USB...O.K.
    Firmware: J-Link ARM V6 compiled Jun 20 2012 19:43:26
    Hardware version: V6.00
    VTref=3.345V

    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Please specify device / core. <Default>: LPC2478
    Type '?' for selection dialog
    Device>
    Please specify target interface:
    J) JTAG (Default)
    TIF>
    Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
    JTAGConf>
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "LPC2478" selected.

    Connecting to target via JTAG
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4F1F0F0F, IRLen: 04, ARM7TDMI-S Core
    ARM7 identified.
    J-Link>speed 100 kHz
    Selecting 100 kHz as target interface speed
    J-Link>h
    Received 0 as core Id.
    Using DBGRQ to halt CPU
    Resetting TRST in order to halt CPU
    PC: (R15) = 7FFFF03A, CPSR = 400000F3 (SVC mode, THUMB FIQ dis. IRQ dis.)
    Current:
    R0 =00000000, R1 =E000C000, R2 =80000000, R3 =7FFFE18B
    R4 =0000001F, R5 =40000124, R6 =00000045, R7 =00000000
    R8 =73458249, R9 =1885085C, R10=FB5A33C1, R11=A00AD93A, R12=FFFFFFFF
    R13=4000FF84, R14=7FFFF0DB, SPSR=00000010
    USR: R8 =73458249, R9 =1885085C, R10=FB5A33C1, R11=A00AD93A, R12=FFFFFFFF
    R13=A950C66A, R14=E42D0FA8
    FIQ: R8 =1401A095, R9 =D0094A9B, R10=722D02FB, R11=395C1B2C, R12=D82501A2
    R13=AE044236, R14=164B733F, SPSR=00000010
    IRQ: R13=8B00130C, R14=AD91299E, SPSR=00000010
    SVC: R13=4000FF84, R14=7FFFF0DB, SPSR=00000010
    ABT: R13=0C750AE7, R14=8C6B29A3, SPSR=00000010
    UND: R13=AF21380C, R14=0FC30E09, SPSR=00000010
    J-Link>erase
    Without any give address range, Erase Chip will be executed
    Erasing device...
    CPU is running at low speed (4104 kHz).
    J-Link: Flash download: Total time needed: 10.123s (Prepare: 3.316s, Compare: 0.000s, Erase: 4.404s, Program: 0.000s, Verify: 0.000s, Restore: 2.402s)
    Erasing done.
    J-Link>h
    PC: (R15) = 00001D8C, CPSR = 000000D7 (ABORT mode, ARM FIQ dis. IRQ dis.)
    Current:
    R0 =00000000, R1 =00000000, R2 =00000000, R3 =00000000
    R4 =00000000, R5 =00000000, R6 =00000000, R7 =00000000
    R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=000D6240, SPSR=000000D7
    USR: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=00000000
    FIQ: R8 =00000000, R9 =00000000, R10=00000000, R11=00000000, R12=00000000
    R13=00000000, R14=00000000, SPSR=00000010
    IRQ: R13=00000000, R14=00000000, SPSR=00000010
    SVC: R13=00000000, R14=00002018, SPSR=00000010
    ABT: R13=00000000, R14=000D6240, SPSR=000000D7
    UND: R13=00000000, R14=00000000, SPSR=00000010
    J-Link>loadfile "C:\Desktop\MyBoardFile.hex"
    Downloading file [C:\Desktop\MyBoardFile.hex]...
    CPU is running at low speed (4080 kHz).
    J-Link: Flash download: Bank 0 @ 0x00000000: 4 ranges affected (425984 bytes)
    J-Link: Flash download: Total: 76.859s (Prepare: 3.315s, Compare: 3.014s, Erase: 0.312s, Program & Verify: 67.815s, Restore: 2.400s)
    J-Link: Flash download: Program & Verify speed: 6 KB/s
    O.K.
    J-Link>r
    Reset delay: 0 ms
    Reset type NORMAL: Using RESET pin, halting CPU after Reset
    J-Link>g
    J-Link>
  • Hello,

    Thank you for your inquiry.
    Generally if it works in IAR it will work with J-Link Commander. Just make sure to use the same interface, speed settings etc. that you set up in IAR.
    According to your second post downloading works now, but the application does not run as expected, correct?
    Keep in mind that if you program the application with Commander it must be able to run standalone. If you use an IDE an application might work as expected, but it is another thing to have it work without a debugger connected.
    Make sure that the boot setup of the device is set up correctly.
    To verify that this is no Commander related issue simply download the application with IAR.
    Now stop the debug session and do a power on reset of your target board.
    Does the application run now as expected?
    If not then the application setup in general is not set up correctly and only worked as long as a debugger was attached.
    If it does work, then there is most likely something additionally downloaded with your IAR setup, that is not considered with Commander.

    Please note that the J-Link you are using is out of support and maintenance for roughly 15 years now.
    If you require support from us for your setup you will need a newer J-Link that is in valid support period.
    For this our trade in program may be utilized:
    segger.com/purchase/trade-in-program/

    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.