J-Link can't unlock Kinetis K40

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

  • J-Link can't unlock Kinetis K40

    We are working on project using IAR 6.4 + J-Link V5.4, and found the following issues:

    1- When connecting a brand new K40 processor (MK40DN512ZVLL10), a message in IAR comes up warning that the processor is locked, and asking if we want to unlock the device. If we choose to unlock the device, we can continue to work without any problems or further warnings.


    2- Because some mishaps, we needed to unlock several of the K40 (same P/N as above) using J-Link Commander, to no avail. Then (for testing) we tried to unlock/mass erase several devices that we were debugging (so they were already unlocked) without any luck, then we tried to unlock/mass erase brand new devices, again we couldn't. J-Link always gives the same message;"
    ERROR: Could not write Ctrl/Stat register.Unlocking device...ERROR: Read from DP

    /AP register failed!".
    The strange thing is that we can debug, read flash memory etc. using J-Link commander and IAR, however it can't mass erase the processors' flash memory.

    Here is what we are getting:

    J-Link>usb
    Connecting to J-Link via USB (Port: 0)
    DLL version V4.50m, compiled Jul 20 2012 19:39:26
    Firmware: J-Link compiled Jul 30 2008 11:24:37 ARM Rev.5
    Hardware: V5.40
    S/N: XXXXXXXX
    VTarget = 3.293V
    Info: TotalIRLen = 4, IRPrint = 0x01
    Info: Found Cortex-M4 r0p0, Little endian.
    Info: TPIU fitted.
    Info: ETM fitted.
    Info: ETB present.
    Info: CSTF present.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Found 1 JTAG device, Total IRLen = 4:
    #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    Cortex-M4 identified.
    JTAG speed: 100 kHz

    J-Link>st
    VTarget=3.293V
    ITarget=0mA
    TCK=1 TDI=0 TDO=1 TMS=0 TRES=1 TRST=1
    Supported JTAG speeds:
    - 48 MHz/n, (n>=4). => 12000kHz, 9600kHz, 8000kHz, ...
    - Adaptive clocking

    J-Link>device ?
    Info: Device "MK40DN512XXX10" selected (512 KB flash, 128 KB RAM).
    Reconnecting to target...
    Info: TotalIRLen = 4, IRPrint = 0x01
    Info: Found Cortex-M4 r0p0, Little endian.
    Info: TPIU fitted.
    Info: ETM fitted.
    Info: ETB present.
    Info: CSTF present.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    J-Link>unlock Kinetis
    ERROR: Could not write Ctrl/Stat register.Unlocking device...ERROR: Read from DP
    /AP register failed!
    J-Link>

    Thanks!

    Danielf
  • Hello Danielf,

    We are not aware of any problems regarding the unlock command.
    We will give it a try 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.