Hello World with JLink

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

Hello World with JLink

3,377 Views
randyseedle
Contributor III

I have a FRDM-K64F board from NXP with a MK64FN1M0VLL12 processor.
I seem to be having some issues with the hello_world application. The
JLink drivers load and I see comm 13 in the Window device manager.
I updated the firmware on the board to the file: latest 02_OpenSDA_FRDM-K64F .
I was able to copy and paste the hex executable file into the E: drive in Windows Explorer.
Starting the debug operation looks like it might work but there is no
feedback on a terminal connected to comm 13 that hello_world should produce.

Other issues (Programming and Erase) using JLink.

Erase does not work (Started in MCUXpressor Quickstart Panel):
Operation completed with the following error(please see consolefor more details):
Unable to perform operation !
Command failed with exit code 1

log from console:
Executing flash operation 'Erase' (Erase flash) - Tue Apr 16 15:52:04 CDT 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.44f (Compiled Apr 12 2019 17:17:37)
DLL version V6.44f, compiled Apr 12 2019 17:17:02
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 58006015
License(s): RDI,FlashDL,FlashBP,JFlash
VTref=3.306V
Target connection not established yet but required for command.
Device "MK64FN1M0XXX12" selected.
Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
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.
Erasing device...
****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
ERROR: Erase returned with error code -1.
Script processing completed.
Unable to perform operation!
Command failed with exit code 1

Programming does not work (Started in MCUXpressor Quickstart Panel):
Operation completed with the following error(please see console for more details):
Unable to perform operation!
Command failed with exit code 1

log from console:
Executing flash operation 'Program' (Program executable into flash Debug\frdmk64f_hello_world.axf) - Tue Apr 16 15:56:02 CDT 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.44f (Compiled Apr 12 2019 17:17:37)
DLL version V6.44f, compiled Apr 12 2019 17:17:02
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 58006015
License(s): RDI,FlashDL,FlashBP,JFlash
VTref=3.306V
Target connection not established yet but required for command.
Device "MK64FN1M0XXX12" selected.
Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
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.
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()
PC = 00000660, CycleCnt = 00000000
R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
R12= 00000000
SP(R13)= 1FFFF530, MSP= 1FFFF530, PSP= 00000000, R14(LR) = FFFFFFFF
XPSR = 01000000: 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
Downloading file [C:\Users\Randy\Documents\MCUXpressoIDE_10.3.1_2233\workspace\frdmk64f_hello_world\Debug\frdmk64f_hello_world.hex]...
****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Unspecified error -1
Script processing completed.
Unable to perform operation!
Command failed with exit code 1

Debugging does not work (Started in MCUXpressor Quickstart Panel):
[MCUXpresso Semihosting Telnet console for 'frdmk64f_hello_world JLink Debug' started on port 50098 @ 127.0.0.1]

SEGGER J-Link GDB Server V6.44f - Terminal output channel

Log from debug window:
GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".


monitor exec SetRestartOnClose=1

0 Kudos
5 Replies

2,496 Views
randyseedle
Contributor III

Changing the cable connection helped some. I can debug now. Yeah !!! But when I tried to erase the currect

program in flash I got this mess.


Trying to program flash:
Executing flash operation 'Program' (Program executable into flash Debug\frdmk64f_hello_world.axf) - Thu Apr 18 16:39:22 CDT 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.44f (Compiled Apr 12 2019 17:17:37)
DLL version V6.44f, compiled Apr 12 2019 17:17:02
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 58006015
License(s): RDI,FlashDL,FlashBP,JFlash
VTref=3.287V
Target connection not established yet but required for command.
Device "MK64FN1M0XXX12" selected.
Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
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.

Any ideas ?

0 Kudos

2,496 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Randy,

You can use the J-link commander  tool to erase: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/

Which version of MCUXpresso IDE do you used ?


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,496 Views
randyseedle
Contributor III

The j-link commander initially recognises the serial number of the device but is unable to

communicate with the two available device configurations.

Any ideas ?

0 Kudos

2,496 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Randy Seedle,

- I made a video about how to use J-link commander to erase K64 chip, please have  a look at my attachment.

- Also, the MCUXpresso IDE also can erase the chip like below:

pastedImage_1.png

- If still have issue on your side, please take a video or screenshot to show it.


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,496 Views
BlackNight
NXP Employee
NXP Employee

Hi Randy,

are you using an external J-Link or the OpenSDA one on the SDAUSB Port?

I ask because your log shows

Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 58006015

while with the onboard J-Link interface it should show something like this:

Connecting to J-Link via USB...O.K.
Firmware: J-Link OpenSDA 2 compiled Jun 28 2018 09:44:47
Hardware version: V1.00
S/N: 621000000
VTref=3.300V

I have posted my log below.

I belive you have connected your external probe to the wrong core, and you are trying to debug the K20 instead the K64F?

See Debugging the FRDM-K64F with P&E Multilink | MCU on Eclipse about which SWD/debug connector to use.

Additionally, your J-Link Firmware looks very old (2014?).

I hope this helps,

Erich

Executing flash operation 'Program' (Program executable into flash Debug\FRDM-K64F_McuOnEclipseLib.axf) - Thu Apr 18 09:21:06 CEST 2019
Checking MCU info...
Scanning for targets...
Executing flash action...
SEGGER J-Link Commander V6.44e (Compiled Apr  5 2019 16:17:35)
DLL version V6.44e, compiled Apr  5 2019 16:15:03
J-Link Command File read successfully.
Processing script file...
J-Link Commander will now exit on Error
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link OpenSDA 2 compiled Jun 28 2018 09:44:47
Hardware version: V1.00
S/N: 621000000
VTref=3.300V
Target connection not established yet but required for command.
Device "MK64FN1M0XXX12" selected.
Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x2BA01477
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: 000BB00C SCS-M7
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.
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()
PC = 000001D4, CycleCnt = 00000000
R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
R12= 00000000
SP(R13)= 20030000, MSP= 20030000, PSP= 00000000, R14(LR) = FFFFFFFF
XPSR = 01000000: 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
Downloading file [C:\Users\Erich Styger\Data\GitRepos\McuOnEclipse\Examples\MCUXpresso\FRDM-K64F\FRDM-K64F_McuOnEclipseLib\Debug\FRDM-K64F_McuOnEclipseLib.hex]...
J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
O.K.
Script processing completed.

0 Kudos