Tuesday, January 23rd 2018, 2:52am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

charles

Beginner

Date of registration: Nov 5th 2014

Posts: 2

1

Thursday, November 6th 2014, 7:15pm

errors when flash programming kinetis mk20dx256xxx7

I have a j-link base which I would like to use to flash program the mk20dx256xxx7 via jlink.exe

I am running the following script:

device mk20dx256xxx7
unlock kinetis
erase
loadbin test.bin, 0x3e000
loadbin host_app.bin, 0x4000
loadbin lcs_bootloader.bin, 0

It works fine and programs the device if the device has not been preprogrammed previously. Programming the lcs_bootloader.bin results in the flash configuration field bytes be set to protect 2KB of flash starting at 0x3e000 (ie. it protects the test.bin that was programmed).

I power down the device and disconnect jlink, then connect the jlink and power up the device and then re execute the script. I get the error that could not erase sector 124 @ address 0x3e000. I'm not sure why this would be the case as I thought that the unlock and erase command would do a mass erase and would ignore any protected segments. Any help would be greatly appreciated. The following is the output of the jlink.exe when script is run:

C:\Program Files (x86)\SEGGER\JLink_V490e>jlink prog_lcs.jlk
SEGGER J-Link Commander V4.90e ('?' for help)
Compiled Sep 8 2014 18:46:42

Script file read successfully.
DLL version V4.90e, compiled Sep 8 2014 18:46:31
Firmware: J-Link V9 compiled Sep 5 2014 18:54:08
Hardware: V9.00
S/N: 59300400
Feature(s): GDB
VTarget = 3.277V
Info: TotalIRLen = 4, IRPrint = 0x01
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Found 1 JTAG device, Total IRLen = 4:
#0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
Cortex-M4 identified.
Target interface speed: 100 kHz
Processing script file...

Info: Device "MK20DX256XXX7" selected (288 KB flash, 64 KB RAM).
Reconnecting to target...
Info: TotalIRLen = 4, IRPrint = 0x01
Info: TotalIRLen = 4, IRPrint = 0x01
Info: Found Cortex-M4 r0p1, Little endian.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Info: TPIU fitted.
Info: ETM fitted.
Info: ETB present.
Info: CSTF present.

Found SWD-DP with ID 0x2BA01477
Unlocking device...O.K.

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

****** Error: Failed to erase sectors 124 @ address 0x0003E000 (Algo135: Flash p
rotection violation. Flash is write-protected.)
Info: J-Link: Flash download: Total time needed: 1.239s (Prepare: 0.311s, Compar
e: 0.000s, Erase: 0.899s, Program: 0.000s, Verify: 0.000s, Restore: 0.028s)
ERROR: Erase returned with error code -5.

Downloading file [test.bin]...
****** Error: Programming failed @ address 0x0003E000 (Algo135: Flash protection
violation. Flash is write-protected.)
Info: J-Link: Flash download: Total time needed: 1.692s (Prepare: 0.690s, Compar
e: 0.351s, Erase: 0.000s, Program: 0.263s, Verify: 0.000s, Restore: 0.386s)
Error while programming flash: Programming failed.

Downloading file [host_app.bin]...
****** Error: Programming failed @ address 0x0003E000 (Algo135: Flash protection
violation. Flash is write-protected.)
Info: J-Link: Flash download: Total time needed: 9.888s (Prepare: 0.690s, Compar
e: 0.284s, Erase: 0.000s, Program: 8.521s, Verify: 0.000s, Restore: 0.391s)
Error while programming flash: Programming failed.

Downloading file [lcs_bootloader.bin]...Info: J-Link: Flash download: Flash prog
ramming performed for 1 range (6144 bytes)
Info: J-Link: Flash download: Total time needed: 1.132s (Prepare: 0.475s, Compar
e: 0.006s, Erase: 0.000s, Program: 0.445s, Verify: 0.002s, Restore: 0.202s)
O.K.

Script processing completed.

J-Link>mem8 0x400,100
00000400 = FF FF FF FF FF FF FF FF FF FF FF 7F FE FF FF FF
00000410 = 00 02 00 00 72 B6 00 F0 43 FA 00 F0 37 FB 01 21
00000420 = 4B 20 00 F0 DF FB DF F8 D4 03 4F F4 80 71 01 60
00000430 = 00 21 4B 20 00 F0 F3 FB 00 F0 2C FD 00 F0 1D F8

This post has been edited 1 times, last edit by "charles" (Nov 6th 2014, 7:42pm)