AnsweredAssumed Answered

When I debug to "MCG_C7_OSCSEL_VAL",the mcu will run to "HardFault_Handler".

Question asked by bin wu on Feb 6, 2017
Latest reply on Feb 8, 2017 by bin wu

I used MK60DN512ZVLQ10 and KSDK 2.0.0

There are some problems with this code.
When I debug to "MCG_C7_OSCSEL_VAL",the mcu will run to "HardFault_Handler".

What should I do?

file name :fls_clock.c
/*******************************************************************************
* Code
******************************************************************************/

static uint32_t CLOCK_GetMcgExtClkFreq(void)
{
uint32_t freq;

switch (MCG_C7_OSCSEL_VAL)
{
case 0U:
/* Please call CLOCK_SetXtal0Freq base on board setting before using OSC0 clock. */
assert(g_xtal0Freq);
freq = g_xtal0Freq;
break;
case 1U:
/* Please call CLOCK_SetXtal32Freq base on board setting before using XTAL32K/RTC_CLKIN clock. */
assert(g_xtal32Freq);
freq = g_xtal32Freq;
break;
default:
freq = 0U;
break;
}

return freq;
}

Attachments

Outcomes