MK20DX128 refusing to program?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MK20DX128 refusing to program?

Jump to solution
1,585 Views
joogoosa
Contributor I

Hi, we're having this issue trying to program MK20 for OpenSDA;

After programming the reset pin is outputing pulses which according to various other posts here means the chip did not program correctly but the J-Flash Lite and J-Link Commander seem to report otherwise. 

Another think to poing out is that J-Flash lite wrote the message of the MCU being protected and that I needed to do a full chip erase which was the case every time I tried to program it.

Here's the schematic:

pastedImage_4.png

Here's the reset pin:

pastedImage_1.bmp

And here's the J-Link commander text:

SEGGER J-Link Commander V6.80b (Compiled Jun 5 2020 17:41:24)
DLL version V6.80b, compiled Jun 5 2020 17:40:22

Connecting to J-Link via USB...O.K.
Firmware: J-Link Lite-Cortex-M V8 compiled Sep 15 2016 12:05:01
Hardware version: V8.00
S/N: 518109715
License(s): GDB
VTref=3.313V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: MK20DX128XXX5
Type '?' for selection dialog
Device>MK20DX128XXX5
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>S
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>100
Device "MK20DX128XXX5" selected.


Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
Unknown DP version. Assuming DPv0
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
Cortex-M4 identified.
J-Link>unlock kinetis
Found SWD-DP with ID 0x2BA01477
Unlocking device...O.K.
J-Link>erase

**************************
WARNING: CPU could not be halted
**************************

Erasing device...

**************************
WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
**************************


****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
ERROR: Erase returned with error code -1.
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>erase
Erasing device...
J-Link: Flash download: Total time needed: 4.053s (Prepare: 1.254s, Compare: 0.000s, Erase: 1.991s, Program: 0.000s, Verify: 0.000s, Restore: 0.806s)
J-Link: Flash download: Total time needed: 2.082s (Prepare: 0.962s, Compare: 0.000s, Erase: 0.561s, Program: 0.000s, Verify: 0.000s, Restore: 0.558s)
Erasing done.
J-Link>loadbin C:\Users\xyz\Downloads\k20dx_mimxrt1020_evk_qspi_if_crc20180312.bin
Syntax: loadbin <filename>, <addr>
J-Link>loadbin C:\Users\xyz\Downloads\k20dx_mimxrt1020_evk_qspi_if_crc20180312.bin,0x0
Downloading file [C:\Users\xyz\Downloads\k20dx_mimxrt1020_evk_qspi_if_crc20180312.bin]...
J-Link: Flash download: Bank 0 @ 0x00000000: 2 ranges affected (65536 bytes)
J-Link: Flash download: Total: 11.138s (Prepare: 1.198s, Compare: 0.329s, Erase: 0.026s, Program & Verify: 8.780s, Restore: 0.803s)
J-Link: Flash download: Program & Verify speed: 7 KB/s
O.K.
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>g
J-Link>

0 Kudos
1 Solution
1,515 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello ,

Hope you are doing well.

From your log it looks to me that you are downloading the firmware on address 0. However, this is where the bootloader should be. You need to first download the first binary located on the OPENSDA page.

pastedImage_1.png

This will be in address 0. Once that is downloaded you will be able to drag and drop the firmware as described in the page as well, then consequently be able to work with your board. 

Best Regards,

Sabina

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------- 

View solution in original post

2 Replies
1,515 Views
joogoosa
Contributor I

THank you very much, that helped!

0 Kudos
1,516 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello ,

Hope you are doing well.

From your log it looks to me that you are downloading the firmware on address 0. However, this is where the bootloader should be. You need to first download the first binary located on the OPENSDA page.

pastedImage_1.png

This will be in address 0. Once that is downloaded you will be able to drag and drop the firmware as described in the page as well, then consequently be able to work with your board. 

Best Regards,

Sabina

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------