J-link SAM4L-EK error "Failed to launch program. Error: Failed to write DP register 0x2"

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

  • J-link SAM4L-EK error "Failed to launch program. Error: Failed to write DP register 0x2"

    Hi, Help!
    I am working with Atmel Studio, the SAM4L-EK and Jlink

    The system worked briefly using one of the sample examples to make sure the system worked but now I always get the same error

    Failed to Launch program
    Error: Failed to write DP register 0x2

    Studio can communicate with the SAM4, the SAM4L can be erased and signature bytes read, etc....

    The Jlink device seems to be working
    There aren't any errors reporting in building the solution

    Sorry but I am stumped, can somebody help a brother out?

    Rather than include tons of messages from Studio, I pared it down to this,

    Lots of stuff before this…


    Finished
    building: ../src/spi_example.c



    Building
    target: SPI_EXAMPLE1.elf



    Invoking:
    ARM/GNU Linker : 4.8.3



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"
    -o SPI_EXAMPLE1.elf
    src/ASF/common/services/clock/sam4l/dfll.o
    src/ASF/common/services/clock/sam4l/osc.o
    src/ASF/common/services/clock/sam4l/pll.o src/ASF/common/services/clock/sam4l/sysclk.o
    src/ASF/common/services/delay/sam/cycle_counter.o
    src/ASF/common/services/serial/usart_serial.o
    src/ASF/common/utils/interrupt/interrupt_sam_nvic.o
    src/ASF/common/utils/stdio/read.o src/ASF/common/utils/stdio/write.o
    src/ASF/sam/boards/sam4l_ek/board_monitor.o src/ASF/sam/boards/sam4l_ek/init.o
    src/ASF/sam/drivers/bpm/bpm.o src/ASF/sam/drivers/flashcalw/flashcalw.o
    src/ASF/sam/drivers/spi/spi.o src/ASF/sam/drivers/usart/usart.o
    src/ASF/sam/drivers/wdt/wdt_sam4l.o
    src/ASF/sam/utils/cmsis/sam4l/source/templates/exceptions.o src/ASF/sam/utils/cmsis/sam4l/source/templates/gcc/startup_sam4l.o
    src/ASF/sam/utils/cmsis/sam4l/source/templates/system_sam4l.o
    src/ASF/sam/utils/syscalls/gcc/syscalls.o src/spi_example.o -mthumb -Wl,-Map="SPI_EXAMPLE1.map"
    -Wl,--start-group -larm_cortexM4l_math -lm
    -Wl,--end-group -L"../cmsis/linkerScripts"
    -L"../src/ASF/thirdparty/CMSIS/Lib/GCC" -Wl,--gc-sections -mcpu=cortex-m4
    -Wl,--entry=Reset_Handler -Wl,--cref -mthumb
    -T../src/ASF/sam/utils/linker_scripts/sam4l/sam4l4/gcc/flash.ld



    Finished
    building target: SPI_EXAMPLE1.elf



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM
    GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O
    binary "SPI_EXAMPLE1.elf" "SPI_EXAMPLE1.bin"



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe"
    -O ihex -R .eeprom -R .fuse -R .lock -R .signature "SPI_EXAMPLE1.elf"
    "SPI_EXAMPLE1.hex"



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM
    GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -j
    .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0
    --no-change-warnings -O binary "SPI_EXAMPLE1.elf"
    "SPI_EXAMPLE1.eep" || exit 0



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-objdump.exe"
    -h -S "SPI_EXAMPLE1.elf" > "SPI_EXAMPLE1.lss"



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM
    GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O
    srec -R .eeprom -R .fuse -R .lock -R .signature
    "SPI_EXAMPLE1.elf" "SPI_EXAMPLE1.srec"



    "D:\Program
    Files (x86)\Atmel\Atmel Toolchain\ARM
    GCC\Native\4.8.1426\arm-gnu-toolchain\bin\arm-none-eabi-size.exe"
    "SPI_EXAMPLE1.elf"



    text data bss dec hex filename


    26628 0 4392 31020 792c SPI_EXAMPLE1.elf


    Done
    executing task "RunCompilerTask".



    Using
    "RunOutputFileVerifyTask" task from assembly "D:\Program Files
    (x86)\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".



    Task
    "RunOutputFileVerifyTask"



    Program
    Memory Usage : 26628 bytes 10.2 % Full



    Data
    Memory Usage : 4392 bytes 12.6 % Full



    Done
    executing task "RunOutputFileVerifyTask".



    Done building target
    "CoreBuild" in project "SPI_EXAMPLE1.cproj".



    Target "PostBuildEvent"
    skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as
    ('' != '').



    Target "Build" in file
    "D:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Avr.common.targets"
    from project "C:\Users\tambrose.LPA.000\Documents\Atmel
    Studio\6.2\SPI_EXAMPLE1\SPI_EXAMPLE1\SPI_EXAMPLE1.cproj" (entry point):



    Done building target
    "Build" in project "SPI_EXAMPLE1.cproj".



    Done building project
    "SPI_EXAMPLE1.cproj".






    Build succeeded.


    ========== Build: 1 succeeded or
    up-to-date, 0 failed, 0 skipped ==========
    Images
    • out1.png

      55.72 kB, 1,702×569, viewed 1,597 times
    • avrs.png

      95.35 kB, 522×508, viewed 1,285 times
    • jl1.png

      36.86 kB, 770×360, viewed 1,213 times
  • Kind of sounds like the problem I was having last week with my sam3u-ek and sam-ice debugger where my code was disabling the debug port and thus having connectivity error. You probably have to erase the memory chip so the debug port is enabled again, but what output are you getting from Jlink.exe? Can anyone confirm with me?
  • Hi,

    I agree to euphoricnoise. Would be interesting to see what the output of J-Link Commander (JLink.exe) is.


    Best regards
    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.
  • Thanks for the replys

    The problem has been "fixed"

    I set up a new installation of Atmel Studio on a machine that never had any tools installed and ran the project all over again. The results were exactly the same. Different machine, same result. problem tracks hardware.

    A co-worker of mine walked by and offered to try it on his machine with code he had written for another project, the project loaded and executed

    When I went back to my desk and tried the original project again, it worked and has been working ever since

    Puzzling

    Thanks again
  • Hi,

    Good to hear that it is working now.
    Anyhow, does not really sound good that it is working "out of the sudden"...
    Would be good to understand where the problem came from, to make sure that it is not hardware related and does not show up again.


    - 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.