KDS k20, controller does not boot without debugger

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

KDS k20, controller does not boot without debugger

Jump to solution
1,595 Views
güntherschrenk
Contributor II

Hello,

I´m using the Kinetis design studio, trying to run the controller without debugger. Using the debugger, everything runs fine.

Looking for the problem, i came across:

 

Re: MKE02Z64VLC4 start problem

Why Kinetis K20 does not boot when disconnected from the debug probe?

Re: MK10DX256VLK7 doesn't run standalone, just when debugging. Verified it's running from FLASH, not...

 

The threads refer to I/O settings or compiled libraries, but using code warrior or something different. The problem is: I´m using KDS and can´t find the refered settings.

May be the problem is completely different. Hope you can help me out.

 

regards

Labels (1)
Tags (2)
1 Solution
762 Views
güntherschrenk
Contributor II

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

View solution in original post

4 Replies
763 Views
güntherschrenk
Contributor II

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

762 Views
DavidS
NXP Employee
NXP Employee

Hi Gunther,

Look at your debugger signals with and without connection.

Might check if your Reset line is pulled up correctly.

Check if your EZP_CS is pulled high too.

Regards,

David

0 Kudos
762 Views
güntherschrenk
Contributor II

Hey David, thanks for your answer.

What do you mean with debugger signals? How should I look at those without connection?

The Reset is pulled high with 10kOHM.

Did not know about EzPort, had a look into. Refering to : http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4406.pdf?fpsp=1&WT_TYPE=Application...

the Port needs to be pulled high, otherwise the Controller enters a special programming mode.

At the moment the PIN is not used in any kind of way. Wondering why debugging does work without problems if the controller enters an external programming mode.

By the way, the controller is mounted onto another project (not my project), that has been working without debugger. But that project was not written using Kinetis Design Studio. Connections to the controller were not changed.

0 Kudos
762 Views
DavidS
NXP Employee
NXP Employee

Hi Gunther,

The debug signals I am speak of are the JTAG signals used by the debug hardware.  Since you said system works with debugger I was wondering if the JTAG interface is holding a signal state properly to allow system to run and when you disconnect that a signal might change state to not allow system to run.

Which K20 device?  What version of KDS?  What debugger hardware?  Using standard JTAG or SWD? 

How was the code developed (baremetal, using PE, from existing example, using RTOS)?

The links you found for CodeWarrior translate to KDS for a "semihosting mode" where typical UART communication is re-directed to use the debugger hardware as a serial input/output device (i.e. no UART used) and if the system is setup that way, the device will not run properly without debugger is what is being said.

For information on semihosting using KDS please look at: Semihosting for Kinetis Design Studio V3.0.0 and GNU ARM Embedded (launchpad) | MCU on Eclipse

Regards,

David

0 Kudos