Hey, we found the solution to the problem.
First of: Thank you David for trying to help.
Writing the project within Kinetis Design Studio (KDS), and creating a new project using the wizzard, KDS creates startup data that will run befor the main().
It seems the Watchdog needs to be disabled shortly after the start of the controller (first 512 clockcycles?). If not, the Watchdog reboots the device (K20) within the startup routine added from KDS and will never reach main().
This problem occured on:
Kinetis Design Studio 3.0
Controller used: MK20DX256VLH7
corresponding file: ../Project_settings/Startup_code/startup_MK20D7.S
Using the debugger (in our case JTAG), KDS disables the watchdog, but not when starting the Controller without debugger.
To disable the watchdog, go into the corresponding file and insert AFTER
Reset_Handler:
cpsid i /* Mask interrupts */
the following code:
// Disable Watchdog
.equ WDOG_UNLOCK, 0x4005200E @ =1074077710, 16 Bit
.equ WDOG_STCTRLH, 0x40052000 @ =1074077696, 16 Bit
LDR r1, =WDOG_UNLOCK
LDR r2, =0xC520
STRH r2, [r1, #0] // Watchdog unlock sequence #1
LDR r2, =0xD928
STRH r2, [r1, #0] // Watchdog unlock sequence #2
LDR r1, =WDOG_STCTRLH
LDR r2, =0x01D2
STRH r2, [r1, #0] // Watchdog unlock sequence #3
I hope this will help people out