Error Changing from FEI to FBI with KSDK on FRDM-KL25Z

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

Error Changing from FEI to FBI with KSDK on FRDM-KL25Z

跳至解决方案
739 次查看
ives
Contributor I

Hi!

 

I have a FRDM-KL25Z and I'm trying to change the power mode from FEI to FBI. I want to run on FBI mode with a internal frequency of 4 MHz. I've used the following code to do the job:

 

CLOCK_HAL_SetOutDiv1(SIM, 0);
CLOCK_HAL_SetOutDiv4(SIM, 4);
mcg_mode_error_t mcgModeError = CLOCK_HAL_SetFbiMode(MCG, kMcgDcoRangeSelLow, kMcgIrcFast, 1, NULL);

 

The problem is that the firmware stops running during the CLOCK_HAL_SetFbiMode function. I've added a breakpoint inside this function and I saw that the problem is in the following line:

 

    MCG_WR_C1(base, (MCG_RD_C1(base) & ~(MCG_C1_CLKS_MASK | MCG_C1_IREFS_MASK))

                  | (MCG_C1_CLKS(kMcgClkOutSrcInternal)  /* CLKS = 1 */

                  | MCG_C1_IREFS(kMcgFllSrcInternal))); /* IREFS = 1 */

 

I realized that if I change the CLOCK_HAL_SetFbiMode function, to force it to write on MCG_C1 register after writing on MCG_C2 register, the firmware works!

 

Do you think there is a problem in CLOCK_HAL_SetFbiMode function?

标签 (1)
0 项奖励
1 解答
593 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ives,

For your question , i have some suggestions :

1) Which version of KSDK do you use ? i recommend you use the latest one ksdk1.3, you can download it in the web.

2) If you want use the KSDK APIs configure the clock mode ,i recommend you sue the function "CLOCK_SYS_SetConfiguration()",

it configure the SIM SIM  .etc clock module  ,it include the function "CLOCK_HAL_SetFbiMode" ,you can find this function here :

Freescale\KSDK_1.3.0\platform\system\src\clock\MKL25Z4\fsl_clock_MKL25Z4.c

(in general , do not directly use the  "HAL " functions, these HAL functions are call by the driver fucntions. )

3)If you do not want use the ksdk driver,  in the file of "system_MKL25z4.c" and "system_MKL25Z4.h" have defined all of the clock mode ,

you can refer to :

pastedImage_1.png

4) You can also use the PE configure the clock , i thin it is easy .

If use the latest version still can not work well,  please contact me without any hesitate .

Hope it helps

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


Have a great day,
Alice

在原帖中查看解决方案

3 回复数
594 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ives,

For your question , i have some suggestions :

1) Which version of KSDK do you use ? i recommend you use the latest one ksdk1.3, you can download it in the web.

2) If you want use the KSDK APIs configure the clock mode ,i recommend you sue the function "CLOCK_SYS_SetConfiguration()",

it configure the SIM SIM  .etc clock module  ,it include the function "CLOCK_HAL_SetFbiMode" ,you can find this function here :

Freescale\KSDK_1.3.0\platform\system\src\clock\MKL25Z4\fsl_clock_MKL25Z4.c

(in general , do not directly use the  "HAL " functions, these HAL functions are call by the driver fucntions. )

3)If you do not want use the ksdk driver,  in the file of "system_MKL25z4.c" and "system_MKL25Z4.h" have defined all of the clock mode ,

you can refer to :

pastedImage_1.png

4) You can also use the PE configure the clock , i thin it is easy .

If use the latest version still can not work well,  please contact me without any hesitate .

Hope it helps

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


Have a great day,
Alice

593 次查看
ives
Contributor I

Thanks Alice! I am using KSDK 1.3. Good advice about the function CLOCK_SYS_SetConfiguration(). Have a great weekend.

0 项奖励
593 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi ives,

Welcome !:smileyhappy:

BR

Alice

0 项奖励