Bartek Szatkowski

FRDM-K22F: Debugging/flashing issue

Discussion created by Bartek Szatkowski on May 6, 2016
Latest reply on May 11, 2016 by Bartek Szatkowski

My FRDM-K22F board suddenly stopped working properly. I can't flash any programs on it, but everything else seem to work fine. When I connect it to my computer it's detected and mounted. Flashing bootloader also works. I've tried mbed and sagger bootloaders, flashing from Mac and Linux using KDS and also tried to just to copy one of the demo .bin files. While trying to debug using Sagger I'm getting:

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

 

 

JLinkARM.dll V5.10n (DLL compiled Feb 19 2016 18:45: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:                 MK22FN512xxx12

Target interface:              SWD

Target interface speed:        auto

Target endian:                 little

 

 

Connecting to J-Link...

J-Link is connected.

Firmware: J-Link OpenSDA 2 compiled Oct 13 2015 12:10:56

Hardware: V1.00

S/N: 621000000

Checking target voltage...

Target voltage: 3.30 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 = 0x20010000)

Target interface speed set to 30 kHz

Resetting target

Halting target CPU...

...Target halted (PC = 0x00001034)

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, R13= 20010000, MSP= 20010000, PSP= 00000000

R14(LR) = FFFFFFFF, R15(PC) = 00001034

XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000

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

Reading all registers

Select auto target interface speed (1429 kHz)

Flash breakpoints enabled

Semi-hosting enabled (Handle on BKPT)

Wrong client mask. Semihosting I/O not changed.

 

 

 

 

*** J-Link V5.10n Warning ***

The connected emulator does not support serial wire output (SWO).

 

 

*** J-Link V5.10n Warning ***

 

 

Failed to disable SWO.

ERROR: Could not detect CPU clock speed. Verification of test code downloaded into RAM failed.

 

 

Failed to enable SWO. Could not measure target CPU frequency.

Downloading 1024 bytes @ address 0x00000000 - Verified OK

Downloading 16 bytes @ address 0x00000400 - Verified OK

Downloading 16064 bytes @ address 0x00000410 - Verified OK

Downloading 13600 bytes @ address 0x000042D0 - Verified OK

Downloading 8 bytes @ address 0x000077F0 - Verified OK

Downloading 4 bytes @ address 0x000077F8 - Verified OK

Downloading 4 bytes @ address 0x000077FC - Verified OK

Downloading 120 bytes @ address 0x00007800 - Verified OK

ERROR: Failed to download RAMCode!

Writing register (PC = 0x000004d8)

Read 4 bytes @ address 0x000004D8 (Data = 0x0003F010)

Read 2 bytes @ address 0x000026FE (Data = 0x2200)

Read 2 bytes @ address 0x000026FE (Data = 0x2200)

Resetting target

Halting target CPU...

...Target halted (PC = 0x00001034)

Read 2 bytes @ address 0x000026FE (Data = 0x2200)

Read 2 bytes @ address 0x000026FE (Data = 0x2200)

Read 2 bytes @ address 0x000026FE (Data = 0x2200)

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, R13= 20010000, MSP= 20010000, PSP= 00000000

R14(LR) = FFFFFFFF, R15(PC) = 00001034

XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000

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

Reading all registers

Read 4 bytes @ address 0x00001034 (Data = 0x4804B672)

Reading 64 bytes @ address 0x20010000

WARNING: Failed to read memory @ address 0x20010000

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

Starting target CPU...

ERROR: Communication timed out: Requested 4 bytes, received 0 bytes !

...Target halted (PC = 0x00000000)

Reading all registers

Removing breakpoint @ address 0x000026FE, Size = 2

WARNING: Could not remove breakpoint @ address 0x000026FE

WARNING: Failed to read memory @ address 0x00000000

WARNING: Failed to read memory @ address 0x00000000

WARNING: Failed to read memory @ address 0x00000000

WARNING: Target connection lost.

WARNING: Failed to read memory @ address 0x00000000

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000002

WARNING: Failed to read memory @ address 0x00000004

WARNING: Failed to read memory @ address 0x00000004

WARNING: Failed to read memory @ address 0x00000006

WARNING: Failed to read memory @ address 0x00000006

WARNING: Failed to read memory @ address 0x00000008

WARNING: Failed to read memory @ address 0x00000008

WARNING: Failed to read memory @ address 0x0000000A

 

 

While using mbed I'm getting:

 

Open On-Chip Debugger 0.8.0-dev (2015-01-09-16:23)

Licensed under GNU GPL v2

For bug reports, read

  http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : only one transport option; autoselect 'cmsis-dap'

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : add flash_bank kinetis kinetis.flash

cortex_m reset_config sysresetreq

adapter speed: 1000 kHz

Started by GNU ARM Eclipse

Info : CMSIS-DAP: FW Version = 1.0

Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)

Info : CMSIS-DAP: Interface ready

Info : clock speed 1000 kHz

Info : IDCODE 0x2ba01477

Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints

Info : accepting 'gdb' connection from 3333

target state: halted

target halted due to debug-request, current mode: Handler HardFault

xPSR: 0x01000003 pc: 0x000010a0 msp: 0x2000ff88

Info : Probing flash info for bank 0

Warn : acknowledgment received, but no packet pending

Info : Disabling Kinetis watchdog (initial WDOG_STCTRLH = 0x1d3)

Info : WDOG_STCTRLH = 0x1d2

target state: halted

target halted due to undefined, current mode: Handler HardFault

xPSR: 0x01000003 pc: 0x000010a0 msp: 0x2000ff88

semihosting is enabled

Error: CMSIS-DAP: Write Error (0x04)

Warn : erase sector 0 failed

Error: failed erasing sectors 0 to 15

Error: flash_erase returned -902

Info : dropped 'gdb' connection

 

Any idea what's going on?

Outcomes