programming custom K63F board with FRDM-K64F

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

programming custom K63F board with FRDM-K64F

Jump to solution
2,650 Views
tselmeci
Contributor IV

Hello all!

We've got a custom board built around K63F MCU and a 2x5 JTAG connector. We also have a Freescale FRDM-K64F evaluation board. I somehow have to find the way to be able to program the flash of our K63F on Linux.

According to my former research, in theory it appears to be possible to use the FRDM-K64F to program our K63F via JTAG using an appropriate 2x5 patch cable.

Is there anybody who has succeeded modifying his FRDM-K64F to act as a 'JTAG-programmer'? Any useful hints/tips? (I've seen the official FRDM64 user's guide, but I'm still a bit reluctant to begin working according to that).

Thanks,

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,325 Views
tselmeci
Contributor IV

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?

View solution in original post

0 Kudos
8 Replies
1,326 Views
tselmeci
Contributor IV

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?

0 Kudos
1,325 Views
EarlOrlando
Senior Contributor II

Hello,

I think the post in the link below will be useful for you, please take a look into it.

Using the Freedom Board as SWD Programmer | MCU on Eclipse

Best regards,

Earl.

0 Kudos
1,325 Views
tselmeci
Contributor IV

So I'm back (I had to work on other projects recently) and in the middle of attempting to bring our HW up (K63F).

First of all I'm a bit confused. On FRDM-K64F there are three connectors:

-1) OpenSDA USB;

-2) J10 for OpenSDA;

-3) J9 for JTAG;

1) When I plug the SDA USB into my machine, it appears as a Mass Storage Device and I can program the FRDM64 itself like a charm. So it appears to be something which routes the UART RX/TX signals through USB (seen as a ttyACM device on linux) and provides some means to reburn the flash on K64F with the help of M28. M28 runs a firmware, which can burn the binary image I copy to the Mass Storage Device. (Well, I believe that small M28 generates the whole virtual ttyACM port for UART and MSD device). So it's clear.

2) What is the use of this? If I had an OpenSDA-capable debugger tool then would I be able to connect it here? I think the signals on J10 are "packaged" and transferred to 1) with the help of M28.

3) Another debug/program interface to be used with some JTAG tools.

So back to my problem: I need to program with FRDM-K64F our custom board equipped with K63F. The link you suggested is not about the same Freedom board. Which one (2 or 3) do I need to program the K63F? Our board of course has a JTAG connector, I'd say I need to connect 3) to that, but I'm not sure.

What I've done is cut J11 on FRDM and connected J9 to the JTAG of our K63F. FRDM's USB mass storage device appears, but each time I attempt to copy a binary it reports "The interface firmware FAILED to reset/halt the target MCU".

What could go wrong? Any ideas?

Thanks

0 Kudos
1,325 Views
tselmeci
Contributor IV

An observation: with J11 off (cut) on my programmer (FRDM K64F) I can burn new flash contents to another FRDM K64F using J9 flash connectors on both boards... maybe there's a HW issue on our new PCB...?

0 Kudos
1,325 Views
EarlOrlando
Senior Contributor II

Hello Tomas,

1) The USB is connected to the MK20 MCU which implements an USB CDC communication with the computer and for the other side is connected through UART to the MK64F so it simulate an UART connection through USB. The MK20 MCU programs the MK64F through the SWD interface.

2) This connector is for an external SWD interface, this replaces the MK20 interface.

3) The same as 2) but through the JTAG interface.

The problem here is that the application for the bootloader in the FRDM-K64F used as programmer must have the application for the K63F (or the target MCU, in this case K63F). Unfortunately, the K63F application does not exist so you need to develop it. If you are interested on that the post below will be useful.

OpenSDAv2

Best regards,

Earl Orlando.

0 Kudos
1,325 Views
tselmeci
Contributor IV

Hello Earl!

I'm not sure I correctly understand this:

The problem here is that the application for the bootloader in the FRDM-K64F used as programmer must have the application for the K63F (or the target MCU, in this case K63F). Unfortunately, the K63F application does not exist so you need to develop it.

I do have an K63F application I want to burn, since I've set up the KSDK, the toolchain etc. The application is practically just a LED blinker. Am I right supposing that FRDM-K64F can burn the K63F .bin file (provided via USB by Mass Storage Device) into the K63F device if FRDM-K64F and our custom K63F PCB are connected with JTAG cable? I'd believe this can work, since 1) K63F and K64F quite similar and 2) standard JTAG pins are to be used to program the K63F;

0 Kudos
1,325 Views
EarlOrlando
Senior Contributor II

Hello Tamas,

The FRDM-K64F has two MCUs, one is the target processor (K64F) and the other is the OpenSDA processor (K20). The K20 has a bootloader installed (the blue block in the image below) whose application (the green block) depends on the target processor. If you want to program a different MCU with the OpenSDA MCU you need to update its application (which is different than the program that will be downloaded in the target processor). The bootloader application is updated as is explained in the following post from Erich Styger in the section Updating board firmware. That bootloader application is the one that you need to create specially for the K63F MCU.

Illustrated Step-by-Step Instructions: Updating the Freescale Freedom Board Firmware | MCU on Eclips...

https___community.freescale.com_servlet_JiveServlet_showImage_102-100720-7-11446_pastedImage_6.png

If there’s anything else I can do for you please let me know.

Best regards,

Earl.

0 Kudos
1,325 Views
tselmeci
Contributor IV

Thanks, it's clear now. By the way, I'd suppose the same bootloader is suitable for K63F too, since they appear to be quite similar. I'll most probably switch to Segger JTAG to avoid issues like this.

0 Kudos