Kinetis does not connect/flash with SWD

  • Kinetis does not connect/flash with SWD

    Hi

    Using:
    CodeWarrior (CW) 10.4
    Jlink EDU
    Kinetis K20 Custom board with 1uF at the reset pin

    So, in the "bare-board" project of CW, J-Link is natively supported. Without any other logic, just compiled and trying to flash the *.elf file, but the receiving this error.
    Downloading Flash Device Driver ...
    Error: Couldn't write flash driver to target. ARM GDI Protocol Adapter : An error occurred while trying to write memory. The Debugger can not write memory.
    An error occurred while trying to write memory. The Debugger can not write memory.(ARM GDI Protocol Adapter)


    With J-Link commander(attached), it seems it identifies the device, but the "LED" in JLink HW blinks with Green and Red alternatively. It seems there is an error, but not sure what it is.

    I do not have any Osci.


    With Keil and JLink:

    JLink info:
    ------------
    DLL: V4.76 , compiled Aug 23 2013 20:59:10
    Firmware: J-Link ARM V8 compiled Jul 17 2013 11:24:15
    Hardware: V8.00
    S/N : 268005691
    OEM : SEGGER-EDU
    Feature(s) : FlashBP, GDB

    * JLink Info: Found SWD-DP with ID 0x2BA01477
    * JLink Info: Found SWD-DP with ID 0x2BA01477
    * JLink Info: Found Cortex-M4 r0p1, Little endian.
    * JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
    * JLink Info: TPIU fitted.
    * JLink Info: ETM fitted.
    * JLink Info: ETB present.
    * JLink Info: CSTF present.
    Found SWD-DP with ID 0x2BA01477
    Unlocking device...
    ROMTableAddr = 0xE00FF003

    -----> and then Pop up shows "unknown error"


    Could you please help me in fixing this issue?

    Thank you in advance,

    Regards
    Balaji
    Images
    • JLink_error.png

      71.12 kB, 654×347, viewed 1,375 times

    The post was edited 1 time, last by balaji ().

  • Hi Balaji,

    Good to hear that uVision is now working correctly.

    With J-Link commander(attached), it seems it identifies the device, but the "LED" in JLink HW blinks with Green and Red alternatively. It seems there is an error, but not sure what it is.

    No, it is not. It is a "feature" (I would call it bug...) of the Kinetis CPU.
    The reset pin is also an output of the CPU. If the chip outputs LOW on nRESET, J-Link will turn on the red LED.
    Empty CPUs which do not have anything in flash will continuously run into illegal instruction traps which causes a reset.
    This is why you see the LED blinking.

    Regarding CW: Maybe the guys from Freescale are the correct ones to contact here.


    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.
  • Hi Alex,

    Thanks for the reply.

    CW issue: Its "stupid" me. I was not selecting "SWD" from the options,default was JTAG. It works now.
    Normally, I am able to flash a GPIO program and works correctly

    But, when I try a USB program, I get the following error:
    ---------------------------
    fl::target -lc "LC for Simple Flash"
    fl::target -b 0x20000000 0x8000
    fl::target -v off -l off
    cmdwin::fl::device -d "FTFL_PFlash256" -o "64Kx32x1" -a 0x0 0x3ffff
    cmdwin::fl::image -f " C:\....\freescale\USB_Tests\K20_CDC_New\FLASH\K20_CDC_New.elf" -t "Auto Detect" -re on -r 0x0 0x3ffff -oe off
    cmdwin::fl::erase image
    Beginning Operation ...
    -------------------------
    Auto-detection is successful.
    File is of type Elf Format.

    Image size is 0 bytes, nothing to erase.
    Nothing to erase. No sectors selected
    Performing target initialization ...
    Erase Command Succeeded.
    cmdwin::fl::write
    -------------------------
    Using restricted address range 0x00000000 to 0x0003FFFF
    Programming file C:\....\freescale\USB_Tests\K20_CDC_New\FLASH\K20_CDC_New.elf
    Auto-detection is successful.
    File is of type Elf Format.

    0 Bytes Programmed, Check Restricted Address Range
    Program Command Succeeded
    cmdwin::fl::device -d "FTFL_DFlash32S1" -o "8Kx32x1" -a 0x10000000 0x10007fff
    cmdwin::fl::image -f " C:\....\freescale\USB_Tests\K20_CDC_New\FLASH\K20_CDC_New.elf" -t "Auto Detect" -re on -r 0x10000000 0x10007fff -oe off
    cmdwin::fl::erase image
    -------------------------
    Auto-detection is successful.
    File is of type Elf Format.

    Image size is 0 bytes, nothing to erase.
    Nothing to erase. No sectors selected
    Erase Command Succeeded.
    cmdwin::fl::write
    -------------------------
    Using restricted address range 0x10000000 to 0x10007FFF
    Programming file C:\....\freescale\USB_Tests\K20_CDC_New\FLASH\K20_CDC_New.elf
    Auto-detection is successful.
    File is of type Elf Format.

    0 Bytes Programmed, Check Restricted Address Range
    Program Command Succeeded
    ---------------------------------------------------------------------------------------->>>>>

    I don't want to say, this is because of USB. It creates .elf, no warnings or errors, but does not flash. Why it says, Image Size is 0? I am flashing correctly from the flash project. Is there any solution to this?

    The post was edited 2 times, last by balaji ().

  • Hi,

    Again: This is probably something for which the CodeWarrior guys from Freescale should be able to help.
    Does not sound like a J-Link related problem.


    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.