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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,445 次查看
bingee
Contributor I

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;
}

标签 (1)
标记 (3)
0 项奖励
1 解答
2,214 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

The KSDK2.0 doesn't support MK60DN512ZVLQ10.

According to Kinetis K 100MHz Rev 1.x to Rev 2.x Migration Guide, MK60DN512ZVLQ10 belong to Rev 1.x.

Part numbering and maskset information.png

Since your MCU doesn't have MCG_C7 Register, it will run to "HardFault_Handler".

MCG_C7 Register.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
2,215 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

The KSDK2.0 doesn't support MK60DN512ZVLQ10.

According to Kinetis K 100MHz Rev 1.x to Rev 2.x Migration Guide, MK60DN512ZVLQ10 belong to Rev 1.x.

Part numbering and maskset information.png

Since your MCU doesn't have MCG_C7 Register, it will run to "HardFault_Handler".

MCG_C7 Register.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,214 次查看
bingee
Contributor I

Thanks for your help.谢谢帮助

0 项奖励