AnsweredAssumed Answered

Unexplained faults/resets following a peculiar pattern... [KDS on OSX, JLink]

Question asked by Kris Bird on Dec 29, 2015
Latest reply on Jan 2, 2016 by Kenny Koller

So I've been developing for about a week, and braving some odd behavior...  Initially I assumed it was down to dodgy peripheral settings, but I've now got its repeatability down to a fine art

 

I'm building a MK20D10 project with GCC on KDS / KSDK1.3 on OSX El Capitan, debugging with a JLink with default settings.  I have created projects from scratch and see very similar behavior, so I don't think it's related to any particular peripheral or KSDK component, but I can't be 100% sure.

 

SO:-

 

Every time I make a change to a source file (i.e. a ".c" file), I BUILD, and it compiles successfully... I then hit the DEBUG button (the little bug), it connects to the JLink and fires up the microcontroller.  All looks fine.

 

But then (i.e. on the first 'debug' after any change to a ".c" file), every single time, I will get this...

 

Screen Shot 2015-12-29 at 20.05.14.png

 

The location of the fault will vary, and usually goes to the default IRQ.

 

If I hit DEBUG again, and/or recompile then debug...  I can get no change in behavior.

 

At this point, I do this trick...

 

Screen Shot 2015-12-29 at 20.06.02.png

 

 

I comment (or uncomment) some of  __asm("nop") instructions.  

 

90% of the time this works and I go to the next step (below)....  but occasionally I need to give it a different number of NOPs.

 

Then I get this....

 

Screen Shot 2015-12-29 at 20.06.53.png

 

 

But that's OK, I know I'm one step away from running.....

 

I hit STOP, then DEBUG again.....  And it boots perfectly.

 

At this point I can debug, breakpoint, reset, anything I want...  I can even STOP and start the debug again.  Everything is OK until I change a ".c" file.

 

What on earth is going on?  Any ideas where to look?

 

I can work like this, just, but the time it takes to 'make a change' => 'run the app' is frustrating.   I'm literally commenting and un-commenting NOPs with every run, and it works around the problem.

 

I've tried changing the optimisation level, also I've tried changing some clock settings (CPU speed, oscillator capacitive load, JLink debug speed, etc.) which didn't help.

 

Any ideas?

 

Kris

Outcomes