[HowTo?] Run a virgin MK64FN1M0VLL12 via J-TAG

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

[HowTo?] Run a virgin MK64FN1M0VLL12 via J-TAG

Contributor I

Dear Community,

I just soldered a stable power supply (as ready-to-use module) together with a JTAG connector and the reset circuits from the development schematics to a custom board. Then I connected 3 LEDs (red, green, blue) to PCB 21-23.

After testing my curcuits (LEDs are flashing etc.) I soldered a virgin MK64FN1M0VLL12 at the boards heart.

To test my board I simply tried to switch the LEDs on. Here's the code:

#include "mbed.h"
DigitalOut myled1(PTB21);
DigitalOut myled2(PTB22);
DigitalOut myled3(PTB23);
int main() {
    while(1) {
        // TODO let the LEDs blink
        myled1 = true;
        myled2 = true;
        myled3 = true;

1) I compiled the code using the 'mbed-cli deploy; mbed-cli compile -t GCC_ARM -m K64F' commands.

2) I flashed the resulting binary to the virgin CPU using SEGGERs j-link debugger. Here's the stdout (both SWD and JTAG are working)

PS C:\Program Files (x86)\SEGGER\JLink_V616f> .\JLink.exe
SEGGER J-Link Commander V6.16f (Compiled Jul  3 2017 15:58:03)
DLL version V6.16f, compiled Jul  3 2017 15:57:26

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Jun 16 2017 16:15:19
Hardware version: V10.10
S/N: 50102163
License(s): GDB
VTref = 3.303V

Type "connect" to establish a target connection, '?' for help
Please specify device / core. <Default>: MK64FN1M0XXX12 (ALLOW SECURITY)
Type '?' for selection dialog
Please specify target interface:
  J) JTAG (Default)
  S) SWD
Specify target interface speed [kHz]. <Default>: 4000 kHz
Device "MK64FN1M0XXX12" selected.

Connecting to target via SWD
Executing InitTarget()
Found SW-DP with ID 0x2BA01477
Scanning APs, stopping at first AHB-AP found.
AP[0] IDR: 0x24770011 (AHB-AP)
AHB-AP ROM: 0xE00FF000 (Base addr. of first ROM table)
CPUID reg: 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: 000BB00C 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.
Erasing device (MK64FN1M0xxx12)...
J-Link: Flash download: Total time needed: 4.017s (Prepare: 0.471s, Compare: 0.000s, Erase: 3.485s, Program: 0.000s, Ver
ify: 0.000s, Restore: 0.061s)
Erasing done.
J-Link>loadbin P:\blinky\BUILD\K64F\GCC_ARM\blinky.bin, 0x0
Downloading file [P:\blinky\BUILD\K64F\GCC_ARM\blinky.bin]...
J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (49152 bytes)
J-Link: Flash download: Total time needed: 8.052s (Prepare: 0.945s, Compare: 0.048s, Erase: 0.000s, Program: 6.505s, Ver
ify: 0.005s, Restore: 0.548s)
J-Link>verifybin P:\blinky\BUILD\K64F\GCC_ARM\blinky.bin, 0x0
Loading binary file P:\blinky\BUILD\K64F\GCC_ARM\blinky.bin
Reading 48260 bytes data from target memory @ 0x00000000.
Verify successful.
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.
Executing AfterResetTarget()
CPU is not halted.
PC = 00003FC0, CycleCnt = 0F4FDAD7
R0 = 00000000, R1 = 0000A698, R2 = 00000010, R3 = 40064000
R4 = 0000A698, R5 = 00000000, R6 = 00000000, R7 = 00000000
R8 = 00000000, R9 = 00000000, R10= 20020000, R11= 00000000
R12= 00000000
SP(R13)= 2002FFD0, MSP= 2002FFD0, PSP= 00000000, R14(LR) = 0000402B
XPSR = 21000000: APSR = nzCvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00

FPS0 = 00000000, FPS1 = 00000000, FPS2 = 00000000, FPS3 = 00000000
FPS4 = 00000000, FPS5 = 00000000, FPS6 = 00000000, FPS7 = 00000000
FPS8 = 00000000, FPS9 = 00000000, FPS10= 00000000, FPS11= 00000000
FPS12= 00000000, FPS13= 00000000, FPS14= 00000000, FPS15= 00000000
FPS16= 00000000, FPS17= 00000000, FPS18= 00000000, FPS19= 00000000
FPS20= 00000000, FPS21= 00000000, FPS22= 00000000, FPS23= 00000000
FPS24= 00000000, FPS25= 00000000, FPS26= 00000000, FPS27= 00000000
FPS28= 00000000, FPS29= 00000000, FPS30= 00000000, FPS31= 00000000
FPSCR= 00000000‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This is absolutely the same stdout as when I am flashing the K64F Development Board using the JTAG / SWD debugger. The Development Boards LEDs are flashing after using the 'r(eset), g(o)' commands but the custom board stays dark.

I do not have any more ideas where to search for the issue. Maybe I forgot to flash some kind of 'firmware' on my MCU?

I am looking forward to your answers (and suggestions). 

Thank you very much!


0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport


From your attached code, I couldn't find there with GPIO toggle operation.

Could you provide the PTB21/PTB22/PTB23 scope signal?

And if possible, could  you provide the customer board schematics about LED control circuit?

And please provide the PORTB_PCR21, PORTB_PCR22 and PORTB_PCR23 registers value after GPIO pin initialization.

Thank you for the attention.

Have a great day,
Ma Hui

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

0 Kudos