Unable to flash Kinetis S9KEAZN8 using Segger J-Link

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

Unable to flash Kinetis S9KEAZN8 using Segger J-Link

Jump to solution
3,610 Views
egonc
Contributor II

Hello,

I'm moving the firmware from the evalboard (TRK-KEA8) to the prototype. Since I already own a Segger J-Link and it' s stated as compatible with the device I setup everything needed to use it.

KDS version is: 3.0.0

 

After choosing the proper KDS debug profile and clicking the debug button I see the connection is properly esablished. The flashing fails with the log attached below.

 

Manually accessing the flash shows no sign of the firmware. Manually accessing the RAM shows data and manual changes are properly reflected (no connection problem IMHO).

 

I tried several clock speed combinations with the same result.

 

Thanks for any help provided.

 

 

 

SEGGER J-Link GDB Server V5.10s Command Line Version

 

JLinkARM.dll V5.10s (DLL compiled Mar  9 2016 18:51:10)

 

-----GDB Server start settings-----

GDBInit file:                  none

GDB Server Listening port:     2331

SWO raw output listening port: 2332

Terminal I/O port:             2333

Accept remote connection:      localhost only

Generate logfile:              off

Verify download:               on

Init regs on start:            on

Silent mode:                   off

Single run mode:               on

Target connection timeout:     0 ms

------J-Link related settings------

J-Link Host interface:         USB

J-Link script:                 none

J-Link settings file:          none

------Target related settings------

Target device:                 SKEAZN8xxx4

Target interface:              SWD

Target interface speed:        1000kHz

Target endian:                 little

 

 

Connecting to J-Link...

J-Link is connected.

Firmware: J-Link V9 compiled Mar  8 2016 11:12:56

Hardware: V9.30

S/N: 269307704

OEM: SEGGER-EDU

Feature(s): FlashBP, GDB

Checking target voltage...

Target voltage: 4.74 V

Listening on TCP/IP port 2331

Connecting to target...Connected to target

Waiting for GDB connection...Connected to 127.0.0.1

Reading all registers

Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)

Target interface speed set to 1000 kHz

Resetting target

Halting target CPU...

...Target halted (PC = 0xFFFFFFFE)

R0 = 0400C803, R1 = 8880513C, R2 = 42042008, R3 = 00408071

R4 = A0E16000, R5 = 04070941, R6 = 60280A02, R7 = 05881800

R8 = 17001433, R9 = 88411605, R10= 10D66100, R11= 88A02589

R12= C884E0A0, R13= FFFFFFFC, MSP= FFFFFFFC, PSP= 20090048

R14(LR) = FFFFFFF9, R15(PC) = FFFFFFFE

XPSR 81000000, APSR 80000000, EPSR 01000000, IPSR 00000000

CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00

Reading all registers

Select auto target interface speed (2000 kHz)

Flash breakpoints enabled

Semi-hosting enabled (Handle on BKPT)

Semihosting I/O set to TELNET Client

SWO disabled succesfully.

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

SWO enabled succesfully.

Downloading 192 bytes @ address 0x00000000 - Verified OK

Downloading 16 bytes @ address 0x00000400 - Verified OK

Downloading 4652 bytes @ address 0x00000410 - Verified OK

Downloading 8 bytes @ address 0x0000163C - Verified OK

Downloading 4 bytes @ address 0x00001644 - Verified OK

Downloading 4 bytes @ address 0x00001648 - Verified OK

Downloading 104 bytes @ address 0x0000164C - Verified OK

ERROR: Failed to measure CPU clock frequency

Failed to measure CPU clock frequency: second loop count is less than first one! (67160067<=67160067)

 

 

Writing register (PC = 0x000004e8)

Read 4 bytes @ address 0x000004E8 (Data = 0xFFFFFFFF)

Read 2 bytes @ address 0x000006EC (Data = 0xFFFF)

Read 2 bytes @ address 0x000006EC (Data = 0xFFFF)

Resetting target

Halting target CPU...

...Target halted (PC = 0xFFFFFFFE)

Read 2 bytes @ address 0x000006EC (Data = 0xFFFF)

Read 2 bytes @ address 0x000006EC (Data = 0xFFFF)

Read 2 bytes @ address 0x000006EC (Data = 0xFFFF)

R0 = 0400C803, R1 = 8880513C, R2 = 42042008, R3 = 00408071

R4 = A0E16000, R5 = 04070941, R6 = 60280A02, R7 = 05881800

R8 = 17001433, R9 = 88411605, R10= 10D66100, R11= 88A02589

R12= C884E0A0, R13= FFFFFFFC, MSP= FFFFFFFC, PSP= 20090048

R14(LR) = FFFFFFF9, R15(PC) = FFFFFFFE

XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000

CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00

Reading all registers

WARNING: Failed to read memory @ address 0xFFFFFFFE

Setting breakpoint @ address 0x000006EC, Size = 2, BPHandle = 0x0001

Starting target CPU...

...Target halted (DBGRQ, PC = 0xFFFFFFFE)

Reading all registers

Removing breakpoint @ address 0x000006EC, Size = 2

WARNING: Failed to read memory @ address 0xFFFFFFFE

WARNING: Failed to read memory @ address 0xFFFFFFF4

Reading 64 bytes @ address 0xFFFFFFC0

WARNING: Failed to read memory @ address 0xFFFFFFC0

Reading 64 bytes @ address 0xFFFFFFC0

WARNING: Failed to read memory @ address 0xFFFFFFC0

Labels (1)
0 Kudos
1 Solution
1,606 Views
egonc
Contributor II

Hi Carlos,

thanks for answering. We tried both 3.1.0 and 3.2.0 but the problem is still present.

Anyway, after looking deeper into MCU registers we noticed that the Segger doesn't enable the internal oscillator and doesn't disable NMI pin. We added the following lines:

monitor memU8 0x40064000 = 6

monitor memU32 0x40048004 = 0x0000000C

into the custom intialization commands:

strtup.png

And now it's working as expected. I guess this problem occurs only with a blank MCU or an invalid firmware.

I think this should be reported to Segger, meanwhile, the workaround is good enough to continue testing.

Thanks,

Egon

View solution in original post

0 Kudos
3 Replies
1,606 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Egon,

Could you please try installing the KDS 3.1.0 update?

Kinetis Design Studio Update V3.1.0 available

Maybe you are having the issue with the dependency to the GNU ARM Eclipse explained here:

Unable to Debug after KDS Update

Let me know if it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 Kudos
1,605 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Egon,

The new KDS version 3.2.0 was released today, I think it would be better for you to install this version that includes all the existing updates and fixes the issue with GNU ARM Eclipse updates which affects debugging with OpenOCD and Segger J-Link.

You can find more information here:

New Kinetis Design Studio v3.2.0 available

Let me know if it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 Kudos
1,607 Views
egonc
Contributor II

Hi Carlos,

thanks for answering. We tried both 3.1.0 and 3.2.0 but the problem is still present.

Anyway, after looking deeper into MCU registers we noticed that the Segger doesn't enable the internal oscillator and doesn't disable NMI pin. We added the following lines:

monitor memU8 0x40064000 = 6

monitor memU32 0x40048004 = 0x0000000C

into the custom intialization commands:

strtup.png

And now it's working as expected. I guess this problem occurs only with a blank MCU or an invalid firmware.

I think this should be reported to Segger, meanwhile, the workaround is good enough to continue testing.

Thanks,

Egon

0 Kudos