Where is CLOCK_SetInternalRefClkConfig() in KL03 SDK 2.0?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Where is CLOCK_SetInternalRefClkConfig() in KL03 SDK 2.0?

Jump to solution
871 Views
chucksmith
Contributor II

Hello, I want to clock the LPTMR using the internal reference clock, but this does not work unless the internal reference clock is enabled, so I need to call CLOCK_SetInternalRefClkConfig(), per the SDK 2.0 API reference. But I cannot find CLOCK_SetInternalRefClkConfig anywhere in the 2.0 SDK.

 

Thanks

Labels (1)
0 Kudos
1 Solution
667 Views
charlesasquith
NXP Employee
NXP Employee

I see what you mean. The code should work as intended if you use one of the predefined masks, such as kMCGLITE_IrclkEnable. On that note, however, I see that there is a 0U in BOARD_BootClockRUN's .irclkEnableMode, which is not a predefined mask and will have the affect you described.

To fix this, make sure you put one of the predefined masks (kMCGLITE_IrclkEnable or kMCGLITE_IrclkEnableInStop) into .irclkEnableMode and everything should work as intended. I will send this to the right people to get the 0U replaced with a mask, and see about getting the API reference manual updated.

With this in mind, I do believe that the steps outlined in my first reply should hold.

Best regards,

Charles

View solution in original post

0 Kudos
4 Replies
667 Views
charlesasquith
NXP Employee
NXP Employee

Hi Chuck,


assuming you've filled out configuration structures already, then all you should have to do in terms of API is:
1. Call CLOCK_SetSimSafeDivs()

2. Call  CLOCK_SetMcgliteConfig(...)

3. Call  CLOCK_SetSimConfig(...)

Is this not the case?

Charles

0 Kudos
667 Views
chucksmith
Contributor II

After poking around a bit, I did find CLOCK_SetMcgliteConfig(), and that does the job. However, I am still surprised the API reference document for the SDK refers to a function, CLOCK_SetInternalRefClkConfig() that apparently does not exist.

Also, I believe there is an issue in CLOCK_SetMcgliteConfig(), in the following line of code:

    MCG->C1 = MCG_C1_CLKS(targetConfig->outSrc) | targetConfig->irclkEnableMode;

If irclkEnableMode is just a 0 or a 1, then the C1 bit this is loaded into is incorrect...it needs to be shifted into bit 1.

Thanks,

Chuck

0 Kudos
668 Views
charlesasquith
NXP Employee
NXP Employee

I see what you mean. The code should work as intended if you use one of the predefined masks, such as kMCGLITE_IrclkEnable. On that note, however, I see that there is a 0U in BOARD_BootClockRUN's .irclkEnableMode, which is not a predefined mask and will have the affect you described.

To fix this, make sure you put one of the predefined masks (kMCGLITE_IrclkEnable or kMCGLITE_IrclkEnableInStop) into .irclkEnableMode and everything should work as intended. I will send this to the right people to get the 0U replaced with a mask, and see about getting the API reference manual updated.

With this in mind, I do believe that the steps outlined in my first reply should hold.

Best regards,

Charles

0 Kudos
667 Views
chucksmith
Contributor II

Agreed - thanks.

0 Kudos