AnsweredAssumed Answered

Using TPM2 for high speed timer

Question asked by DALE RODDA on Jun 16, 2011
Latest reply on Jun 23, 2011 by DALE RODDA

I have a CM10.1. MQX 3.7 project that I need to a 1MS timer to. From what I can read this is faster than I should be current a MQX ttimer so I attempted to add TMP2 useing processor expert.

This is what was generated from PE


/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : TPM3.c
**     Project   : ProcessorExpert
**     Processor : MCF51JM128VLD
**     Component : Init_TPM
**     Version   : Component 01.080, Driver 01.20, CPU db: 3.00.061
**     Compiler  : CodeWarrior ColdFireV1 C Compiler
**     Date/Time : 2011-06-16, 11:57, # CodeGen: 15
**     Abstract  :
**          This file implements the TPM (TPM2) module initialization
**          according to the Peripheral Initialization Component settings,
**          and defines interrupt service routines prototypes.
**     Settings  :
**          Component name                                 : TPM3
**          Device                                         : TPM2
**          Settings                                       :
**            Clock settings                               :
**              Clock source select                        : Bus rate clock
**              Prescaler                                  : 8
**              Modulo counter                             : 524
**              Period                                     : 1.001 ms
**            Channels                                     : 1
**              Channel                                    :
**                Capture/compare device                   : TPM21
**                Settings                                 :
**                  Mode                                   : Pin not used
**                Pin                                      : Not Used
**                Interrupt                                :
**                  Channel Interrupt                      :
**                    Interrupt                            : Vtpm2ch1
**                    Channel Interrupt                    : Enabled
**                    Priority                             : default
**                    ISR name                             : myisr
**          Pins                                           :
**            External clock source                        : Disabled
**          Interrupts                                     :
**            Overflow Interrupt                           :
**              Interrupt                                  : Vtpm2ovf
**              Overflow Interrupt                         : Disabled
**              Priority                                   : default
**              ISR name                                   :
**          Initialization                                 :
**            Call Init method                             : yes
**            Enable module                                : yes
**     Contents  :
**         Init - void TPM3_Init(void);
**
**     Copyright : 1997 - 2010 Freescale Semiconductor, Inc. All Rights Reserved.
**    
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/
 
   
void TPM_Modbus_Init(void)
{
   
     (void)getReg8(TPM2C1SC);             /* Channel 0 int. flag clearing (first part) */
      /* TPM2C1SC: CH1F=0,CH1IE=1,MS1B=0,MS1A=0,ELS1B=0,ELS1A=0,??=0,??=0 */
      setReg8(TPM2C1SC, 0x40U);            /* Int. flag clearing (2nd part) and channel 0 contr. register setting */
      /* TPM2SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
      setReg8(TPM2SC, 0x00U);              /* Stop and reset counter */
      setReg16(TPM2MOD, 0x020CU);          /* Period value setting */
      (void)getReg8(TPM2SC);               /* Overflow int. flag clearing (first part) */
      /* TPM2SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=1,PS2=0,PS1=1,PS0=1 */
      setReg8(TPM2SC, 0x0BU);              /* Int. flag clearing (2nd part) and timer control register setting */

}

 

In my MQX programI installed the locat_tick_isr

 

#define MODBUS_TIMER_INTERRUPT_VECTOR (MCF51JM_INT_Vtpm2ch1)

 

         _int_install_isr(MODBUS_TIMER_INTERRUPT_VECTOR, local_tick_isr,  isr_ptr);

         TPM_Modbus_Init();
But the loca_tick_isr never is ran.

 

Any idea what is wrong.

Thanks

 

Outcomes