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.
Solved! Go to Solution.
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.
The clock configuration can be found in Cpu_SetClockConfiguration() in bsp_cm.c.
there is also a definition for clock configuration, which can be found in BSP_CLOCK_CONFIGURATION, bsp_cm.h
For calculating the PWM frequency, do you mean the FlexTimer module?
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.
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.
The clock configuration can be found in Cpu_SetClockConfiguration() in bsp_cm.c.
there is also a definition for clock configuration, which can be found in BSP_CLOCK_CONFIGURATION, bsp_cm.h
For calculating the PWM frequency, do you mean the FlexTimer module?
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?
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:
Hope that helps,
Best Regards,
Kan Li
Technical Information & Commercial Support AP (Kinetis/ColdFire)
Freescale Semiconductor (China) Limited Shanghai Branch Office
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.