Kinetis K20 - unable to debug

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

Kinetis K20 - unable to debug

7,307 Views
gaminn
Contributor IV

Hello,

my setup:

 

Kinetis K20 MK20DX256ZVLQ10 on my own board - only JTAG connector + MCU + 3.3V regulator, nothing else. There ale pull ups on RESET_b and NMI_b pins

Rowley CrossStudio for ARM v 2.2

Rowley CrossConnect Lite JTAG adapter

 

I'm unable to connect to target, I get "Cannot find debug component from ROM Table" or timeout error message when trying to connect.

 

I can see MCU restarts itself every 50us (square wave with T = 50 us on RESET_b pin) and it doesn't matter whether JTAG adapter is or is not connected to MCU.

 

JTAG adapter is working fine with another MCU (NXP LPC2138).

 

Please can you help?

 

Martin

13 Replies

1,705 Views
Xlerb
Contributor II

Hiya Lior,

Yes, I resolved the issue.

I found that there are bugs in the Keil tools. Versions 4.53 and 4.54 simply would not connect to the K10 as described in my post. Changing to an older version 4.23 or a later version 4.60 fixed the problem.

I did email the UK agent for Keil - but I'm not impressed!

Good luck,

Martin.

0 Kudos

1,705 Views
panpwr
Contributor IV

Hey Martin,

Thanks for the quick replay!

You've mentioned that "I too have another identical board which is working fine. (Also PK10...)." - If it was a bug in the IDE, how can you explain the problem did not occur with your 2nd board?

Also, have you managed to program it successfully to an evaluation board, using the buggy IDE? Or did you encounter this problem on both your custom & evaluation board?

Thanks!

Lior.

0 Kudos

1,705 Views
Xlerb
Contributor II

Hiya,

The second board was progammed by a colleague using the older toolchain.

At that point we had not realised that we were on different versions!

It failed to connect when he updated to 4.53.

Basically if you're using 4.53 or 4.54 with Ulink it won't work.Update to the latest 4.60.

If you are using 4.60 already then I think you have a different issue.

We didn't have an eval board - we went straight for our own.

Since we updated we've not seen this issue again.

Good luck,

Martin.

1,705 Views
apanecatl
Senior Contributor II

I have consulted my oracle, and the magic reason for this is what follows:

When a virgin mcu leaves the factory, the watchdog is enabled, therefore it is perfectly normal you see it entering reset status continuously, and it is also normal it does not let you program it since it is busy in it's reset cycle, to avoid this you need to drive the mcu's reset low to interrupt the watchdog's reset cycle, perform the connection and load your program.

Normally once you perform a mass erase, the watchdog bit is erased too, however there's a slight chance it might not be erased.

By the way you mentioned you have pull up resistors on the RESET_b and NMI_b pins, I'd recommend you add capacitors to avoid the mcu entering EZ_port programming mode accidentally, this would also stall the microcontroller.

0 Kudos

1,705 Views
Monica
Senior Contributor III

Hey there guys! How is the design turning up to? I'm very motivated to see you working out stuff by yourselves, excellent job right there!

0 Kudos

1,705 Views
gaminn
Contributor IV

There is a schematic of my board. Did I miss something?

0 Kudos

1,705 Views
gaminn
Contributor IV

Suddenly, debugging of K20 works now. I have no clue what happened that it now works. The MCU is not resetting and it is debugable.

 

My K20 is soldered on daughterboard (TQFP144 PCB adapter with pinheads, decoupling capacitors are soldered here). So I made another daughterboard (exact copy) and I'm unable to debug this second MCU. Like the first one, it is resetting every 50 us and it is impossible to connect to it with JTAG.

 

Conclusion:

First MCU - was resetting itself and was impossible to debug it, now works perfectly.

Second MCU - it is soldered on exactly same daughterboard, however, it is resetting itself and it is impossible to debug it.

 

There must be some magic that randomly unlocked the first MCU. Please can you reveal it to me?

0 Kudos

1,705 Views
gaminn
Contributor IV

OK, even the second MCU started to work. But guess what happens when I erase its flash... back again, it is impossible to connect to it with JTAG, MCU is resetting

 

My question:  When flash is erased there are invalid values of stack pointer and program counter in vector table, so MCU resets. Is it right?

 

How can I force my JTAG adapter to connect to MCU when it has its flash erased?

0 Kudos

1,705 Views
gaminn
Contributor IV

By reading MDM-AP Status Register we found out that the device was secured and that the mass erase was enabled. However it was not possible to unsecure the device by performing mass erase (System Security bit was always set).

 

We tried to hard wire reset pin to GND and then to perform mass erase. The device unsecured.

 

Why do we need to hold reset pin low during mass erase? Is it a bug? There is nothing written about this in datasheet.

0 Kudos

1,705 Views
Xlerb
Contributor II

Hi,

Do you have any resolution to your problem yet?

This all seems very similar to what I'm seeing.

In my case it's a PK10DN512VLK, our own board with JTAG connector and not much else.

(PK = early rev of silicon) I now have some MK's to test too.

Pull-ups on NMI, reset, TDI, TDO, TMS. Pull down on TCK.

Tools: Keil uVision V4.54 and Keil uLink2 JTAG debugger.

Reset pin on K10 pulses whether JTAG connected or not. 7us low, 52us period.

When the emulator tries to connect I get "Invalid ROM Table"

click OK and I get "Error: Target DLL has been cancelled. Debugger aborted !"

I too have another identical board which is working fine. (Also PK10...).

On this system the reset pin does not pulse.

What's going on????

Anyone from Freescale listening??

Regards,

(also) Martin.

0 Kudos

1,705 Views
panpwr
Contributor IV

Hey Martin,

I have the same setup as yours (uVision + Ulink2), and also the same problems (as you had - hopefully in was in the past...:smileyhappy:).

How did you manage to solve the issue (watchdog enabled, secured flash, "Invalid ROM Table") with Keil tools?

Thanks,

Lior.

0 Kudos

1,705 Views
gaminn
Contributor IV

Hi Martin,

this is the exact procedure we need to use in CrossStudio for ARM in order to unsecure target. We use Olimex ARM-USB-TINY adapter. We also have Rowley's CrossConnect Lite, but this procedure works only with Olimex (namely, we are unable to perform step 2 with CrossConnect).

1) Pull reset pin of MCU down.

2) Connect to target using Olimex without identifying it.

3) Perform Mass Erase (TargetInterface.setDebugRegister(0x01000004, 0x1); ).

4) Reading TargetInterface.getDebugRegister(0x01000000) shows that system is unsecured.

5) Disconnect from target and connect to it using Olimex with identifying.

6) Remove reset.

7) Load program. Debugging works.

 

We also experienced another weird problems when connecting to our MCU. They were mainly caused by buggy Kinetis scripts for JTAG adapters delivered by Rowley. Sometimes connecting to target with reset pin low helped.

0 Kudos

1,705 Views
Xlerb
Contributor II

Hi Martin,

Thanks, I'll see if I can do that with the Keil tools/debugger.

I've also made up another board with a brand new MK10DN512ZVLK.

Exactly the same symptoms - surely they're not shipped from the factory in secure mode.

Regards,

Martin.

0 Kudos