Unable to debug KE02

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to debug KE02

656 Views
Ardoster
Contributor III

Hi

Using a MKE02Z64 on a custom board, I'm having problems to connect it to debug. When monitoring the reset line, I can see the MCU resets itself every 40us. Why? I don't understand this point, and there's no so much information about this problem. But I found this other thread: Kinetis K20 - unable to debug.

This thread says that I must pull-down the reset line, and a mass erase must be performed. Although I'm able to pull-down the reset line (i.e. using an external pull-down, or by configuring it in Lauterbach), I'm not able to perform the mass erase.

As debugger environment, I'm using Lauterbach

What can I do? Any suggestion? Any idea although using a different debug envionment is welcome.

Thanks you in advance,

Eduardo

0 Kudos
3 Replies

261 Views
skrausse
Contributor II

Hello Eduardo,

This sounds like the watchdog, which is enabled by default, and even the flash is empty. You need to flash an aplication inside, that handles or disables the watchdog. When using the debuggers flash scripts, then they disable the watchdog before flashing. This is done by the block:

DisableWatchdog: 

  Data.Set VM:0x20000000++0x2F %Long 0

  Data.Assemble VMT:0x20000000 adr     r0,0x20000014

  Data.Assemble ,              ldm     r0,{r0-r4}

  Data.Assemble ,              movs    r5,0

  Data.Assemble ,              strb r5, [r0, #1]

  Data.Assemble ,              strh r1, [r0, #2]

  Data.Assemble ,              strh r2, [r0, #2]

  Data.Assemble ,              strh r3, [r0, #4]

  Data.Assemble ,              strh r4, [r0, #0]

  Data.Assemble ,              bkpt    #0x0

  Data.Set VM:0x20000014 %Long 0x40052000

  Data.Set VM:0x20000018 %Long 0x20c5

  Data.Set VM:0x2000001C %Long 0x28D9

  Data.Set VM:0x20000020 %Long 0xFFFF

  Data.Set VM:0x20000024 %Long 0x20

  Data.COPY SD:0x20000000++0x2F VM:0x20000030

  Data.COPY VM:0x20000000++0x2F SD:0x20000000

  Register.Set PC 0x20000000

  Go.direct

  WAIT !RUN()

  Data.COPY VM:0x20000030++0x2F SD:0x20000000

  RETURN

SYStem.Up should work even with the enabled watchdog. If SYStem.Up is not working, then you have a different problem. In that case the error message would be interesting.

The standard way to call the flash script is calling it directly after SYStem.Up in the following way:

     ...

     SYStem.Up

    

     DO ~~/demo/arm/flash/mke0.cmm PREPAREONLY

     ...

The the WDOG will be disabled.

Best Regards,

Steffen.

0 Kudos

261 Views
Ardoster
Contributor III

Hi Steffen

Thanks a lot for your reply. It was very insteresting to understand the problem. Anyway, I have problems when using SYSTEM.Up or SYS.MODE.PREPARE. The returned error message is "Emulation Debug Port Fail", "Both SerialWire init sequences failed: ACK: 0X7". :smileycry:

That's weird no more people is having problems with Lauterbach and this MCU.

Thanks your help

Eduardo

0 Kudos

261 Views
Ardoster
Contributor III

Hi

The problem (or part of the problem) was due to my JTAG pinout, because the SWD IO line is was in the wrong pin. Anyway, I'm having now other problems, and I'm still unable to debug this time by using PE Micro... But I'll ask for help in another thread.

Thanks a lot of for your help

0 Kudos