Author Topic: Flex timer  (Read 14963 times)

Offline internship2

  • Newbie
  • *
  • Posts: 11
    • View Profile
Flex timer
« on: February 18, 2013, 01:16:06 PM »
Hi i need a timer for checking on a signal. I have be looking at the flex timer from Freescale. Someone now if this is possible to use with uTasker or if uTasker have a better timer?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Flex timer
« Reply #1 on: February 18, 2013, 03:51:48 PM »
Hi

It depends on what you want to do with the timer.
The uTasker project supports PIT timers (see SUPPORT_PITS) for generating single-shot and periodic interrupts (the Kinetis has 4 of them).
In addition, when the resolution doesn't need to be extremely high the SW timers can be used (based on the Cortex SysTick timer).

The FlexTimers are only supported for PWM generation at the moment (see SUPPORT_PWM_MODULE).

There are examples of the use of HW timers in the file ADC_Timers.h.

Regards

Mark

Offline internship2

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Flex timer
« Reply #2 on: February 19, 2013, 03:11:02 PM »
Hi Mark
I wont to receiving a signal, check have many pulses there are in it and the time. I think i have found the solution with this code:

static void fnConfigure_Timer(void)
{
   
   static TIMER_INTERRUPT_SETUP timer_setup = {0};    //interrupt configuration
   timer_setup.int_type = TIMER_INTERRUPT;
   timer_setup.int_priority = PRIORITY_TIMERS;
   timer_setup.int_handler = 0;                  //interrupt handler on overflow
   timer_setup.timer_reference = 2;               //timer channel 2 (to se wich one to use) se app_hw_kinetis.h I am using ftm
   timer_setup.timer_mode = (FTM0_EXTTRIG);          //Timer clock input and edge
   timer_setup.timer_value = 0.000002;               //u sec. 1/500.000
   fnConfigureInterrupt((void *)&timer_setup);         //enable PWM signal      
}