[SOLVED] Problem Flashing MK20DN512XXX10

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

  • [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. J-Link>connect
    2. Device "MK20DN512XXX10" selected.
    3. Connecting to target via SWD
    4. InitTarget()
    5. Found SW-DP with ID 0x2BA01477
    6. AP map detection skipped. User manually configured AP map.
    7. AP[0]: AHB-AP (IDR: Not set)
    8. AP[0]: Core found
    9. AP[0]: AHB-AP ROM base: 0xE00FF000
    10. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    11. Found Cortex-M4 r0p1, Little endian.
    12. FPUnit: 6 code (BP) slots and 2 literal slots
    13. CoreSight components:
    14. ROMTbl[0] @ E00FF000
    15. ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
    16. ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    17. ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    18. ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    19. ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    20. ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    21. ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
    22. ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
    23. Cortex-M4 identified.
    24. J-Link>r
    25. Reset delay: 0 ms
    26. Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    27. Reset: Halt core after reset via DEMCR.VC_CORERESET.
    28. Reset: Reset device via AIRCR.SYSRESETREQ.
    29. AfterResetTarget()
    30. J-Link>loadfile C:/tmc6130.hex
    31. Downloading file [C:/tmc6130.hex]...
    32. ****** Error: Failed to prepare for programming.
    33. Could not preserve target memory.
    34. O.K.
    Display All
  • 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: segger.com/products/development-tools/embedded-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
    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.
  • 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. Downloading C:\TMC6130.hex to MK20DN512XXX10 via SWD-Interface@1000kHz
    2. Programming Thread started.
    3. Device "MK20DN512XXX10" selected.
    4. InitTarget()
    5. Found SW-DP with ID 0x2BA01477
    6. Scanning AP map to find all available APs
    7. AP[2]: Stopped AP scan as end of AP map has been reached
    8. AP[0]: AHB-AP (IDR: 0x24770011)
    9. AP[1]: JTAG-AP (IDR: 0x001C0000)
    10. Iterating through AP map to find AHB-AP to use
    11. AP[0]: Core found
    12. AP[0]: AHB-AP ROM base: 0xE00FF000
    13. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    14. Found Cortex-M4 r0p1, Little endian.
    15. FPUnit: 6 code (BP) slots and 2 literal slots
    16. CoreSight components:
    17. ROMTbl[0] @ E00FF000
    18. ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
    19. ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    20. ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    21. ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    22. ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    23. ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    24. ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
    25. ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
    26. Debugger initialized successfully.
    27. Reset: Halt core after reset via DEMCR.VC_CORERESET.
    28. Reset: Reset device via AIRCR.SYSRESETREQ.
    29. AfterResetTarget()
    30. Failed to download RAMCode.
    31. Failed to prepare for programming.
    32. Failed to download RAMCode!
    33. Programming Thread exited
    34. Programming failed.
    Display All
    Files
    • TMC6130.zip

      (50.06 kB, downloaded 316 times, last: )
  • Hi Jan,

    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
    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.
  • Those are exelent suggestions but...

    SEGGER - Nino wrote:

    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.

    SEGGER - Nino wrote:

    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. J-Link>loadfile C:/tmcmtest.hex
    2. Downloading file [C:/tmcmtest.hex]...
    3. ****** Error: Failed to download RAMCode.
    4. Failed to prepare for programming.
    5. Failed to download RAMCode!
    6. Unspecified error -1


    Its named "BLMagic" in the elf, could be anything.

    SEGGER - Nino wrote:

    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?
    Files
    • TMCMtest.zip

      (30.14 kB, downloaded 267 times, last: )
  • 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: wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File

    Best regards,
    Nino
    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 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. SEGGER J-Link Commander V6.20 (Compiled Sep 8 2017 18:05:11)
    2. DLL version V6.20, compiled Sep 8 2017 18:04:35
    3. Connecting to J-Link via USB...O.K.
    4. Firmware: J-Link V10 compiled Sep 8 2017 17:24:33
    5. Hardware version: V10.10
    6. S/N: 260105131
    7. License(s): FlashBP, GDB
    8. OEM: SEGGER-EDU
    9. VTref = 2.947V
    10. Type "connect" to establish a target connection, '?' for help
    11. J-Link>log C:\Users\jan\Desktop\segger2.log
    12. J-Link>connect
    13. Please specify device / core. <Default>: MK20DN512XXX10
    14. Type '?' for selection dialog
    15. Device>
    16. Please specify target interface:
    17. J) JTAG (Default)
    18. S) SWD
    19. TIF>s
    20. Specify target interface speed [kHz]. <Default>: 4000 kHz
    21. Speed>
    22. Device "MK20DN512XXX10" selected.
    23. Connecting to target via SWD
    24. InitTarget()
    25. Found SW-DP with ID 0x2BA01477
    26. Scanning AP map to find all available APs
    27. AP[2]: Stopped AP scan as end of AP map has been reached
    28. AP[0]: AHB-AP (IDR: 0x24770011)
    29. AP[1]: JTAG-AP (IDR: 0x001C0000)
    30. Iterating through AP map to find AHB-AP to use
    31. AP[0]: Core found
    32. AP[0]: AHB-AP ROM base: 0xE00FF000
    33. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    34. Found Cortex-M4 r0p1, Little endian.
    35. FPUnit: 6 code (BP) slots and 2 literal slots
    36. CoreSight components:
    37. ROMTbl[0] @ E00FF000
    38. ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
    39. ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    40. ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    41. ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    42. ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    43. ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    44. ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
    45. ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
    46. Cortex-M4 identified.
    47. J-Link>loadfile C:\tmcmtest.hex
    48. Downloading file [C:\tmcmtest.hex]...
    49. ****** Error: Failed to download RAMCode.
    50. Failed to prepare for programming.
    51. Failed to download RAMCode!
    52. Unspecified error -1
    Display All


    LogFile

    Brainfuck Source Code

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

    unfortunatly that did not help either.

    Source Code

    1. SEGGER J-Link Commander V6.20h (Compiled Oct 27 2017 16:23:22)
    2. DLL version V6.20h, compiled Oct 27 2017 16:22:47
    3. Connecting to J-Link via USB...O.K.
    4. Firmware: J-Link V10 compiled Oct 6 2017 16:37:55
    5. Hardware version: V10.10
    6. S/N: 260105131
    7. License(s): FlashBP, GDB
    8. OEM: SEGGER-EDU
    9. VTref = 2.941V
    10. Type "connect" to establish a target connection, '?' for help
    11. J-Link>log C:\Users\jan\Desktop\segger620h.log
    12. J-Link>connect
    13. Please specify device / core. <Default>: MK20DN512XXX10
    14. Type '?' for selection dialog
    15. Device>
    16. Please specify target interface:
    17. J) JTAG (Default)
    18. S) SWD
    19. TIF>s
    20. Specify target interface speed [kHz]. <Default>: 4000 kHz
    21. Speed>
    22. Device "MK20DN512XXX10" selected.
    23. Connecting to target via SWD
    24. InitTarget()
    25. Found SW-DP with ID 0x2BA01477
    26. Scanning AP map to find all available APs
    27. AP[2]: Stopped AP scan as end of AP map has been reached
    28. AP[0]: AHB-AP (IDR: 0x24770011)
    29. AP[1]: JTAG-AP (IDR: 0x001C0000)
    30. Iterating through AP map to find AHB-AP to use
    31. AP[0]: Core found
    32. AP[0]: AHB-AP ROM base: 0xE00FF000
    33. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    34. Found Cortex-M4 r0p1, Little endian.
    35. FPUnit: 6 code (BP) slots and 2 literal slots
    36. CoreSight components:
    37. ROMTbl[0] @ E00FF000
    38. ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB000 SCS
    39. ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    40. ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    41. ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    42. ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    43. ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    44. ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
    45. ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
    46. Cortex-M4 identified.
    47. J-Link>loadfile C:\tmcmtest.hex
    48. Downloading file [C:\tmcmtest.hex]...
    49. ****** Error: Failed to download RAMCode.
    50. Failed to prepare for programming.
    51. Failed to download RAMCode!
    52. Unspecified error -1
    Display All


    Brainfuck Source Code

    1. T0514 040:623 SEGGER J-Link V6.20h Log File (0001ms, 0029ms total)
    2. T0514 040:623 DLL Compiled: Oct 27 2017 16:22:47 (0001ms, 0029ms total)
    3. T0514 040:623 Logging started @ 2017-11-15 20:11 (0001ms, 0029ms total)
    4. 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)
    5. T0514 047:703 JLINK_DEVICE_GetInfo(DeviceIndex = 2744) returns 0 (0000ms, 0241ms total)
    6. T0514 050:389 JLINK_ExecCommand("device=MK20DN512XXX10", ...). Device "MK20DN512XXX10" selected. returns 0x00 (0009ms, 0250ms total)
    7. T0514 050:398 JLINK_SetSpeed(4000) (0000ms, 0250ms total)
    8. T0514 050:398 JLINK_EnableLog(...) (0000ms, 0250ms total)
    9. T0514 050:398 JLINK_GetEmuCaps() returns 0xB9FF7BBF (0000ms, 0250ms total)
    10. T0514 050:398 JLINK_TIF_GetAvailable(...) (0001ms, 0251ms total)
    11. T0514 050:399 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0001ms, 0252ms total)
    12. 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>
    13. 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>
    14. >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)
    15. -- 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)
    16. 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
    17. -- 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)
    18. 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)
    19. T0514 050:729 JLINK_GetMemZones(...) returns 0 (0000ms, 0580ms total)
    20. T0514 050:729 JLINK_CORE_GetFound() returns 0xE0000FF (0000ms, 0580ms total)
    21. T0514 061:571 JLINK_IsHalted() returns TRUE (0002ms, 0582ms total)
    22. T0514 061:574 JLINK_DownloadFile()JLINK_BeginDownload(Flags = 0x00) (0010ms, 0590ms total)
    23. 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)
    24. 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)
    25. 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
    26. ***** Error: Failed to download RAMCode.
    27. ***** Error: Failed to prepare for programming.
    28. Failed to download RAMCode!
    29. -- End of preparing flash programming returns 0xFFFFFFFF (0015ms, 0595ms total)
    30. T0514 061:574 returns 0xFFFFFFFF (0015ms, 0595ms total)
    Display All
  • 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? 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
    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 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 ;)
  • Hi Jan,

    alright mystery solved :)

    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
    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.