initialisation for K60

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

initialisation for K60

Jump to solution
987 Views
guillaumetiffin
Contributor III

Hello,

Sorry for my english.

I'm new with the Kinetis products.

I have some question about the K60.

I come from the microchip environnement so I'm a litlle bit lost.

I would like to do the project with MQX. So I take my examples from the demo board project for the k60 tower.

My question is about the initialisation.

Where is done the initialisation of the microcontroller?

How can we know the microcontroller frequency? Is there a constant somewhere or something like that?

Is there a simple way to calculate the pwm frequency?

Thanks for everyone who can help me.

Labels (1)
Tags (3)
0 Kudos
1 Solution
538 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

You may find the MQX initialisation in mqx.c, in which there is a function named as "

_mqx_uint _mqx

(

    register MQX_INITIALIZATION_STRUCT_PTR mqx_init

)

"

it performs brief initialisation and starts MQX on the processor. For BSP-specific initialization, it is done in _bsp_enable_card(), which can be found in init_bps.c . Please refer to following for details.

a1.JPG

The clock configuration can be found in Cpu_SetClockConfiguration() in bsp_cm.c.

a1.JPG

there is also a definition for clock configuration, which can be found in BSP_CLOCK_CONFIGURATION, bsp_cm.h

a1.JPG

For calculating the PWM frequency, do you mean the FlexTimer module?

View solution in original post

0 Kudos
5 Replies
538 Views
guillaumetiffin
Contributor III

Hi,

Thank you very much.

I understand better now how to initialize the K60 and how the PW (FlexTimer) works.

I will have a look a the bare board project to understand how it works without MQX.

0 Kudos
539 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

You may find the MQX initialisation in mqx.c, in which there is a function named as "

_mqx_uint _mqx

(

    register MQX_INITIALIZATION_STRUCT_PTR mqx_init

)

"

it performs brief initialisation and starts MQX on the processor. For BSP-specific initialization, it is done in _bsp_enable_card(), which can be found in init_bps.c . Please refer to following for details.

a1.JPG

The clock configuration can be found in Cpu_SetClockConfiguration() in bsp_cm.c.

a1.JPG

there is also a definition for clock configuration, which can be found in BSP_CLOCK_CONFIGURATION, bsp_cm.h

a1.JPG

For calculating the PWM frequency, do you mean the FlexTimer module?

0 Kudos
538 Views
guillaumetiffin
Contributor III

Hi,

Thank you for your response it's really helpfull.

For the PWM frequency, I mean the FlexTimer module.

If I well understand your answer, it means that you have to rebuild or copy and rebuild all the mqx sources with your specific board configuration? You can't just define some macro in your project to fit to your board?

And if you don't use mqx, is there are other files to include or a processus to follow?

0 Kudos
538 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

FlexTimer supports EPWM , CPWM and Combine mode, for EPWM or Combine mode, the period is determined by (MOD − CNTIN + 0x0001), and for CPWM mode, the period is determined by 2 × (MOD − CNTIN). So if the FTM selects bus clock as reference, the output frequency should be bus clock/period. So if you always set CNTIN(the counter initial value) as zero, you may have the formula as bus clock/(MOD+1) or bus clock/2MOD.

And Please kindly have my answers as below:

If I well understand your answer, it means that you have to rebuild or copy and rebuild all the mqx sources with your specific board configuration? You can't just define some macro in your project to fit to your board?

-In my understanding, if you modify some configuration in MQX, you must rebuild the BSP to let the modification take effect.

And if you don't use mqx, is there are other files to include or a processus to follow?

-Do you mean the bare board project? We do have such examples to let customer use as a starting point, for K60, you may download KINETIS_SC from the following link:

http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS512_SC&location=null&fpsp=1&...

Hope that helps,

Best Regards,

Kan Li

Technical Information & Commercial Support AP (Kinetis/ColdFire)

Freescale Semiconductor (China) Limited Shanghai Branch Office

538 Views
Kan_Li
NXP TechSupport
NXP TechSupport

One more thing I have to point out, the FTM's clock source can pass a prescale to reduce the frequency, the division factors include 1,2,4,8,16,32,64 and 128. so for above formula, the division factor is assumed as 1.

0 Kudos