Saturday, December 16th 2017, 4:32am UTC+1

You are not logged in.

  • Login
  • Register

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

1

Wednesday, November 15th 2017, 1:46pm

[SOLVED] Problem Flashing MK20DN512XXX10

Hello,

this is my first ARM Project so i might be a bit stupid here, bare with me plz ;)

After i connect to the device via SWD everything looks OK but as soon as i start programming i get this error "Could not preserve target memory.".

What does it mean?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
J-Link>connect
Device "MK20DN512XXX10" selected.


Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
AP map detection skipped. User manually configured AP map.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
Cortex-M4 identified.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
AfterResetTarget()
J-Link>loadfile C:/tmc6130.hex
Downloading file [C:/tmc6130.hex]...

****** Error: Failed to prepare for programming.
Could not preserve target memory.
O.K.

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

2

Wednesday, November 15th 2017, 2:12pm

Hello Jan,

Thank you for your inquiry.
Such a behaviour is not known to us.
Is your application overwriting flash areas 0x400-0x4ff by any chance? In that area the devices flash lock bits are stored so when you write your application over it it could lock your device.
Make sure to skip that flash part in your application.
Could you provide us with the .hex file you are trying to program?
For creating new applications we suggest using Embedded Studio: https://www.segger.com/products/developm…mbedded-studio/

Here you have the benefit that we deliver CPU support packages for several MCU families (also for NXP MK20 family) so whatever application you base on the in Embedded Studio provided example projects will take care of the placement of that "problematic" flash area automatically.

Best regards,
Nino

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

3

Wednesday, November 15th 2017, 2:26pm

Hello,

its a Fie thats not compiled by me, but was working on an Eval board ( befor i bricked it ;) ).
But I have the source and build env. , it uses gcc and a linker script from NXP to place the stuff.
A quick look at the hex did not show proplematic code placment, and the programming doesnt even start so i dont think thats the problem.

But i just rememered that j-link lite gives a diffrent error so i attach that log.

The error sounds simular its

"Failed to download RAMCode."

Its the first time i program that board, can it be that the CPU is not running in the right mode but the Debug stuff is working independetly?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Downloading C:\TMC6130.hex to MK20DN512XXX10 via SWD-Interface@1000kHz 
Programming Thread started.
Device "MK20DN512XXX10" selected.
InitTarget()
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
Debugger initialized successfully.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
AfterResetTarget()
Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Programming Thread exited 
Programming failed.
JanWH has attached the following file:
  • TMC6130.zip (50.06 kB - 16 times downloaded - Last download: Today, 1:13am)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

4

Wednesday, November 15th 2017, 2:49pm

Hi Jan,

Quoted

But I have the source and build env. , it uses gcc and a linker script from NXP to place the stuff.
A quick look at the hex did not show proplematic code placment, and the programming doesnt even start so i dont think thats the problem.


Looking at your hex there are two things that were quite odd to me.
1. The application starts at 0x8000 instead of 0x0. Was there a particular reason for skipping the first 32 kB of Flash?
2. At the end of the hex file there is a weird write to 0x1FFF0000. Why are there zeroes placed in the middle of lower SRAM?

The Problem here is, that the hex image contains information that is out of Flash range (point 2). Now the flash algo checks if everything is inside the Flash bounds and aborts if not.
This is the case here.

So make sure the image you are flashing is inside Flash bounds and you are good to go.
For easy hex file analysis you can user our J-Flash tool and load up the there for investigation.

Best regards,
Nino

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

5

Wednesday, November 15th 2017, 3:45pm

Those are exelent suggestions but...
1. The application starts at 0x8000 instead of 0x0. Was there a particular reason for skipping the first 32 kB of Flash
Yes it looks like the itend is to write into an external EEPORM. The "why" i dont know but should not be a problem. I moved it down but that did not help.
2. At the end of the hex file there is a weird write to 0x1FFF0000. Why are there zeroes placed in the middle of lower SRAM?
That thing did worry me,too. I removed it from the .hex file by hand just for testing but that did not help. I get the same error as in j-link flash now in J-Link commander.

Source code

1
2
3
4
5
6
7
J-Link>loadfile C:/tmcmtest.hex
Downloading file [C:/tmcmtest.hex]...

****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Unspecified error -1


Its named "BLMagic" in the elf, could be anything.
For easy hex file analysis you can user our J-Flash tool and load up the there for investigation.
Thx i used it to verify my edit of the .hex file. So this should be a valid hexfile now from the ranges and placing and size?
JanWH has attached the following file:
  • TMCMtest.zip (30.14 kB - 16 times downloaded - Last download: Dec 8th 2017, 2:58am)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

6

Wednesday, November 15th 2017, 4:09pm

Hi Jan,

I just tried to load the hex file you provided on an eval board and had no issues whatsoever.
What eval board were you using?
Which J-Link Software version are you using?
Could you create an example project with Embedded Studio and see if that application runs?
Could you provide us with a J-Link log file for the case where the download fails?
More information about how to enable the log file can be found here: https://wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File

Best regards,
Nino

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

7

Wednesday, November 15th 2017, 5:00pm

Hi Nino,

its not an eval board as i turned it into a brick yesterday (see other thread ;) )

Its a board we made thats basicly a copy of it (Link) so it could be a hardware fault. But both Prototypes show the same errors so its unlikely.

I attached a full Console and Logfile run of "connect" and "loadfile" of the edited hex i attached.

Its not so much that it needs to run, it would be nice if it could be written to the device. I should be able to go from there.

Console

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SEGGER J-Link Commander V6.20 (Compiled Sep  8 2017 18:05:11)
DLL version V6.20, compiled Sep  8 2017 18:04:35

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Sep  8 2017 17:24:33
Hardware version: V10.10
S/N: 260105131
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref = 2.947V


Type "connect" to establish a target connection, '?' for help
J-Link>log C:\Users\jan\Desktop\segger2.log
J-Link>connect
Please specify device / core. <Default>: MK20DN512XXX10
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
TIF>s
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "MK20DN512XXX10" selected.


Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
Cortex-M4 identified.
J-Link>loadfile C:\tmcmtest.hex
Downloading file [C:\tmcmtest.hex]...

****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Unspecified error -1


LogFile

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
T1CEC 015:726 SEGGER J-Link V6.20 Log File (0002ms, 0065ms total)
T1CEC 015:726 DLL Compiled: Sep  8 2017 18:04:35 (0002ms, 0065ms total)
T1CEC 015:726 Logging started @ 2017-11-15 16:49 (0002ms, 0065ms total)
T1CEC
 020:521 JLINK_Api_MRU_GetList()JLINK_DEVICE_GetIndex(sDeviceName = 
MK20DN512XXX10)C:\Program Files (x86)\SEGGER\JLink_V620\JLinkDevices.xml
 evaluated successfully.  returns 2741 (0220ms, 0290ms total)
T1CEC 022:563 JLINK_DEVICE_GetInfo(DeviceIndex = 2741)  returns 0 (0000ms, 0290ms total)
T1CEC
 026:834 JLINK_ExecCommand("device=MK20DN512XXX10", ...). Device 
"MK20DN512XXX10" selected.  returns 0x00 (0007ms, 0297ms total)
T1CEC 026:841 JLINK_SetSpeed(4000) (0000ms, 0297ms total)
T1CEC 026:841 JLINK_EnableLog(...) (0001ms, 0298ms total)
T1CEC 026:842 JLINK_GetEmuCaps()  returns 0xB9FF7BBF (0000ms, 0298ms total)
T1CEC 026:842 JLINK_TIF_GetAvailable(...) (0001ms, 0299ms total)
T1CEC 026:843 JLINK_TIF_Select(JLINKARM_TIF_SWD)  returns 0x00 (0001ms, 0300ms total)
T1CEC
 026:844 JLINK_Connect()InitTarget() >0x10B TIF>Found SW-DP with 
ID 0x2BA01477 >0x0D TIF> >0x28 TIF> >0x0D TIF> 
>0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> 
>0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> 
>0x28 TIF>Scanning AP map to find all available APs >0x0D 
TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D 
TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D 
TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D 
TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D 
TIF> >0x21 TIF>
AP[2]: Stopped AP scan as end of AP map has 
been reachedAP[0]: AHB-AP (IDR: 0x24770011)AP[1]: JTAG-AP (IDR: 
0x001C0000)Iterating through AP map to find AHB-AP to use >0x42 
TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D 
TIF> >0x21 TIF> >0x42 TIF> >0x28 TIF> >0x0D 
TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D 
TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>AP[0]: Core 
foundAP[0]: AHB-AP ROM base: 0xE00FF000 >0x0D TIF> >0x28 
TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 
TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 
TIF>
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)Found
 Cortex-M4 r0p1, Little endian. -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- 
CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal
 slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_WriteMem(4 bytes @ 
0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes
 @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE000ED88) -- CPU_WriteMem(4 
bytes @ 0xE000ED88) -- CPU_ReadMem(4 bytes @ 0xE000ED88)
 -- 
CPU_WriteMem(4 bytes @ 0xE000ED88)CoreSight components:ROMTbl[0] @ 
E00FF000 -- CPU_ReadMem(16 bytes @ 0xE00FF000) -- CPU_ReadMem(16 bytes @
 0xE000EFF0) -- CPU_ReadMem(16 bytes @ 0xE000EFE0)ROMTbl[0][0]: 
E000E000, CID: B105E00D, PID: 000BB000 SCS -- CPU_ReadMem(16 bytes @ 
0xE0001FF0) -- CPU_ReadMem(16 bytes @ 0xE0001FE0)ROMTbl[0][1]: E0001000,
 CID: B105E00D, PID: 003BB002 DWT -- CPU_ReadMem(16 bytes @ 0xE0002FF0) 
-- CPU_ReadMem(16 bytes @ 0xE0002FE0)
ROMTbl[0][2]: E0002000, CID: 
B105E00D, PID: 002BB003 FPB -- CPU_ReadMem(16 bytes @ 0xE0000FF0) -- 
CPU_ReadMem(16 bytes @ 0xE0000FE0)ROMTbl[0][3]: E0000000, CID: B105E00D,
 PID: 003BB001 ITM -- CPU_ReadMem(16 bytes @ 0xE00FF010) -- 
CPU_ReadMem(16 bytes @ 0xE0040FF0) -- CPU_ReadMem(16 bytes @ 
0xE0040FE0)ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU -- 
CPU_ReadMem(16 bytes @ 0xE0041FF0) -- CPU_ReadMem(16 bytes @ 
0xE0041FE0)ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
 --
 CPU_ReadMem(16 bytes @ 0xE0042FF0) -- CPU_ReadMem(16 bytes @ 
0xE0042FE0)ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB -- 
CPU_ReadMem(16 bytes @ 0xE0043FF0) -- CPU_ReadMem(16 bytes @ 
0xE0043FE0)ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF -- 
CPU_ReadMem(16 bytes @ 0xE00FF020)  returns 0x00 (0335ms, 0635ms total)
T1CEC
 027:180 JLINK_GetIdData(...) >0x0D TIF> >0x21 TIF> 
ScanLen=4 NumDevices=1 aId[0]=0x2BA01477 aIrRead[0]=0 aScanLen[0]=0 
aScanRead[0]=0 (0000ms, 0635ms total)
T1CEC 027:181 JLINK_GetMemZones(...)  returns 0 (0000ms, 0635ms total)
T1CEC 027:181 JLINK_CORE_GetFound()  returns 0xE0000FF (0000ms, 0635ms total)
T1CEC 047:719 JLINK_IsHalted()  returns TRUE (0003ms, 0638ms total)
T1CEC 047:722 JLINK_DownloadFile()JLINK_BeginDownload(Flags = 0x00) (0010ms, 0645ms total)
T1CEC
 047:722 JLINK_WriteMem(0x00000000, 0x01E0 Bytes, ...) - Data: 00 00 01 
20 C1 07 00 00 69 05 00 00 7D 05 00 00 ...  returns 0x1E0 (0011ms, 
0646ms total)
T1CEC 047:722 JLINK_WriteMem(0x00000400, 0x6CE4 Bytes, 
...) - Data: FF FF FF FF FF FF FF FF FF FF FF FF 7E FF FF FF ...  
returns 0x6CE4 (0011ms, 0646ms total)
T1CEC 047:722 
JLINK_EndDownload() -- CPU_ReadMem(4 bytes @ 0xE000ED90) -- 
-------------------------------------- -- Start of determining dirty 
areas in flash cache -- End of determining dirty areas -- Start of 
preparing flash programming -- Calculating RAM usage -- RAM usage = 4060
 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing 
target -- Downloading RAMCode
  ***** Error: Failed to download RAMCode.
  ***** Error: Failed to prepare for programming.
Failed to download RAMCode!
 -- End of preparing flash programming  returns 0xFFFFFFFF (0016ms, 0651ms total)
T1CEC 047:722   returns 0xFFFFFFFF (0016ms, 0651ms total)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

8

Wednesday, November 15th 2017, 5:08pm

Hi Jan,

I see that you are using Version V6.20. The latest available software version is V6.20h (that is the one i did the testing with).
Could you update to the latest version and see if the issue resolves?
If not could you post a log file of the latest J-Link software version?

Best regards,
Nino

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

9

Wednesday, November 15th 2017, 8:14pm

Hi,

unfortunatly that did not help either.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SEGGER J-Link Commander V6.20h (Compiled Oct 27 2017 16:23:22)
DLL version V6.20h, compiled Oct 27 2017 16:22:47

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Oct  6 2017 16:37:55
Hardware version: V10.10
S/N: 260105131
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref = 2.941V


Type "connect" to establish a target connection, '?' for help
J-Link>log C:\Users\jan\Desktop\segger620h.log
J-Link>connect
Please specify device / core. <Default>: MK20DN512XXX10
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
TIF>s
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "MK20DN512XXX10" selected.


Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
Cortex-M4 identified.
J-Link>loadfile C:\tmcmtest.hex
Downloading file [C:\tmcmtest.hex]...

****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Unspecified error -1


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
T0514 040:623 SEGGER J-Link V6.20h Log File (0001ms, 0029ms total)
T0514 040:623 DLL Compiled: Oct 27 2017 16:22:47 (0001ms, 0029ms total)
T0514 040:623 Logging started @ 2017-11-15 20:11 (0001ms, 0029ms total)
T0514 046:205 JLINK_Api_MRU_GetList()JLINK_DEVICE_GetIndex(sDeviceName = MK20DN512XXX10)C:\Program Files (x86)\SEGGER\JLink_V620h\JLinkDevices.xml evaluated successfully.  returns 2744 (0210ms, 0241ms total)
T0514 047:703 JLINK_DEVICE_GetInfo(DeviceIndex = 2744)  returns 0 (0000ms, 0241ms total)
T0514 050:389 JLINK_ExecCommand("device=MK20DN512XXX10", ...). Device "MK20DN512XXX10" selected.  returns 0x00 (0009ms, 0250ms total)
T0514 050:398 JLINK_SetSpeed(4000) (0000ms, 0250ms total)
T0514 050:398 JLINK_EnableLog(...) (0000ms, 0250ms total)
T0514 050:398 JLINK_GetEmuCaps()  returns 0xB9FF7BBF (0000ms, 0250ms total)
T0514 050:398 JLINK_TIF_GetAvailable(...) (0001ms, 0251ms total)
T0514 050:399 JLINK_TIF_Select(JLINKARM_TIF_SWD)  returns 0x00 (0001ms, 0252ms total)
T0514 050:401 JLINK_Connect()InitTarget() >0x10B TIF>Found SW-DP with ID 0x2BA01477 >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF>Scanning AP map to find all available APs >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>
AP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011)AP[1]: JTAG-AP (IDR: 0x001C0000)Iterating through AP map to find AHB-AP to use >0x42 TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x42 TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>AP[0]: Core foundAP[0]: AHB-AP ROM base: 0xE00FF000 >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF>
 >0x0D TIF> >0x21 TIF>CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)Found Cortex-M4 r0p1, Little endian. -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_WriteMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE000ED88) -- CPU_WriteMem(4 bytes @ 0xE000ED88) -- CPU_ReadMem(4 bytes @ 0xE000ED88)
 -- CPU_WriteMem(4 bytes @ 0xE000ED88)CoreSight components:ROMTbl[0] @ E00FF000 -- CPU_ReadMem(16 bytes @ 0xE00FF000) -- CPU_ReadMem(16 bytes @ 0xE000EFF0) -- CPU_ReadMem(16 bytes @ 0xE000EFE0)ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS -- CPU_ReadMem(16 bytes @ 0xE0001FF0) -- CPU_ReadMem(16 bytes @ 0xE0001FE0)ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT -- CPU_ReadMem(16 bytes @ 0xE0002FF0) -- CPU_ReadMem(16 bytes @ 0xE0002FE0)
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB -- CPU_ReadMem(16 bytes @ 0xE0000FF0) -- CPU_ReadMem(16 bytes @ 0xE0000FE0)ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM -- CPU_ReadMem(16 bytes @ 0xE00FF010) -- CPU_ReadMem(16 bytes @ 0xE0040FF0) -- CPU_ReadMem(16 bytes @ 0xE0040FE0)ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU -- CPU_ReadMem(16 bytes @ 0xE0041FF0) -- CPU_ReadMem(16 bytes @ 0xE0041FE0)ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
 -- CPU_ReadMem(16 bytes @ 0xE0042FF0) -- CPU_ReadMem(16 bytes @ 0xE0042FE0)ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB -- CPU_ReadMem(16 bytes @ 0xE0043FF0) -- CPU_ReadMem(16 bytes @ 0xE0043FE0)ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF -- CPU_ReadMem(16 bytes @ 0xE00FF020)  returns 0x00 (0327ms, 0579ms total)
T0514 050:728 JLINK_GetIdData(...) >0x0D TIF> >0x21 TIF> ScanLen=4 NumDevices=1 aId[0]=0x2BA01477 aIrRead[0]=0 aScanLen[0]=0 aScanRead[0]=0 (0001ms, 0580ms total)
T0514 050:729 JLINK_GetMemZones(...)  returns 0 (0000ms, 0580ms total)
T0514 050:729 JLINK_CORE_GetFound()  returns 0xE0000FF (0000ms, 0580ms total)
T0514 061:571 JLINK_IsHalted()  returns TRUE (0002ms, 0582ms total)
T0514 061:574 JLINK_DownloadFile()JLINK_BeginDownload(Flags = 0x00) (0010ms, 0590ms total)
T0514 061:574 JLINK_WriteMem(0x00000000, 0x01E0 Bytes, ...) - Data: 00 00 01 20 C1 07 00 00 69 05 00 00 7D 05 00 00 ...  returns 0x1E0 (0011ms, 0591ms total)
T0514 061:574 JLINK_WriteMem(0x00000400, 0x6CE4 Bytes, ...) - Data: FF FF FF FF FF FF FF FF FF FF FF FF 7E FF FF FF ...  returns 0x6CE4 (0011ms, 0591ms total)
T0514 061:574 JLINK_EndDownload() -- CPU_ReadMem(4 bytes @ 0xE000ED90) -- -------------------------------------- -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 4060 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Downloading RAMCode
  ***** Error: Failed to download RAMCode.
  ***** Error: Failed to prepare for programming.
Failed to download RAMCode!
 -- End of preparing flash programming  returns 0xFFFFFFFF (0015ms, 0595ms total)
T0514 061:574   returns 0xFFFFFFFF (0015ms, 0595ms total)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

10

Thursday, November 16th 2017, 9:03am

Hi Jan,

Ok at least we know now that it still happens with the latest version.
Unfortunately I was not able to reproduce the issue on the MK20D boards that we have available in our company and without a reproduction scenario it is near to impossible to find the cause for the issue.
All hex files you provided (except the one that wrote into RAM) I was able to program without any issues.

One thing i noticed is that your target reference voltage is under 3V. On all MK20 boards available to us it is 3.3 V.
This difference might already lead to a malfunction of the memory controller of the MCU.
Is that supply voltage expected on that board or is it to low?
Check the boards user manual if there are any suggestions about power delivery to the core.

For sanity check could you try to create a project with Embedded Studio? https://www.segger.com/downloads/embedded-studio/

There install the MK20 support package with the Package Manager.
How to create a new project is described here.
Now you should have a simple "Hello World" project for the MK20.

Are you able to program that application?

Make sure to select the correct MCU.
According to the schematics of the eval board you linked it is equipped with a MK20DX256VLL10.

Best regards,
Nino

JanWH

Beginner

Date of registration: Nov 15th 2017

Posts: 10

11

Thursday, November 16th 2017, 10:38am

Hi Nino and BIG THX

its wasnt the Voltage but youre right its the wrong Processor ... im feeling so stupid right now. Well there goes one week of troubleshooting.

If there is a way to get you a coffee or something let me know ;)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 467

12

Thursday, November 16th 2017, 10:48am

Hi Jan,

alright mystery solved :)

Quoted

If there is a way to get you a coffee or something let me know

Should we meet on one of the fairs we attend I might come back to that offer ;)

I will consider this case as solved then.

Best regards,
Nino