AnsweredAssumed Answered

Project runs with debugger, but will not run without debugger

Question asked by KEVIN KRATZER on Oct 18, 2018
Latest reply on Oct 31, 2018 by David Sherman

What kind of set up problem is this?  The MKE02Z64VLD2 M0+ processor operates 2 SPI modules and PWM inverter output operate just fine when the debugger (Universal Multilink) is attached. If the debugger is removed with power on, the project works fine.  However, if the power is removed discharging the supply completely, upon power up the project will not run with no debugger attached).  Processor Expert was used to generate the projects inits.  The external 32.768 KHz crystal runs at frequency at high gain with a beautiful sine-wave.  The Kinetis Design Studio (Version: 3.2.0) is used for this project.

Kinetis Microcontrollers@@@##

Here is the Processor Expert clock initialization code:

/* System clock initialization */
/* ICS_C2: BDIV|=1 */
ICS_C2 |= ICS_C2_BDIV(0x01); /* Update system prescalers */
/* SIM_BUSDIV: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,BUSDIV=0 */
SIM_BUSDIV = 0x00U; /* Update system prescalers */
/* Switch to FEE Mode */
/* ICS_C2: BDIV=1,LP=0 */
ICS_C2 = (uint8_t)((ICS_C2 & (uint8_t)~(uint8_t)(
ICS_C2_BDIV(0x06) |
ICS_C2_LP_MASK
)) | (uint8_t)(
ICS_C2_BDIV(0x01)
));
/* OSC_CR: OSCEN=1,??=0,OSCSTEN=0,OSCOS=1,??=0,RANGE=0,HGO=1,OSCINIT=0 */
OSC_CR = (OSC_CR_OSCEN_MASK | OSC_CR_OSCOS_MASK | OSC_CR_HGO_MASK);
/* ICS_C1: CLKS=0,RDIV=0,IREFS=0,IRCLKEN=0,IREFSTEN=0 */
ICS_C1 = (ICS_C1_CLKS(0x00) | ICS_C1_RDIV(0x00));
while((ICS_S & ICS_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
}
while((ICS_S & 0x0CU) != 0x00U) { /* Wait until output of the FLL is selected */
}
/*** End of PE initialization code after reset ***/

 

Manual: https://www.nxp.com/docs/en/reference-manual/MKE02Z64M20SF0RM.pdf  Clock section begins on page 263.

Outcomes