TWR-K70F120M crashes unexpectedly

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

TWR-K70F120M crashes unexpectedly

614 Views
mateusz
Contributor I

Hi!

I'm running an eCos application which do a lot of mathematical computation. The problem is that application crashes after a few seconds or minutes. Moreover, when I connect the JTAG (OSBDM) and run the OpenOCD (Open On-Chip Debugger 0.7.0 (2013-08-04-09:35)) even when the OpenOCD is started just for few seconds, the microcontroller runs smoothly without a crash.

Connecting OSBDM (physically) without starting OpenOCD also finishes with application crash.

Unfortunately, when the processor is crashed I can start OpenOCD but I can't halt the processor to see what state is it.

Log from OpenOCD when the processor is crashed tells:

Info : 259 2395 server.c:83 add_connection(): accepting 'telnet' connection from 4444

Debug: 260 5058 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_halt

Debug: 261 5058 command.c:145 script_debug(): command - halt ocd_halt

Debug: 263 5060 target.c:2460 handle_halt_command(): -

Debug: 264 5060 cortex_m.c:596 cortex_m3_halt(): target->state: unknown

Warn : 265 5060 cortex_m.c:604 cortex_m3_halt(): target was in unknown state when halt was requested

Debug: 266 5063 target.c:2442 target_wait_state(): waiting for target halted...

Info : 268 6063 target.c:455 target_poll(): Halt timed out, wake up GDB.

Debug: 269 6063 target.c:1294 target_call_event_callbacks(): target event 0 (gdb-halt)

Error: 278 10064 target.c:2450 target_wait_state(): timed out while waiting for target halted

Debug: 279 10064 command.c:631 run_command(): Command failed with error code -4

User : 280 10064 command.c:669 command_run_line(): in procedure 'halt'

Debug: 281 13409 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_exit

Debug: 282 13410 command.c:145 script_debug(): command - exit ocd_exit

Info : 284 13412 server.c:476 server_loop(): dropped 'telnet' connection

I compare OpenOCD logs when I start it under processor is running without problems and when it crashed. There is only one difference:

- under working system

arm_adi_v5.c:959 dap_syssec_kinetis_mdmap(): MDM_REG_STAT 0004003A

- under crashed system

arm_adi_v5.c:959 dap_syssec_kinetis_mdmap(): MDM_REG_STAT 0000003A

The difference bit is 'Core SLEEPING' from MDM-AP status.

Does anybody meet similar problem? Why I can't halt the processor even when the connection between OSBDM and processor's JTAG is alive (I have connected LA)?

Thanks for any suggestions.

Regards,

Mateusz

Labels (1)
0 Kudos
1 Reply

345 Views
mateusz
Contributor I

OK, I found some solution but I don't know why the previous situation happened.

eCos (exactly the Cortex M HAL in eCos) has a Idle loop which implements execution of wfi instruction without touching any registers responsible for setting sleep modes. When I replaced the wfi with nop instruction, whole application runs without any crash. So, now I have two binaries forms of application which differ in one single byte.

My guess is that the version which uses wfi accidentally goes into one of the sleep modes (maybe some kind of deep sleep). But I can't consciously reproduce the problem. I tried to set registers responsible for sleep modes (SMC_PMCTRL in SoC and SCR in Cortex) in a few different modes, but I didn't achieve the same situation which happens with eCos application. (I achieved situation when the CPU stops but the debug interface also stop working - OpenOCD doesn't receive CDBGPWRUPACK signal).

So, my other question is: does Kinetis have sleep mode in which CPU (Cortex) is halted, but the debug interface works without problems? Or maybe there is some silicon bug, because on my Tower there is Kinetis marked as PK70FN1M0VMJ12 / 1N96B / CTEAA1216L ?

0 Kudos