AnsweredAssumed Answered

USBDM, KDS, MKE04, debugging stuck

Question asked by Jaromir Sukuba on Apr 25, 2017
Latest reply on Apr 27, 2017 by Jaromir Sukuba


I'm trying to set up debugging with KDS3.2 and USBDM, plus DIY board with MKE04Z8VWJ4 part and LED attached to PB5 pin (along with decoupling capacitors and pull-up on RESET line).

I installed both components, set up project in KDS that blinks a LED, compiled binary and this binary can be loaded into MCU using "ARM programmer" component with no problems - see screenshot here - the LED blinks as expected.


When I set debug configuration to USBDM - see here - and start debugging, something strange happens. The debugger isn't stopped at main, but on first instruction after reset. See screenshot of KDS here. When I hit Resume (F8) LED blinks - indicating the debugger set MCU to run. After hitting suspend, the LED stops blinking, but current location displayed is still on first instruction after reset. I'm not sure how can I fix it.

I know this information is quite sparse, I can provide more screenshots/logs/whatever when needed.


The program to blink a LED looks like this:


#include "MKE04Z4.h"

static int i = 0;
static unsigned long cnt;

int main(void)
    GPIOA_PDDR = (1<<13);
    GPIOA_PDOR = (1<<13);
    for (;;) {
        for (cnt=0;cnt<500000;cnt++);
        GPIOA_PSOR = (1<<13);
        for (cnt=0;cnt<500000;cnt++);
        GPIOA_PCOR = (1<<13);
    return 0;