After struggling a lot with FRDM-K64F to program our custom K63F-based board, I've given it up. Maybe it's not the goot approach. On a longer term we definitely need a reliable programmer, not a hacked PCB.
Now I'm using Segger's JLink Lite CortexM probe to burn the flash of FRDM-K64F and our K63F. While burning the flash of FRDM-K64F wasn't an issue at all (using SWD connector) with JLinkExe on linux, I used to face a lot of problems when wanted to flash our K63F. This chip was just shipped from the factory/distributor. A simple connection attempt with JLinkExe to the chip has resulted in such output (looks quite bad):
SEGGER J-Link Commander V5.00l ('?' for help)
Compiled Aug 7 2015 15:47:26
Script file read successfully.
DLL version V5.00l, compiled Aug 7 2015 15:47:21
Firmware: J-Link Lite-Cortex-M V8 compiled Jul 17 2014 11:40:12
Hardware: V8.00
S/N: 518109751
Feature(s): GDB
Emulator has Trace capability
VTarget = 3.300V
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
No devices found on JTAG chain. Trying to find device on SWD.
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
No device found on SWD.
Failed to identify target. Trying again with slow (4 kHz) speed.
Info: Could not measure total IR len. TDO is constant high.
Info: Could not measure total IR len. TDO is constant high.
No devices found on JTAG chain. Trying to find device on SWD.
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
No device found on SWD.
No device found at all. Selecting JTAG as default target interface.
Processing script file...
Selecting SWD as current target interface.
Setting target interface speed to 1MHz. Use "Speed" to change.
Target interface speed: 100 kHz
Info: Device "MK63FN1M0XXX12" selected.
Reconnecting to target...
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
****** Error: Kinetis (connect): Error while halting CPU.
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
****** Error: Kinetis (connect): Error while halting CPU.
JTAG Id: 0x00000000: INVALID
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
****** Error: Kinetis (connect): Error while halting CPU.
Reset delay: 0 ms
Reset type UNKNOWN: ???
Info: Found SWD-DP with ID 0x2BA01477
Info: Found SWD-DP with ID 0x2BA01477
****** Error: Kinetis (connect): Error while halting CPU.
Script processing completed.
We were sure it's a kind of HW-problem in our PCB. Having no idea what could go wrong, we've accidentally found this post and executed the script (we've found it interesting), however not intended for this processor:
How to unlock a secured Freescale Kinetis L chip
Since then the JLink probe can connect to the K63F too.
I simply don't understand why K63F chips are being secured by default in the factory, so that we can just hardly connect to it. Is there any good reason to it?
I've read AN4507, but it doesn't cover the registers (SWD AP and SWD DP) that are modified by the script (swdwriteap, swdwritedp) in the mentioned link. It'd be nice to know these registers so I could understand what it does (okay, I believe it unlocks the MCU, but I want to know in more detail). If possible I'd avoid reading through the whole CoreSight PDF... so I need just some facts in a few sentences :smileywink:
Or has anybody any further comments/etc on this?