KSDK MCG PLL example?

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

KSDK MCG PLL example?

Jump to solution
1,027 Views
mjg8t
Contributor IV

Hi There,

 

I am trying to get familiarized with the new SDK API's (very powerful yet much more complex).  To get started I am looking into how the MCG drivers work.  I was previously using the mcg.h/c which was quite simple to configure the PLL, clk sources, etc. 

 

In order to understand how this works I have been going through the SDK example projects to see how they are using the MCG.  I thought for sure that the USB examples would have to be configuring the PLL for proper operation.  After single stepping the code for the USB device CDC and a number of other projects I do not see any calls to any MCG PLL or OSC setups functions.  The only clock configuration that I can find in any of examples, other than clock gates, is:

“/* Setup board clock source. */

    g_xtal0ClkFreq = 8000000U;

    g_xtalRtcClkFreq = 32768U;

Yes, I could try and brute force my way using the API documentation,  but an example would be quite nice and seemingly appropriate.  Maybe there is one and I missed it somewhere?

Labels (1)
0 Kudos
1 Solution
640 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi M J,

1) About the defauld MCG related configuration of  KSDK demo , its in here  "in startup -> sys_MK64F12.C".

Also, you can create a PE project ,then configuration the clock , refer to the generate code  ,like this:

pastedImage_1.png

2) Use the KSDK driver configuration the MCG, you can refer to the "C:\Freescale\KSDK_1.1.0\doc\Kinetis SDK v1.1 API Reference Manual.pdf\34.2 MCG HAL driver" .

We can configuration the CLOCK through these two methods according to our need.

If you  have any question when configuration CLOCK,  welcome to the community discuss.

Best Regards,

Alice

------------------------------------------------------------------------------------------

If this post answers your question, please click the Correct Answer button.

-----------------------------------------------------------------------------------

If this post help your question, please click the helpful Answer button.

View solution in original post

0 Kudos
5 Replies
640 Views
mjg8t
Contributor IV

Hi Alice,

My PE project does not generate the "sys_MK64F12.C" which runs the MCG setup code, but rather in my version it has the MCG config in the "CPU_Init.c".  I would like to get get PE running with the same config code as is used in the KSDK.  

1) Can you tell me how you have conifgured the PE project for the K64 which you show the screen shot?  I am using KDS 2.0.0 with updates for PE and PE_K22.


2) are you using the "Kinetis SDK" and "Processor Expert" options as shown in my figure1?  I am getting an error in project creation when enabling both options.  The errors shown in figure 3 seem to inidicate that I the SDK is missing an update?


My PE project creation steps when using KDS 2.0.0 with PE update and K22 update:



k64_pe_setup_project_1.jpg


k64_pe_ksdk_setup_project_error_2.jpg


k64_pe_ksdk_setup_project_error_3.jpg

0 Kudos
640 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi M J,

Which KSDK version did you use ?  mine is the latest  KSDK 1.1.0 . I recommend you use the latest one (Software Development Kit for Kinetis MCUs|Freescale ).

Have you build the "ksdk_platform_lib" before you create your project ?

Please refer to the "Getting strted with kinetis SDK "(C:\Freescale\KSDK_1.1.0\doc)  when you use KSDK.

Pay attention , the Clock configuration is complete on the "system_MK22F.c". And after create project ,if you want

change the clock,  on one hand ,you can change on the file (In my own opinion , this methed is better);

On the other hand , you can use the SDK function ,its in here  : " Kinetis SDK v1.1 API Reference Manual.pdf\34.2 MCG HAL driver ".

Best Regards

Alice

0 Kudos
640 Views
mjg8t
Contributor IV

Hi Alice,

Thank you for the information.  Indeed my problem was that I had installed the PE_KDS eclipse update from the KDS updates download pagge, where I needed to install the version locally from "KSDK_1.1.0\tools\eclipse_update".  All is working as expected now.

Cheers.

0 Kudos
641 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi M J,

1) About the defauld MCG related configuration of  KSDK demo , its in here  "in startup -> sys_MK64F12.C".

Also, you can create a PE project ,then configuration the clock , refer to the generate code  ,like this:

pastedImage_1.png

2) Use the KSDK driver configuration the MCG, you can refer to the "C:\Freescale\KSDK_1.1.0\doc\Kinetis SDK v1.1 API Reference Manual.pdf\34.2 MCG HAL driver" .

We can configuration the CLOCK through these two methods according to our need.

If you  have any question when configuration CLOCK,  welcome to the community discuss.

Best Regards,

Alice

------------------------------------------------------------------------------------------

If this post answers your question, please click the Correct Answer button.

-----------------------------------------------------------------------------------

If this post help your question, please click the helpful Answer button.

0 Kudos
640 Views
mjg8t
Contributor IV

Thank you Alice.  Hiding in the startup code, that explains it.

Cheers!

0 Kudos