AnsweredAssumed Answered

How to unlock and mass erase MK20DX128 with Jlink?

Question asked by Chris Seto on Jul 2, 2019
Latest reply on Jul 2, 2019 by Kerry Zhou



I have a Jlink on Widnows, with JFlash.


How do I unlock and mass erase this chip? I don't see project files for it anywhere in JFlash.


Additionally, is there any way to interact with the chip using OpenOCd on Linux? I can flash the chip using the following instructions to patch OpenOCD, but none of the Kinetis commands work. Any idea why?


  • cd ~
  • git clone git:// openocd
  • cd openocd
  • git checkout bbdb820c82d65cd11abdc329eaa91d410690436e
  • git fetch refs/changes/08/1508/1 && git checkout FETCH_HEAD
  • ./bootstrap
  • ./configure --enable-jlink
  • make CFLAGS='-Wno-format-overflow'
  • sudo make install
  • /usr/local/bin/openocd -f ./openocd.cfg -c "program app-image.hex reset"

OpenOCD cfg:

source [find interface/jlink.cfg]
# Freescale Kinetis K20 device. Should be compatible with K40,
# just set a custom name.
set CHIPNAME k20
source [find target/k40.cfg]

adapter_khz 1000
reset_config srst_only

# Scratch RAM for verify
# XXX: This verify method is broken due to a problem with reset?
k20.cpu configure -work-area-phys 0x1FFFE000 -work-area-size 16384

# One 128K flash bank
flash bank pflash.0 kinetis 0x00000000 0x20000 0 4 $_TARGETNAME