What is the maximum bus and CMT clock in a K60?

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

What is the maximum bus and CMT clock in a K60?

859 Views
elmartrojer
Contributor I

Hi,

I am planning to use the CMT peripheral in a K60. The ref guide states that the CMT was designed to work with a IF clock of 8 MHz and in order to get there provides 2 prescalers (primary and secondary) in case a higher bus clock is used. The 8 MHz give a 125ns resolution which is too little for my application. I would need to get something in the area of 20 ns corresponding to 50 MHz CMT clock. I also read that the bus clock can be up to 50 MHz. So is it possible to run the bus clock at 50 MHz and use the CMT with both prescalers on 1?

Thanks alot!

Elmar

Tags (3)
0 Kudos
3 Replies

479 Views
albertovargas
NXP Employee
NXP Employee

Hi,

According to Table 5-2, page 190 of the Reference Manual (http://cache.freescale.com/files/32bit/doc/data_sheet/K60P144M100SF2V2.pdf?fpsp=1&WT_TYPE=Data%20She...) (and assuming you own a K60 at 100Mhz), the CMT takes the bus clock signal.

K60P144M100 - CMT Timer.PNG.png

Then you have to configure your MCG to have an output of 100 Mhz on the core / system clock and 50 Mhz on the Bus clock.

I hope this helps.

0 Kudos

479 Views
elmartrojer
Contributor I

Hi Alberto and thx for your reply. Yes, I know that the CMT clock is derived from the bus clock that can be configured to 50 MHz. But there are two prescalers that I can set to reduce the clock. My question is if the CMT block does reliably work with a 50 MHz or if it needs the prescaler to be set to lower the clock to 8 MHz.

This is maybe a question for Freescale.

Regards Elmar

0 Kudos

479 Views
albertovargas
NXP Employee
NXP Employee

I generated a project using MQX and Processor Expert. This is the configuration for System Clocks

K60P144M100 - CMT Timer - CPU Clocks.PNG.png

And this is the generated code for CMT.c

/* ###################################################################

**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.

**     Filename    : CMT.c

**     Project     : ProcessorExpert

**     Processor   : MK60DN256VLQ10

**     Component   : Init_CMT

**     Version     : Component 01.006, Driver 01.06, CPU db: 3.00.000

**     Compiler    : GNU C Compiler

**     Date/Time   : 2013-09-03, 13:39, # CodeGen: 2

**     Abstract    :

**          This file implements the CMT (CMT) module initialization

**          according to the Peripheral Initialization settings, and

**          defines interrupt service routines prototypes.

**     Settings    :

**          Component name                                 : CMT

**          Device                                         : CMT

**          Settings                                       :

**            Clock gate                                   : Do not initialize

**            Clock setting                                :

**             Primary prescaler divider                  : divide by 1

**              Clock divide prescaler                     : divide by 1

**              Input clock freqency                       : 50 MHz

**            Carrier generator                            :

**              Primary carrier high time value            : 0

**              Primary carrier high time                  : 0 us

**              Primary carrier low time value             : 0

**              Primary carrier low time                   : 0 us

**              Primary carrier frequency                  : 0 MHz

**              Secondary carrier high time value          : 0

**              Secondary carrier high time                : 0 us

**              Secondary carrier low time value           : 0

**              Secondary carrier low time                 : 0 us

**              Secondary carrier frequency                : 0 MHz

**            Mode                                         : Time

**            Modulator                                    :

**              Mark period data                           : 0

**              Mark pulse length                          : 0.16 us

**              Space period data                          : 0

**              Space pulse length                         : 0 us

**          Pins                                           :

**            Output pin                                   : PTD7/CMT_IRO/UART0_TX/FTM0_CH7/FTM0_FLT1

**            Output pin signal                            :

**            Output pin enabled                           : no

**            Output pin active polarity                   : Low

**            Init output pin latch value                  : Low

**          Interrupts/DMA                                 :

**            End of cycle interrupt/DMA                   :

**              Interrupt                                  : INT_CMT

**              Interrupt request                          : Disabled

**              Interrupt priority                         : 0 (Highest)

**              ISR Name                                   :

**              End of cycle interrupt                     : Disabled

**              Request type                               : Interrupt

**          Initialization                                 :

**            Enable modulator and carrier generator       : no

**            Extended space operation in init             : Disabled

**            Call Init method                             : yes

**     Contents    :

**         Init - void CMT_Init(void);

**

**     Copyright : 1997 - 2013 Freescale Semiconductor, Inc. All Rights Reserved.

**     SOURCE DISTRIBUTION PERMISSIBLE as directed in End User License Agreement.

**   

**     http      : www.freescale.com

**     mail      : support@freescale.com

** ###################################################################*/

/*!

** @file CMT.c

** @version 01.06

** @brief

**          This file implements the CMT (CMT) module initialization

**          according to the Peripheral Initialization settings, and

**          defines interrupt service routines prototypes.

*/       

/*!

**  @addtogroup CMT_module CMT module documentation

**  @{

*/       

/* MODULE CMT. */

#include "CMT.h"

  /* Including shared modules, which are used in the whole project */

#include "PE_Types.h"

#include "PE_Error.h"

#include "PE_Const.h"

#include "IO_Map.h"

#include "Cpu.h"

/*

** ===================================================================

**     Method      :  CMT_Init (component Init_CMT)

**     Description :

**         This method initializes registers of the CMT module

**         according to the Peripheral Initialization settings.

**         Call this method in user code to initialize the module. By

**         default, the method is called by PE automatically; see "Call

**         Init method" property of the component for more details.

**     Parameters  : None

**     Returns     : Nothing

** ===================================================================

*/

void CMT_Init(void)

{

  /* Clear interrupt flags */

  (void)(CMT_MSC == 0U);                                 

  (void)(CMT_CMD2 == 0U);                                 

  /* CMT_OC: IROL=0,CMTPOL=0,IROPEN=0,??=0,??=0,??=0,??=0,??=0 */

  CMT_OC = 0x00U;                                 

  /* CMT_PPS: ??=0,??=0,??=0,??=0,PPSDIV=0 */

  CMT_PPS = CMT_PPS_PPSDIV(0x00);                                 

  /* CMT_CGH1: PH=0 */

  CMT_CGH1 = CMT_CGH1_PH(0x00);                                 

  /* CMT_CGL1: PL=0 */

  CMT_CGL1 = CMT_CGL1_PL(0x00);                                 

  /* CMT_CGH2: SH=0 */

  CMT_CGH2 = CMT_CGH2_SH(0x00);                                 

  /* CMT_CGL2: SL=0 */

  CMT_CGL2 = CMT_CGL2_SL(0x00);                                 

  /* CMT_CMD1: MB=0 */

  CMT_CMD1 = CMT_CMD1_MB(0x00);                                 

  /* CMT_CMD2: MB=0 */

  CMT_CMD2 = CMT_CMD2_MB(0x00);                                 

  /* CMT_CMD3: SB=0 */

  CMT_CMD3 = CMT_CMD3_SB(0x00);                                 

  /* CMT_CMD4: SB=0 */

  CMT_CMD4 = CMT_CMD4_SB(0x00);                                 

  /* CMT_DMA: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,DMA=0 */

  CMT_DMA = 0x00U;                                 

  /* CMT_MSC: EOCF=0,CMTDIV=0,EXSPC=0,BASE=0,FSK=0,EOCIE=0,MCGEN=0 */

  CMT_MSC = CMT_MSC_CMTDIV(0x00);                                 

}

/* END CMT. */

/*!

** @}

*/

/*

** ###################################################################

**

**     This file was created by Processor Expert 10.2 [05.06]

**     for the Freescale Kinetis series of microcontrollers.

**

** ###################################################################

*/

0 Kudos