AnsweredAssumed Answered

K20 PIT ISR configuration problem

Question asked by Yves B on Feb 27, 2014
Latest reply on Feb 27, 2014 by Yves B

Hi,

 

I am trying to configure an isr on the K20P100 dev kit (TWRK20D) to blink a LED, using the demo_gpio.c example as basis.

 

Here's my init routine called by main:

void _init_PIT()

{

   // enable PIT clock

    SIM_SCGC6 |= SIM_SCGC6_PIT_MASK;

   // enable PIT clock, freeze in debug

    PIT_MCR = 0x01;

   // set PIT 3

    PIT_LDVAL3 = 5000000; // setup timer for 5000000 cycles

    PIT_TCTRL3 = PIT_TCTRL_TIE_MASK // enable timer interrupt

                | PIT_TCTRL_TEN_MASK; // enable timer

 

     NVICICPR2 |= 1 << (71%32);

     NVICISER2 |= 1 << (71%32);

}

 

in the isr.h, I added this:

 

#undef  VECTOR_87

#define VECTOR_87 isr_pit3

 

extern void isr_pit3(void);

 

then I added in demo_gpio.c:

void isr_pit3(void)

{

    PIT_TFLG3 |= 1;

    GPIOC_PTOR |= 1<<PIN_LED_2; 

}

 

This code doesn't work, execution never goes to isr_pit3() function.

 

Am I missing something?

 

Regards,

Yves

Outcomes